Jump to content


  • Posts

  • Joined

  • Last visited


  • Location

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TrickyTommy's Achievements


Snitch (10/54)



  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?
  • Create New...