Leaving message[Timeout bug]
#1

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);
Reply
#2

%S change with %d and try or try %sssssss
Reply
#3

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);
Reply
#4

%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
Reply
#5

I understand now, i guess.. you want the timeout/crash reason?
Reply
#6

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?
Reply
#7

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
Reply
#8

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(playeridpName[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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)