18.07.2016, 09:56
No, It is a problem in your code.
When they disconnect there is nothing for the server to GetPlayerName off, that's why when it runs that function it comes back as nothing.
When you call the disconnect instead of using GetPlayerName use pName[playerid]. When they connect use
to store it.
Your code is untested, and errored. You define a string that is 50, when max name is 24.
The code, even if it does work, will only work for one. No use of arrays at all.
%d = Decimal
%f = Float
%s = String
They are not switchable, and you cannot mix them.
In this case, it's plain and simple, for %s to be the way forward (Just to those who have been guessing)
PHP код:
new pName[MAX_PLAYER_NAME][MAX_PLAYERS];
When you call the disconnect instead of using GetPlayerName use pName[playerid]. When they connect use
PHP код:
GetPlayerName(playerid, pName[playerid], MAX_PLAYER_NAME);
PHP код:
format(string,sizeof(string),"[LEAVING] %s Has just left the server! (%s)",pName[playerid],aDisconnectNames[reason]);
SendClientMessageToAll(COLOR_WHITE,string);
Quote:
I don't know how you test the in-game message but work for me here [/url]
|
The code, even if it does work, will only work for one. No use of arrays at all.
%d = Decimal
%f = Float
%s = String
They are not switchable, and you cannot mix them.
In this case, it's plain and simple, for %s to be the way forward (Just to those who have been guessing)