How to detect if player Crashed ?
#1

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
Reply
#2

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

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.
Reply
#4

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

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
Reply
#6

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
Reply
#7

Thank you dice7 and [NL]WackoX

Problem solved...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)