SA-MP Forums Archive
Help with returning after crash - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with returning after crash (/showthread.php?tid=115507)



Help with returning after crash - Jeka777 - 24.12.2009

I saw many servers have a "Return after Crash" system or something like that..
So like after you get a crash, you login and return to your last position.
Can someone please tell me how to do it ? PLEASE PLEASE


Re: Help with returning after crash - dice7 - 24.12.2009

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  if(reason == 0)
  {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    //write pos to file
    //set a variable in the file to 1 if the player crashed
  }
  return 1;
}

public OnPlayerConnect(playerid)
{
  if(the crash variable from the players file == 1)
  {
    SetPlayerPos(playerid, x, y, z); //the ones from the file
  }
  return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerDisconnect
https://sampwiki.blast.hk/wiki/OnPlayerConnect
https://sampwiki.blast.hk/wiki/File_Functions

You can also use (search) for dini instead of using the native file functions