Jump to content

getPlayerFromNick halfway working


Recommended Posts

hello everyone. i have a problem with one of my scripts that doesnt seem to make any sense. i am trying to make the script recognize a player joining and a player leaving. so, basically to be concise, here is what ive done

mop = getPlayerFromNick ( "MasterOfPuppets" ) 
function spawnInHouse ( thePlayer ) 
bla bla bla 
end 
addEventHandler ( "onPlayerJoin", mop, spawnInHouse ) 

however, nothing happens. what is the problem is anbody knows? and how do i fix it. your help is appreciated.

Link to comment

hello everyone. i have a problem with one of my scripts that doesnt seem to make any sense. i am trying to make the script recognize a player joining and a player leaving. so, basically to be concise, here is what ive done

mop = getPlayerFromNick ( "MasterOfPuppets" )function spawnInHouse ( thePlayer )bla bla blaendaddEventHandler ( "onPlayerJoin", mop, spawnInHouse )

however, nothing happens. what is the problem is anbody knows? and how do i fix it. your help is appreciated.

Link to comment

in your script getPlayerFromNick is called when the resource is loaded not when the player joins, try something like:

function spawnInHouse ( thePlayer ) 
if getPlayerName ( source ) = "MasterOfPuppets" then 
bla bla bla 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), spawnInHouse ) 

Link to comment

in your script getPlayerFromNick is called when the resource is loaded not when the player joins, try something like:

function spawnInHouse ( thePlayer )if getPlayerName ( source ) = "MasterOfPuppets" thenbla bla blaendaddEventHandler ( "onPlayerJoin", getRootElement(), spawnInHouse )

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