SA-MP Forums Archive
Spawn Help - 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 Help (/showthread.php?tid=443461)



Spawn Help - JamieVic - 12.06.2013

How do I make it so when the player logs in, they spawn back to where they logged off from?


Re: Spawn Help - IceBilizard - 12.06.2013

Save player x,y,z positions then load when player logged in

like
pawn Код:
SStats(playerid)
{
  new Float:cx,Float:cy,Float:cz,weap,ammo;
  new Float:x,Float:y,Float:z,Float:armour;
  GetPlayerPos(playerid, x, y, z);
  dini_IntSet(Pos(playerid),"X1",floatround(x));
  dini_IntSet(Pos(playerid),"Y1",floatround(y));
  dini_IntSet(Pos(playerid),"Z1",floatround(z));
  return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  SStats(playerid);
  return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
  SetSpawnInfo(playerid,0,dini_Int(Pos(playerid), "X1"),dini_Int(Pos(playerid), "Y1"),    dini_Int(Pos(playerid), "Z1"),0, 0, 0, 0, 0, 0, 0 );
  SpawnPlayer(playerid);
  return 1;
}



Re: Spawn Help - JamieVic - 12.06.2013

That didn't work probably because I'm using this gamemode script - https://sampforum.blast.hk/showthread.php?tid=279927

Thanks though