Jump to content

Spawn player.


maky55

Recommended Posts

Hello :P.

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 :P.

This is supposed to spawn the player at posX2, posY2, posZ2 (SF ariport) if their account is Terminator.

Link to comment

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 
  

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...