SA-MP Forums Archive
Spawn Delay - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spawn Delay (/showthread.php?tid=613460)



Spawn Delay - Tass007 - 28.07.2016

Hi guys.
Whenever someone in my server spawns for like a second, they are spawned at the "AddPlayerClass" x,y,z position. However after that they spawn at their previous position. I was just wondering if there is a way to be able to not spawn at the "AddPlayerClass" position and just straight away go to the previous position. Here is my AddPlayerClass code, and OnPlayerSpawn code.

PHP код:
for(new 1!= 311i++) AddPlayerClass(i, -1968.9745,137.8568,27.6875,88.8534000000); // This is under ongamemodeinit 
PHP код:
public OnPlayerSpawn(playerid)
{
       
SetPlayerInterior(playerid,0);
    
SetPlayerColor(playerid,COLOR_PLAYER);
    
TextDrawShowForPlayer(playerid,txtTimeDisp);
    
TextDrawShowForPlayer(playeridurlText);
    
TextDrawShowForPlayer(playeridJoinText);
    
SetPlayerPos(playeridPlayerInfo[playerid][pXPos], PlayerInfo[playerid][pYPos], PlayerInfo[playerid][pZPos]);
    
SetPlayerFacingAngle(playeridPlayerInfo[playerid][pAPos]); //Sets the player position to his last position
    
for(new i=0i<MAX_PLAYERSi++){TextDrawShowForPlayer(iZones[i]);}
    return 
1;

Any idea's would be greatly appreciated. Thanks for your time.


Re: Spawn Delay - AndySedeyn - 28.07.2016

Use SetSpawnInfo before you spawn the player.


Re: Spawn Delay - Tass007 - 28.07.2016

SetSpawnInfo is used once the player has logged in.

EDIT. I made OnPlayerRequestSpawn(playerid) etc.. And put the SetSpawnInfo in there and it works like charm.