PlayerName in text does not work properly
#1

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s (ID %d) has lost the connection with the server.", PlayerName, playerid);
        case 1: format(string, sizeof(string), "%s (ID %d) has left the server.", PlayerName, playerid);
        case 2: format(string, sizeof(string), "%s (ID %d) has been kicked/banned form this server.", PlayerName, playerid);
    }
    SendClientMessageToAll(GREY, string);
    return 1;
}
I use that code, and it did work for a long time. But now, if someone disconnects, the PlayerName won't be showed. But, i use this same code in OnPlayerConnect, only without the cases, and that DOES work. So, what van be the problem?
Reply
#2

Do you have
pawn Код:
new string[size];
I don`t see it
Reply
#3

ow forgotten to place that here. But that isn't the problem. Size=128.
Reply
#4

Quote:
Originally Posted by Luka™
Do you have
pawn Код:
new string[size];
I don`t see it
It's obviously that he does, otherwise he wouldn't be able to compile the script but he did:
Quote:
Originally Posted by Remi-X
I use that code, and it did work for a long time. But now, if someone disconnects, the PlayerName won't be showed. But, i use this same code in OnPlayerConnect, only without the cases, and that DOES work. So, what van be the problem?
Reply
#5

Do you maybe have some FS ho have some code in OnPlayerDisconnect?
Reply
#6

nope.
Reply
#7

Try to debug or something
Reply
#8

Is that only code you have under OnPlayerDisconnect callback?
Reply
#9

@luka: wtf?

@don, yeah my own administration script that saves the stats from a player.
Reply
#10

Quote:
Originally Posted by Remi-X
@luka: wtf?
He meant: Add printf messages to see where the problem appears, like this:
pawn Код:
printf("DEBUG: bla bla bla");
Reply


Forum Jump:


Users browsing this thread: