Jump to content

seal

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by seal

  1. seal

    Need SQL help

    well, i know how simple SQL query works, but how can i use "where" in MTA?
  2. seal

    Need SQL help

    thanks your comments, but how do the sql knows in which line should it update? e.g: id name money 1 John 123 2 Max 50 i call update function but how can i update max's values, instead e.g john's values?
  3. seal

    Need SQL help

    Hi, im new in lua programming and need some help in executesql using. Ok, i can create tables and rows but i cant put in values, so how can i put values into the database? E.G: playerposition, charactername. And when an account is already in the table how can is update its data? Thank you for your answers
  4. seal

    executeSQL problem

    thanks, i forgot it and now it is corrected thanks
  5. I'll like to save players' characters name into an sql table, but i got this debug message: attemp to call global: executesqlquery(a nil value) pls help me what do i wrong function createLoginWindow(thePlayer) showCursor(true, true) wdwLogin = guiCreateWindow(0.425, 0.425,0.15, 0.15, "Type your character's name", true) cname = guiCreateEdit(0.25, 0.2, 0.5, 0.15, "", true, wdwLogin) guiEditSetMaxLength(cname, 15) btnLogin = guiCreateButton(0.375, 0.7, 0.25, 0.2, "Save", true, wdwLogin) addEventHandler ( "onClientGUIClick", btnLogin, saveNick, false ) outputDebugString( "leves" ) end addCommandHandler("leves", createLoginWindow) function saveNick(button) if button == "left" then local nickname = guiGetText ( cname ) executeSQLQuery("INSERT INTO accounts(character) VALUES(?)", cname ) guiSetVisible(wdwLogin, false) destroyElement ( wdwLogin ) showCursor ( false ) end end
  6. thanks a lot, is works,i dont know why want i to do it that way...
  7. Hey, i'm new in gui scripting, so this is my first gui and i need some help. It should ask a name and save it to an SQL database and finally close de window, but it dont happen, so pls help me! function createLoginWindow(thePlayer) local X = 0.425 local Y = 0.425 local Width = 0.15 local Height = 0.15 showCursor(true, true) wdwLogin = guiCreateWindow(X, Y, Width, Height, "Choose your character's name", true) X = 0.25 Y = 0.2 Width = 0.5 Height = 0.15 cname = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(cname, 15) X = 0.375 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Save", true, wdwLogin) addEventHandler ( "onClientGUIClick", btnLogin, saveNick, false ) outputDebugString( "You got ".. cname .." hp.") -- just for debugging end addCommandHandler("leves", createLoginWindow) function saveNick(button) if button == "left" then local nickname = guiGetText ( cname ) outputDebugString( "You got ".. cname .." hp.") executeSQLQuery("CREATE TABLE IF NOT EXISTS players ( name TEXT)") executeSQLQuery("INSERT INTO players(name) VALUES(?)", cname ) guiSetVisible(wdwLogin, false) showCursor ( false ) end end
  8. because of it added i clientside: triggerClientEvent ( thePlayer, "savehp", getRootElement(),playerHealth) and i tried your idea, but it didnt work
  9. I'll like to save the player's health to SQL database, but i dont know how to do it. This is my script:(i'm new in lua scripting) Serverside: function callsavehp( thePlayer ) triggerClientEvent ( thePlayer, "gethp", getRootElement()) --outputChatBox(tostring(playerHealth)) end addCommandHandler("shp", callsavehp) function savehp(playerHealth) outputChatBox(tostring(playerHealth)) end addEvent("savehp", true) Clintside: function gethp() local playerHealth = getElementHealth ( getLocalPlayer() ) --return playerHealth outputChatBox(tostring(playerHealth)) outputChatBox("leves") triggerClientEvent ( thePlayer, "savehp", getRootElement(),playerHealth) end addEvent("gethp", true) I've never used triggering on the right way, I tried to forbore to use it but it is relevant now( i think leastwise)
×
×
  • Create New...