SlashBuster
Members-
Posts
18 -
Joined
-
Last visited
Everything posted by SlashBuster
-
getElementID (vehicle) how does this string knows which vehicle is meant
-
and is it only for the vehicle which was spawned in the smae function?
-
I have a script which stores a car in a mysql database when it spawns so that every car is related to a owner. But thats only in the database. How can I do the same in the game so that a vehicle has an id which I can ask for in a Lock script so that only that person who owned it can open it Thanks best greetings
-
It works so now I am finished and no it is not a mess because that's my scripting style that is logicly for me ^^
-
So now I'm quiet close to finish my login/ register script but 1 more problem is there the server is saying that there is an error in line 6 but I think it is right StartServer.lua:6: ')' expected near ',' function loginHandler(username,password) local = connect = dbConnect("mysql", "dbname=mta_userdata;host=127.0.0.1","root","klaas","share=1" ) if (connect,"SELECT (Name,Passwort) FROM `user` WHERE (Name = ?,Passwort = ?)", tostring ( username ), tostring ( password ) ) then spawnPlayer(source, 1959.55, -1714.46, 10) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Willkommen!", source) end else outputChatBox("Invalid username and password. Please re-connect and try again.",source) end end addEvent("submitLogin", true) addEventHandler("submitLogin",getRootElement(),loginHandler)
-
triggerServerEvent ( "submitRegister", getRootElement(), username, password, passwordConfirm ) yeah but i have it this way
-
tostring ( text ) I don't understand this string what is the text?
-
but what is the text? I
-
hmm these are the fields in the databank but I only want to know how I can wrote variables in the sql string
-
a login/register script
-
and the text comes from where? on client side I already have a script that takes the data that is post in the edit box to the server script function registerHandler(username,password) DB_connect = dbConnect("mysql", "dbname=mta_userdata;host=127.0.0.1","root","klaas","share=1") Register = dbExec(DB_connect,"INSERT INTO `user` (`idUser`, `Name`, `Passwort`) VALUES ('', 'Value', 'Value2')") end addEvent("submitRegister", true) addEventHandler("submitRegister",getRootElement(),registerHandler)
-
and whatfor is the "?"
-
Hi i have a problem How can I get for example the username and password that are from a editbox in the client script and put them as values in the dbExec command so that the text which is written in the box is postet into the database
-
BIG THANKS!!!!!!!!!!!!!!!!
-
but how i can get the regwindow visible with the button?
-
function createLoginWindow() Fenster = guiCreateWindow(421,138,675,486,"Login",false) LoginButton = guiCreateButton(72,404,159,58,"Login",false,Fenster) addEventHandler("onClientGUIClick", LoginButton, clientSubmitLogin, false) RegButton = guiCreateButton(285,404,159,58,"Registrieren",false,Fenster) Box1 = guiCreateEdit(33,90,208,31,"",false,Fenster) addEventHandler("onClientGUIClick", RegButton, clientNewGUI1, false) Box2 = guiCreateEdit(34,147,208,31,"",false,Fenster) Label1 = guiCreateLabel(42,72,111,15,"Benutzername:",false,Fenster) Label2 = guiCreateLabel(39,128,111,15,"Passwort:",false,Fenster) guiSetVisible(Fenster, false) end function createRegWindow() Reg_window = guiCreateWindow(364,178,689,440,"Registrieren!",false) Send_Button = guiCreateButton(34,371,161,52,"Abschicken!",false,Reg_window) Name_Feld = guiCreateEdit(27,60,168,28,"",false,Reg_window) Passwort_Feld = guiCreateEdit(26,113,168,28,"",false,Reg_window) Passwort2_Feld = guiCreateEdit(28,166,168,28,"",false,Reg_window) GUIEditor_Label[1] = guiCreateLabel(38,44,97,13,"Name:",false,Reg_window) GUIEditor_Label[2] = guiCreateLabel(35,149,124,16,"Passwort bestätigen",false,Reg_window) GUIEditor_Label[3] = guiCreateLabel(33,96,97,13,"Passwort:",false,Reg_window) GUIEditor_Image[1] = guiCreateStaticImage(337,80,341,280,"images/mtalogo.png",false,Reg_window) guiSetVisible(Reg_window, false) end function thisResourceStarts() createLoginWindow() outputChatBox("Willkommen!!!") if (Fenster ~= nil) then guiSetVisible(Fenster, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), thisResourceStarts) function clientSubmitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(Box1) local password = guiGetText(Box2) if username and password then if source == LoginButton then triggerServerEvent("submitLogin", getRootElement(), username, password) end guiSetInputEnabled(false) guiSetVisible(Fenster, false) showCursor(false) else outputChatBox("Bitte fülle die Felder aus!") end end end function clientNewGUI(button, state) if button == "left" and state == "up" then guiSetVisible(Fenster, false) end end
-
Hi I have a problem I am making a Login/register script the login works but now I want to make the Register. I want to use 2 GUIs (one for Login one for Register) On the Main Gui where the login is on I have a second button for Register. And now I want to use the button. I added an addEventHandler to the first GUI function. Then I did a function that handles the click to close the LoginGUI. That works but when I want to add a second action(start the Register GUI) it only executes the first command. How can I handle this?