Liberty Unleashed
Scripting => Scripting Discussion => Topic started by: xxxMDjxxx on October 10, 2011, 05:00:42 pm
-
How could i make a player always spawn at a certain coordinate?
Lets say there is a player with a name "testplayer123"
So when this player joins the server or dies, he will spawn at a certain coordinate?
Other players will spawn at default spawnpoints...
-
You can check the player name with player.Name;
So on spawn you could do this:
function onPlayerSpawn( player, spawn )
{
if ( player.Name == "testplayer123" ) player.Pos = Vector( x, y, z );
}
-
You can check the player name with player.Name;
So on spawn you could do this:
function onPlayerSpawn( player, spawn )
{
if ( player.Name == "testplayer123" ) player.Pos = Vector( x, y, z );
}
The code is not working...
function onPlayerSpawn( player, spawn )
if ( player.Name == "xXxMDjxXx" )
{
player.Pos = Vector( -812.2, 355.7, 51.32 );
return 1;
}
Have i done something wrong?
-
Err yes..
function onPlayerSpawn( player, spawn )
{
if ( player.Name.tolower() == "xxxmdjxxx" ) player.Pos = Vector( 0.0, 0.0, 0.0 );
return 1;
}
-
Err yes..
function onPlayerSpawn( player, spawn )
{
if ( player.Name.tolower() == "xxxmdjxxx" ) player.Pos = Vector( 0.0, 0.0, 0.0 );
return 1;
}
hmm, still not working, changed my name to xxxmdjxxx and still nothing.
-
Any errors from the server console?
-
no erors in the console...
-
If there are multiple instances of onPlayerSpawn, it likely won't work, so you might want to check that. Same with having onPlayerSpawn in multiple script files.