Author Topic: Spawn point by player name?  (Read 1755 times)

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Spawn point by player name?
« on: October 10, 2011, 06: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...

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Spawn point by player name?
« Reply #1 on: October 10, 2011, 08:50:02 pm »
You can check the player name with player.Name;
So on spawn you could do this:
Code: [Select]
function onPlayerSpawn( player, spawn )
{
if ( player.Name == "testplayer123" ) player.Pos = Vector( x, y, z );
}

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Re: Spawn point by player name?
« Reply #2 on: October 15, 2011, 03:35:17 pm »
You can check the player name with player.Name;
So on spawn you could do this:
Code: [Select]
function onPlayerSpawn( player, spawn )
{
if ( player.Name == "testplayer123" ) player.Pos = Vector( x, y, z );
}


The code is not working...

Code: [Select]
function onPlayerSpawn( player, spawn )
 if ( player.Name == "xXxMDjxXx" )
 {
  player.Pos = Vector( -812.2, 355.7, 51.32 );
  return 1;
 }

Have i done something wrong?

Force

  • Developer
  • Full Member
  • *****
  • Posts: 204
  • Karma: +6/-2
    • View Profile
Re: Spawn point by player name?
« Reply #3 on: October 15, 2011, 05:31:49 pm »
Err yes..

Code: [Select]
function onPlayerSpawn( player, spawn )
{
if ( player.Name.tolower() == "xxxmdjxxx" ) player.Pos = Vector( 0.0, 0.0, 0.0 );
return 1;
}
Quote
[Tue - 20:09:35] <&VRocker> CRAP!
[Tue - 20:09:43] <&VRocker> i think i just followed through...
Quote
[Sat - 22:11:56] <~Smapy> [R3V]breSt12 killed [R3V]Jack_Bauer. (Splat)

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Re: Spawn point by player name?
« Reply #4 on: October 15, 2011, 07:58:33 pm »
Err yes..

Code: [Select]
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.

Force

  • Developer
  • Full Member
  • *****
  • Posts: 204
  • Karma: +6/-2
    • View Profile
Re: Spawn point by player name?
« Reply #5 on: October 15, 2011, 08:01:06 pm »
Any errors from the server console?
Quote
[Tue - 20:09:35] <&VRocker> CRAP!
[Tue - 20:09:43] <&VRocker> i think i just followed through...
Quote
[Sat - 22:11:56] <~Smapy> [R3V]breSt12 killed [R3V]Jack_Bauer. (Splat)

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Re: Spawn point by player name?
« Reply #6 on: October 16, 2011, 10:10:03 am »
no erors in the console...

stormeus

  • No-Lifer
  • Developer
  • Full Member
  • *****
  • Posts: 112
  • Karma: +13/-2
    • View Profile
Re: Spawn point by player name?
« Reply #7 on: October 16, 2011, 06:34:28 pm »
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.
Quote
Morphine says:
    them LU devs ranting about how LU doesn't have client pickups
    while us VC:MPers don't have client anything
    ;_;

Stormeus Argo says:
    we have client crashes though
    ohohohohoho

Morphine says:
    LU DOESN'T HAVE THAT

Stormeus Argo says:
    LU - 0
    VC:MP - 1

 

© Liberty Unleashed Team.