-
Posts
4,961 -
Joined
-
Last visited
Everything posted by Jaysds1
-
thanks Now I need help with the spawn part.
-
ok here: logOut( source ) -- Log them out.
-
it say's [2011-06-11 18:56:14] WARNING: JS\server.lua:173: Bad 'player' pointer @ 'logOut'(1)
-
I need help with a Spawn/Logout GUI, When the person presses the spawn button it's suppose to spawn them but it doesn't , and when the person presses the logout button it's suppose to log them out but it doesn't here is my script Client-side: function spawn() CreateSpawn() -- if the GUI was successfully created, then show the GUI to the player if (swnwdw ~= nil) then guiSetVisible(swnwdw, true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- now add our onClientGUIClick event to the button we just created addEventHandler("onClientGUIClick",GUIEditor_Button[1], spawnHere, false) addEventHandler("onClientGUIClick",GUIEditor_Button[2], logOut,false) end addEvent("spawn",true) addEventHandler("spawn", getRootElement(), spawn) function logOut(button) if (button == "left") then triggerServerEvent("logOut", getRootElement()) end end function spawnHere(button) if (button == "left") then triggerServerEvent("spawnHere", getRootElement()) end end Server-side: function logOut() local source = getPlayerAccount (client) logOut( source ) -- Log them out. end addEvent("logOut",true) addEventHandler("logOut", getRootElement(), logOut) function spawnHere() spawnPlayer (source, x, y, z, 0, math.random (1,288), 0, 0) end addEvent("spawnHere",true)
-
nevermind I found the problem, I just needed to add the button in the function, here: function Nick() if (button == "left") then local nickName = guiGetText(GUIEditor_Edit[3]) if nickName ~= '' then triggerServerEvent ("changeNick", getRootElement(), nickName) else outputChatBox ("Please enter a NICKNAME.") end end end NOW: function Nick(button) if (button == "left") then local nickName = guiGetText(GUIEditor_Edit[3]) if nickName ~= '' then triggerServerEvent ("changeNick", getRootElement(), nickName) else outputChatBox ("Please enter a NICKNAME.") end end end Thanks anyway.
-
I just copy and pasted 1 time plus you told me at the top to copy it, and where else did I copy and paste? AND IT STILL DOESN'T WORK!
-
It's the function for the GUI window. Client-side: --THE GUI----------------- function nickName() GUIEditor_Window[3] = guiCreateWindow(191,297,425,153,"Nickname",false) -- Buttons change_but = guiCreateButton(38,106,137,38,"CHANGE",false,GUIEditor_Window[3]) leave_but = guiCreateButton(265,107,122,37,"LEAVE",false,GUIEditor_Window[3]) -- Edit GUIEditor_Edit[3] = guiCreateEdit(93,60,262,31,"",false,GUIEditor_Window[3]) -- LABEL guiCreateLabel(38,32,373,22,"Please enter your nickname and press CHANGE or press LEAVE",false,GUIEditor_Window[3]) end --SCRIPT------ function afterLogin() nickName() if (GUIEditor_Window[3] ~= nil) then guiSetVisible(GUIEditor_Window[3], true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) -- now add our onClientGUIClick event to the button we just created addEventHandler("onClientGUIClick",change_but, changeNick, false) addEventHandler("onClientGUIClick",leave_but, DONE, false) end addEvent ( "after",true) addEventHandler ( "after", getRootElement(), afterLogin) function changeNick() if (button == "left") then local nickname = guiGetText(GUIEditor_Edit[3]) if nickname ~= '' then triggerServerEvent ("changeNick", getRootElement(), nickname) else outputChatBox ("Please enter a NICKNAME.") cancelEvent() end end end Server-side function Nickname(nickName) if (nickname ~= nil and nickname ~= "") then setPlayerName( client, nickname) outputChatBox ( "YOU HAVE CHANGED YOUR NICKNAME!", client, 0, 255, 0) triggerClientEvent(thePlayerToTriggerFot, 'event', getRootElement()) triggerClientEvent ( "Done", getRootElement()) else outputChatBox ( "Sorry something is wrong, Please try again later!.",client) cancelEvent() end end addEvent ( "changeNick",true) addEventHandler ( "changeNick", getRootElement(), Nickname)
-
it still doesn't work though After when I put in the Nickname I want and press the button to change it, nothing happens. Do you want me to post my whole Login GUI script?
-
It's still not working, when I press Change the GUI is still open and My Nick/Name doesn't change. here is my script: Client-side function afterLogin() nickName() if (GUIEditor_Window[3] ~= nil) then guiSetVisible(GUIEditor_Window[3], true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) -- now add our onClientGUIClick event to the button we just created addEventHandler("onClientGUIClick",change_but, changeNick, false) addEventHandler("onClientGUIClick",leave_but, DONE, false) end addEvent ( "after",true) addEventHandler ( "after", getRootElement(), afterLogin) function changeNick() if (button == "left") then local nickname = guiGetText(GUIEditor_Edit[3]) if nickName then triggerServerEvent ("changeNick", getRootElement(), nickname) else outputChatBox ("Please enter a NICKNAME.") cancelEvent() end end end Server-side function Nickname() setPlayerName( client, nickName) outputChatBox ( "YOUR HAVE CHANGED YOUR NICKNAME!", client, 0, 255, 0) triggerClientEvent ( "Done", getRootElement()) end addEvent ( "changeNick",true) addEventHandler ( "changeNick", getRootElement(), Nickname) then it goes back to the Client-side: function DONE() -- hide the gui, hide the cursor and return control to the player guiSetVisible(GUIEditor_Window[2], false) guiSetVisible(GUIEditor_Window[1], false) guiSetVisible(GUIEditor_Window[3], false) --guiSetVisible(back_Ground, false) showCursor(false) guiSetInputEnabled(false) --triggerServerEvent ( "onPlayer", getRootelement()) end addEvent("Done",true) addEventHandler("Done", getRootElement(), DONE)
-
Actually it's .
-
I just remember I did the same thing with the Login GUI thanks.
-
i tried and it did not worked. Plus, How can i get the text if it's client-side and the setPlayerName is Sever-side?
-
Is there anyway the setPlayerName can get a person's nickname from a GUI?
-
Fine sorry, Does anyone know why when I login, the screen is blank? Here is my script: Client function DONE() -- hide the gui, hide the cursor and return control to the player guiSetVisible(GUIEditor_Window[2], false) guiSetVisible(GUIEditor_Window[1], false) guiSetVisible(back_Ground, false) showCursor(false) guiSetInputEnabled(false) triggerServerEvent ( "onPlayer", getRootelement()) end addEvent("Done",true) addEventHandler("Done", getRootElement(), DONE) Server function finish() spawnPlayer (source, x, y, z, 0, math.random (1,288), 0, 0, teamF) -- spawns player with random skin fadeCamera(source, true) setCameraTarget(source, source) end addEvent ( "onPlayer",true) addEventHandler ( "onPlayer", getRootElement(), finish)
-
I want to know How to create a update gui (I ALREADY GOT THE GUI)?
-
You have to create the Window in a different function. In the script, when a player enters the marker and the window opens, is there suppose to be a button?
-
I actuallyt edited it
-
Do you have the car original place?
-
I did that, but when I stop my server and start it again it shows MTA:SA.
-
Does anyone know why, when I start my server it shows that the Game is MTA:SA, can I change it to Freeroam so when it starts it shows it, not MTA:SA?
-
OK, you see, THAT WASN'T HARD NOW I LEARNED, THANKS!!!
-
BUT IN THE THE WIKI, IT DOESN'T SHOW THE INTERIOR marker createMarker ( float x, float y, float z, [string theType, float size, int r, int g, int b, int a, visibleTo = getRootElement()] )