SA-MP Forums Archive
How to detect if player Crashed ? - 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: How to detect if player Crashed ? (/showthread.php?tid=83919)



How to detect if player Crashed ? - Zeromanster - 27.06.2009

Hello, I want to return players to their former position after they crashed.

Could you tell me wich functions would get handy in making this ?

I want them to return with exact health, exact weapons and ammo, and position before they crashed.

Thanks


Re: How to detect if player Crashed ? - dice7 - 27.06.2009

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
   switch(reason)
  {
    case 0: {/*Crashed/Timed - your code here*/ }
    case 1: {/*Left the server*/}
    case 2: {/*Was kicked*/}
  }



Re: How to detect if player Crashed ? - Andom - 27.06.2009

Quote:
Originally Posted by dice7
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  switch(reason)
  {
    case 0: {/*Crashed/Timed - your code here*/ }
    case 1: {/*Left the server*/}
    case 2: {/*Was kicked*/}
  }
Yes but he asked ''before'' crashing, what isn't posible.


Re: How to detect if player Crashed ? - Zeromanster - 27.06.2009

I don't get it, so like if it's reason 0 then he surely crashed or it's just our assumption ?


Re: How to detect if player Crashed ? - dice7 - 27.06.2009

He surely crashed. The SA-MP made it that way. You could save all of the players coords and stuff all the time (like in OnPlayerUpdate) in a temp and then on crash save them to a more permanent value. But that would cause lag if there would be 100-200 players on the server


Re: How to detect if player Crashed ? - Andom - 27.06.2009

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  if(reason == 2)
  {
    SendClientMessageToAll(COLOR_RED, "Player has crashed!");
  }
  return 1;
}
But that's almost the same as dice7 did


Re: How to detect if player Crashed ? - Zeromanster - 27.06.2009

Thank you dice7 and [NL]WackoX

Problem solved...