Jump to content

TrickyTommy

Members
  • Posts

    50
  • Joined

  • Last visited

Everything posted by TrickyTommy

  1. +: My problem is that getRealTime()'s month function returns the month without 0. And the number is less without the 0 and may work incorrectly.
  2. Hi. I made a table for player bans, right now it has 2 rows, one of it is the player's serial, and the other one is the reason. But the problem is, i can only make a system for permanent bans. I was wondering, how should i make a temporary one, and this is what i have come up so far: The player who banns should write the date until the ban is up like this: YYYYMMDDHHMM (all in together, it would look like this: 199903160010 So if the admin would like to ban him for a day, (199903170010) and if it passes by, the system checks the current date with the exact same format, and if the current date is bigger or equal to the date of expiry, it would let him pass the account system. Else it would say that the account is banned. This is my idea, but it might be complicated for admins to obey the format. Do you have a better one? If so, please let me know.
  3. yeah, but this forum helped me more so far than any mta-sa wikipedia page.
  4. ohh i see. i thought that triggerServerEvent's arg order is the same as triggerClientEvent's.
  5. So the correct way is this: ? triggerClientEvent (element, "characterCreationMenu", element, v['accountname'])
  6. Hi. I have a problem, that whoever is online on my server, sees edit boxes, that should only appear to who clicked a button (i use localPlayer), and it simply just appears for the ones who already passed the login panel. Pieces of scripts: (Client and serverside) Client: function loginButton_Click() loginUsernameText = guiGetText (loginUsername) loginPasswordText = guiGetText (loginPassword) triggerServerEvent ("attemptLogin", localPlayer, localPlayer, loginUsernameText, loginPasswordText) end Server: function attemptLogin(element, accountname, password) local q = exports.db:sqlQuery ("SELECT * FROM users WHERE accountname = '"..accountname.."' AND password = '"..md5(password).."';") local result = dbPoll(q, -1) if #result > 0 then for k, v in ipairs(result) do triggerClientEvent ("outputAccountMessage", element, "Successful login!", "information") setElementData (element, "logged", true, true) triggerClientEvent ("destroyEdits", element) setElementData (element, "id", v['id'], true) setElementData (element, "admin", v['admin'], true) setElementData (element, "aduty", v['aduty'], true) setElementData (element, "anick", v['anick'], true) setElementData (element, "banned", v['banned'], true) setElementData (element, "accountname", v['accountname'], true) local q = exports.db:sqlQuery ("SELECT * FROM characters WHERE owner = '"..getElementData(element, "id").."';") local result = dbPoll(q, -1) if #result > 0 then for k, v in ipairs(result) do setElementData (element, "hud", true, true) setElementData (element, "characterChosen", true, true) spawnPlayer (element, tonumber(v['posX']), tonumber(v['posY']), tonumber(v['posZ'])) fadeCamera (element, true) setCameraTarget (element, element) showCursor (element, false) showChat (element, true) setPedArmor (element, v['armor']) setElementHealth (element, v['health']) setElementInterior (element, v['interior']) setElementDimension (element, v['dimension']) setElementData (element, "name", v['name'], true) setElementModel (element, v['skinID']) setElementData (element, "anick", v['anick'], true) setElementData (element, "aduty", v['aduty'], true) dbFree (q) end else setElementData (element, "characterChosen", false, true) triggerClientEvent ("characterCreationMenu", element, element, v['accountname']) end end else triggerClientEvent ("outputAccountMessage", element, "Login failure!", "error") end dbFree (q) end addEvent ("attemptLogin", true) addEventHandler ("attemptLogin", root, attemptLogin) I mean for example edit boxes will appear to every if localPlayer's account has no character that is owned by his account id. And at the call of "destroyEdits" the editBoxes will get destroyed for everyone who has visual on the login panel. What did i screw up?
  7. Hi. I am making an interior system, alongside with a siren-system. I noticed, that whenever want to destroy (only just one siren), the other sirens, in other cars stop as well. The problem's description: I spawn 2 vehicles, and sound a siren in them, i sit into one of the 2 active sirening vehicles, and i stop the siren of the car i am sitting in, but the siren stops in the 2nd car too. And i want to make an interior system, already made it's tables, but after i get all the interior entrances from the database, with for k, v and i want to spawn a marker for each interior's entrance, but if i would do it like local interiorEntrance = createMarker (database results) and whenever i want to use it, it will not work correctly, because of the 30 interiors i made so far variable name is the same. This would be a solution, but it does not work. "INT:"..interiorID.."" = createMarker (...) How should i fix it?
  8. function sqlQuery(query, ...) return dbQuery(connection, query, ...) end iprint(connection, "INSERT INTO test (asd1, asd2) VALUES (?, ?)", "asd1", "asd2") local Query = sqlQuery ("INSERT INTO test (asd1, asd2) VALUES (?, ?)", "asd1", "asd2") if Query then outputServerLog ("true") else outputServerLog ("false") end i might be dumb, and messed it up. not sure if it's correct. FIXED: re-created the table, it is working now. function sqlQuery(query, ...) return dbQuery(connection, query, ...) end local Query = sqlQuery ("INSERT INTO test (test1, test2) VALUES (?, ?)", "Successsss 1", "Successsss 2") if Query then outputServerLog ("true") else outputServerLog ("false") end
  9. sorry, i dont get it, where do i need to put the iprint line?
  10. function sqlQuery(query, ...) return dbQuery(connection, query, ...) end local Query = sqlQuery ("INSERT INTO test (asd1, asd2) VALUES (?, ?)", "asd1", "asd2") if Query then outputServerLog ("true") else outputServerLog ("false") end it is not inserting to the database, however it returns true. what have gone wrong?
  11. Sorry, we misunderstood each other. Let me show it to you on the following picture: I want to make some king of a "useful function", and i would like to use this instead of dbQuery, because the connection was already declared here, and i would not like to declare an other connection in an other script. So i can export the function and use it like exports.db:sqlQuery(string query, variables for the query)
  12. connection = dbConnect( "mysql", "dbname="..mySQLDetails["db"]..";host="..mySQLDetails["host"].."", ""..mySQLDetails["acc"].."", ""..mySQLDetails["pass"].."", "share=1" ) function dbQuery(query, values) qh = dbQuery(connection, query, values) end Hi! I am making a mysql script, and i would not like to do the dbConnect stuff and things like this everytime. But after the query, there might be values, not only just one. So for example in the query, i want to insert 2 things, and it would look like this: -------------------------------------------------string query------------------------------------------- ---------------------values------------- dbQuery(connection, "INSERT INTO users (username, password) VALUES (?, ?)", Username, md5(Password)) But the password would not be inserted! I know that i'll have to use table. but how?
  13. you guys helped me to make my very first account system with gui! i am very thankful.
  14. thank you guys, i think i have one last question. what method should i use for getting the player's account id from database, and after set it as his element data?
  15. and where should i put the # before result? could you please write it into the code and post it here?
  16. if Result > 0 then Debugscript said that "attempt to compare number with table" what is wrong?
  17. i'll try it out asap, big thanks.
  18. and for example how can i output all the data, that exists in the username coloumn?
  19. Hi. I wan't to make a mini account system, but don't really know, how. I already can insert stuff to my database, but can't check if they exist from game, but php my admin. This is how my script looks like: Connection = dbConnect( "mysql", "dbname=texas;host=127.0.0.1", "root", "", "share=1" ) if Connection then outputServerLog ("Connection succeeded!") else outputServerLog ("Connection failure!") end function Insert(Client, Command, Username, Password) if Password then local Query = dbQuery(Connection, "INSERT INTO users (username, password) VALUES (?, ?)", Username, Password) if Query then outputDebugString ("Succesful query!") else outputDebugString ("Unsuccesful query!") end end end addCommandHandler ("insert", Insert) function Call(Client, Command, Username, Password) if Password then --If username and password exists in database, notify the user that given Username and Password parameter is correct. end end addCommandHandler ("call", Call) In function named "Call" i want a very simple thing: there are 2 parameters inside, Username and Password. If there is a row, in wich the password and username is the same as the parameter, i want it to like output a message, else make the user aware that the given details are wrong. Please, be so kind and help me, because i have no idea how should i do it, + add comments if possible.
  20. the bar's x length is 198. now it is not sticking out, but the bar is static, and not moving to anywhere.
  21. local MaxClipAmmo = getWeaponProperty (tonumber(getPedWeapon(localPlayer)), "std", "maximum_clip_ammo") local AmmoInClip = getPedAmmoInClip(localPlayer) local AllAmmo = getPedTotalAmmo (localPlayer) local maxAmmo = 300 local FullAmmoBar = dxDrawRectangle (1701/x*jx, 65/y*jy, math.min(AllAmmo, maxAmmo)/x*jx, 8/y*jy, tocolor(227, 160, 93, 255))
  22. still not working, it keeps sticking out.
  23. Hi. I want to make a rectangle, that displays the whole amount of ammunition you have, but if i have more ammo, than the rectangle's width, it will stick out from it's border. Here, take a look: I want it to be within it's black border. As you can see, it is sticking out. Code: local MaxClipAmmo = getWeaponProperty (tonumber(getPedWeapon(localPlayer)), "std", "maximum_clip_ammo") local AmmoInClip = getPedAmmoInClip(localPlayer) local AllAmmo = getPedTotalAmmo (localPlayer) local FullAmmoBar = dxDrawRectangle (1701/x*jx, 65/y*jy, AllAmmo/x*jx, 8/y*jy, tocolor(227, 160, 93, 255)) x is my resolution = 1920, 1080 and jx is player's resolutiion. so the rectangles will be the same on each monitor.
  24. still not working, i started debugging it, and changed serverscript's line 21 to output into chatbox if not boolchar. (else) what went wrong?
×
×
  • Create New...