maky55 Posted April 5, 2015 Posted April 5, 2015 Hello . I'm wondering whats wrong with this section of the script I have: local posX2, posY2, posZ2 = -1370.1851806641, -205.50845336914, 6 function joinHandler2() local account = getPlayerAccount(source) if account("Terminator") then spawnPlayer(source, posX2, posY2, posZ2) fadeCamera(source, true) setCameraTarget(source, source) end addEventHandler("onPlayerWasted", getRootElement(), joinHandler2) end I suspect i've got this line wrong: if account("Terminator") then I've tried many different ways of using this but I'm too newb . This is supposed to spawn the player at posX2, posY2, posZ2 (SF ariport) if their account is Terminator.
novo Posted April 5, 2015 Posted April 5, 2015 getPlayerAccount returns the player's account object, or false if the player passed to the function is invalid. And as I guess you want to check if player's account name is equal to Terminator, you should retrieve it by using getAccountName. And thus comparing the returned string; local account = getPlayerAccount(source) local accountName = getAccountName(account) if accountName == "Terminator" then -- exactly equal to
maky55 Posted April 5, 2015 Author Posted April 5, 2015 Thank you! I didn't know == meant exactly equal to! Thanks again.
novo Posted April 5, 2015 Posted April 5, 2015 You're welcome, make sure to check this out if you wish learning more about relational operators.
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