when a player crashes +reps!
#1

hi,

right now i dont have the opportunity to test it myself so i hope someone can tell me out of mind.
Is the callback OnPlayerDisconnect executed successfully for a player that crashes?
(I know its not called when the server crashes).
But is it called when only a certain player crashes (loses his connection)?

thx in advance.
Reply
#2

bump.
Reply
#3

Yes, OnPlayerDisconnect gets called even if player crashes.
Reply
#4

yes it is
Reply
#5

Yes it does. And its also has the oppertunity to make a message for it why he left like this:
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
    }
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}
Source: https://sampwiki.blast.hk/wiki/Creating_...Leave_Messages
Reply
#6

There is also a possibilty to show this, which means that OnPlayerDisconnect HAS to get called! Example:

PHP Code:
        new pname[MAX_PLAYER_NAME], string[39 MAX_PLAYER_NAME];
        
GetPlayerName(playeridpnamesizeof(pname));
        switch(
reason)
        {
            case 
0format(stringsizeof(string), "%s has left the server. (Lost Connection)"pname);
            case 
1format(stringsizeof(string), "%s has left the server. (Leaving)"pname);
            case 
2format(stringsizeof(string), "%s has been kicked by an administrator. (Kicked)"pname);
        }
        
SendClientMessageToAll(0xAAAAAAAAstring); 
EDIT: OMG, he was faster!!!
Reply
#7

so the players data is saved even if a player crashes right?
(if there is a saving system under OnPlayerDisconnect ofc)

thx, all +rep
Reply
#8

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)