Leaving message[Timeout bug] -
Problems - 18.07.2016
I use this code under onplayerdisconnect when the player leave/kicked/banned it shows the player's name,But when they timeout it doesn't show the player's name it just says [LEAVING] Has just left the server! (Timeout)
Код:
format(string,sizeof(string),"[LEAVING] %s Has just left the server! (%s)",pname,aDisconnectNames[reason]);
SendClientMessageToAll(COLOR_WHITE,string);
Re: Leaving message[Timeout bug] -
Dejan12345 - 18.07.2016
%S change with %d and try or try %sssssss
Respuesta: Leaving message[Timeout bug] -
Jpew - 18.07.2016
new pname[50];
GetPlayerName(playerid, pname, sizeof(pname));
format(string,sizeof(string),"[LEAVING] %s Has just left the server! (%s)",pname,aDisconnectNames[reason]);
SendClientMessageToAll(COLOR_WHITE,string);
Re: Leaving message[Timeout bug] -
Problems - 18.07.2016
%d for variables and %s is for strings like names,and it works when player Leave/kick/ban.
@Jpew ofc I'm using this and as I said it works when the player leave or is kicked
Respuesta: Leaving message[Timeout bug] -
Jpew - 18.07.2016
I understand now, i guess.. you want the timeout/crash reason?
Re: Leaving message[Timeout bug] -
Problems - 18.07.2016
No as I said it's uner OnPlayerDisconnected, like for example: [LEAVING] Jpew Has just left the server! (Leaving)
but when a player timeout it just show this: [LEAVING] Has just left the server! (Timeout)
without writing the player's name,Is that a problem with a plugin?
Respuesta: Leaving message[Timeout bug] -
Jpew - 18.07.2016
I don't know how you test the in-game message but work for me here
http://prntscr.com/buambl
uhm check this
http://prntscr.com/buamz3 https://sampwiki.blast.hk/wiki/OnPlayerDisconnect
Re: Leaving message[Timeout bug] -
Sew_Sumi - 18.07.2016
Quote:
Originally Posted by Problems
Is that a problem with a plugin?
|
No, It is a problem in your code.
PHP код:
new pName[MAX_PLAYER_NAME][MAX_PLAYERS];
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
PHP код:
GetPlayerName(playerid, pName[playerid], MAX_PLAYER_NAME);
to store it.
PHP код:
format(string,sizeof(string),"[LEAVING] %s Has just left the server! (%s)",pName[playerid],aDisconnectNames[reason]);
SendClientMessageToAll(COLOR_WHITE,string);
Quote:
Originally Posted by Jpew
I don't know how you test the in-game message but work for me here [/url]
|
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)