Solstice. Posted December 14, 2012 Share Posted December 14, 2012 So I'm basically working on a log-in screen from scratch and got stuck at spawning the player after getting the username and password etc. checked with MySQL. The problem is when I trigger the submitlogin function the text as defined to be output in the chatbox appears although the player refuses to spawn with the camera shifting to it. What am I doing wrong in this? The issue lies with the spawnPlayer and setCameraTarget line. Script editor doesn't provide me any error lines. function submitlogin () if source == login_button then outputChatBox ( "HELLO") spawnPlayer (localPlayer, 2143.7648925781, 2132.8686523438, 10.671875, 0, 0, 1) setCameraTarget (localPlayer) end end addEventHandler ( "onClientGUIClick", getRootElement(), submitlogin, true) Link to comment
Castillo Posted December 14, 2012 Share Posted December 14, 2012 spawnPlayer is a server side-only function, you must use: triggerServerEvent to trigger a server event, then spawn him server side. Link to comment
manve1 Posted December 14, 2012 Share Posted December 14, 2012 Wouldn't setElementPosition do the same thing? Link to comment
Castillo Posted December 14, 2012 Share Posted December 14, 2012 No, is not the same thing. Link to comment
myonlake Posted December 15, 2012 Share Posted December 15, 2012 Also, I suggest putting the last argument of the onClientGUIClick event to 'false' instead of 'true'. If it's true, it will basically check for any click actions taken towards the whole window elements. Putting it to 'false' will only trigger your function from the element you defined. Link to comment
Solstice. Posted December 15, 2012 Author Share Posted December 15, 2012 spawnPlayer is a server side-only function, you must use: triggerServerEvent to trigger a server event, then spawn him server side.Thank you! Hadn't thought of that yet. It seems to work. Much appreciated! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now