Jump to content

spawnPlayer function issue


Solstice.

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...