SA-MP Forums Archive
Spawn at zero coordinates - 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 at zero coordinates (/showthread.php?tid=652856)



Spawn at zero coordinates - Kireykin - 20.04.2018

Good day.
Can you please tell us how to make sure that when the first spawner appeared on the general spawn, and on the next spawned there, where was the last time.
PHP код:
stock SetPos(playerid)
{
SetPlayerPos(playerid,pInfo[playerid][Pos][0],pInfo[playerid][Pos][1],pInfo[playerid][Pos][2]);
return 
1;
}
public 
OnPlayerSpawn(playerid)
{
new 
RandomGS random(sizeof(gRandomSkin));
SetPlayerSkin(playerid,gRandomSkin[RandomGS]);
SetPos(playerid);
}
stock SavePos(playerid)
{
    new 
Float:PosX;
    new 
Float:PosY;
    new 
Float:PosZ;
    
GetPlayerPos(playerid,PosX,PosY,PosZ);
    
pInfo[playerid][Pos][0] = PosX;
    
pInfo[playerid][Pos][1] = PosY;
    
pInfo[playerid][Pos][2] = PosZ;
    return 
true;




Re: Spawn at zero coordinates - Kireykin - 20.04.2018

Thanks for the help.
I want to do this:
The first spawn of the player: the player appears at certain coordinates.
The second and other spawns of the player: the player appears on coordinates from the database.
The problem is that at the first appearance, the player appears in zero coordinates.


Re: Spawn at zero coordinates - jasperschellekens - 20.04.2018

Quote:
Originally Posted by Kireykin
Посмотреть сообщение
Thanks for the help.
I want to do this:
The first spawn of the player: the player appears at certain coordinates.
The second and other spawns of the player: the player appears on coordinates from the database.
The problem is that at the first appearance, the player appears in zero coordinates.
To archieve this you could do something like:

PHP код:
New SpawnedPlayers 0;
switch(
SpawnedPlayers
{
  case 
0
  {
  
// first spawn
  
}
  case 
1
  {
  
// second spawn
  
}

SpawnedPlayers++;