SA-MP Forums Archive
PlayerName in text does not work properly - 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: PlayerName in text does not work properly (/showthread.php?tid=82376)



PlayerName in text does not work properly - Remi-X - 17.06.2009

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?


Re: PlayerName in text does not work properly - Luka P. - 17.06.2009

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


Re: PlayerName in text does not work properly - Remi-X - 17.06.2009

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


Re: PlayerName in text does not work properly - Correlli - 17.06.2009

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?



Re: PlayerName in text does not work properly - Luka P. - 17.06.2009

Do you maybe have some FS ho have some code in OnPlayerDisconnect?


Re: PlayerName in text does not work properly - Remi-X - 17.06.2009

nope.


Re: PlayerName in text does not work properly - Luka P. - 17.06.2009

Try to debug or something


Re: PlayerName in text does not work properly - Correlli - 17.06.2009

Is that only code you have under OnPlayerDisconnect callback?


Re: PlayerName in text does not work properly - Remi-X - 17.06.2009

@luka: wtf?

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


Re: PlayerName in text does not work properly - Correlli - 17.06.2009

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");