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 i = 1; i != 311; i++) AddPlayerClass(i, -1968.9745,137.8568,27.6875,88.8534, 0, 0, 0, 0, 0, 0); // This is under ongamemodeinit
PHP код:
public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,0);
SetPlayerColor(playerid,COLOR_PLAYER);
TextDrawShowForPlayer(playerid,txtTimeDisp);
TextDrawShowForPlayer(playerid, urlText);
TextDrawShowForPlayer(playerid, JoinText);
SetPlayerPos(playerid, PlayerInfo[playerid][pXPos], PlayerInfo[playerid][pYPos], PlayerInfo[playerid][pZPos]);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pAPos]); //Sets the player position to his last position
for(new i=0; i<MAX_PLAYERS; i++){TextDrawShowForPlayer(i, Zones[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.