When a player disconnects...
#1

When a player disconnects,, sometimes, instead of saying that guys name says another's...
If i disconnect to others appears that someone else disconnected.

Here is the code i have at OnPlayerDisconnect.

pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
  new string[128];
  for(new i = 0; i <= MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
       switch(reason)
       {
            case 0: format(string, sizeof(string), "~w~%s ~b~has ~y~joined ~b~the server~w~ (~r~TIME-OUT~W~)",GetPlayerNameEx(i));
            case 1: format(string, sizeof(string), "~w~%s ~b~has ~y~joined ~b~the server~w~ (~r~LEAVING~W~)",GetPlayerNameEx(i));
            case 2: format(string, sizeof(string), "~w~%s ~b~has ~y~joined ~b~the server~w~ (~r~KICK~w~/~r~BAN~W~)",GetPlayerNameEx(i));
       }
         TextDrawSetString(Connect,string);
         TextDrawShowForAll(Text:Connect);
         SetTimer("SendConnectMessageStop",6000,0);
    }
  }
  return 1;
}
Here's the GetPlayerNameEx if needed:
pawn Код:
GetPlayerNameEx(playerid)
{
  new PlayerName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,PlayerName,MAX_PLAYER_NAME);
  for(new i=0; i <strlen(PlayerName); i++)
  {
    if(PlayerName[i]==']'){PlayerName[i]=')';}
    if(PlayerName[i]=='['){PlayerName[i]='(';}
    if(PlayerName[i]=='*'){PlayerName[i]=']';}
    }
  return PlayerName;
}
Help would be very appreciated.

Reply


Messages In This Thread
When a player disconnects... - by Zh3r0 - 02.04.2010, 11:57
Re: When a player disconnects... - by Ragidon - 02.04.2010, 12:04
Re: When a player disconnects... - by ZeRo_HUN - 02.04.2010, 12:05
Re: When a player disconnects... - by Zh3r0 - 02.04.2010, 12:08
Re: When a player disconnects... - by Carlton - 02.04.2010, 12:09
Re: When a player disconnects... - by Ragidon - 02.04.2010, 12:12
Re: When a player disconnects... - by Zh3r0 - 02.04.2010, 12:13
Re: When a player disconnects... - by Ragidon - 02.04.2010, 12:16
Re: When a player disconnects... - by Zh3r0 - 02.04.2010, 12:27
Re: When a player disconnects... - by Ragidon - 02.04.2010, 12:28

Forum Jump:


Users browsing this thread: 1 Guest(s)