15.07.2011, 09:26
Here is it
public OnPlayerDisconnect(playerid, reason)
{
AdvertTimer[playerid] = 0;
new string[128];
new sendername[MAX_PLAYER_NAME];
new caller = Mobile[playerid];
gActivePlayers[playerid]--;
numplayers--;
PlayerInfo[playerid][pAdjustable] = 1;
if(HasPlantWeed[playerid] != 0) DestroyObject(Weed[playerid]);
DestroyPickup(BizPickupTemp[playerid]); Delete3DTextLabel(Text3D:Biz3dTextID[playerid]);
GetPlayerName(playerid, sendername, sizeof(sendername));
switch(reason)
{
case 0: format(string, sizeof(string), "* %s has left the server. (Timeout)", sendername);
case 1: format(string, sizeof(string), "* %s has left the server. (Leaving)", sendername);
case 2: format(string, sizeof(string), "* %s has left the server. (Kicked)", sendername);
}
if(PlayerInfo[playerid][pAdmin] < 2)
{
ProxDetector(30.0, playerid, string, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
}
if(PlayerTied[playerid] > 0 || PlayerCuffed[playerid] > 0 && PlayerInfo[playerid][pJailed] == 0)
{
PlayerInfo[playerid][pJailed] = 1; PlayerInfo[playerid][pJailTime] = 800;
}
OnPlayerSave(playerid);
new x = 0;
while(x != MAX_PLAYERS)
{
if(IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING && SpectatedID[x] == playerid)
{
SetPlayerHealth(x, PlayerInfo[x][pHealth]);
SetPlayerArmour(x, PlayerInfo[x][pArmor]);
SetPlayerVirtualWorld(x, PlayerInfo[x][pVirtualWorld]);
SetPlayerInterior(x, PlayerInfo[x][pInt]);
SetPlayerPos(x, PlayerInfo[x][pSPos_x], PlayerInfo[x][pSPos_y], PlayerInfo[x][pSPos_z]);
SetPlayerFacingAngle(x, PlayerInfo[x][pSPos_r]);
SendClientMessage(x, COLOR_WHITE, "You are no longer spectating.");
TogglePlayerSpectating(x, 0);
SpectatedID[x] = INVALID_PLAYER_ID;
SpectateType[x] = ADMIN_SPEC_TYPE_NONE;
HidePM[x] = 0;
PhoneOnline[x] = 0;
ResetPlayerAdminWeaponsEx(x);
}
x++;
}
public OnPlayerDisconnect(playerid, reason)
{
AdvertTimer[playerid] = 0;
new string[128];
new sendername[MAX_PLAYER_NAME];
new caller = Mobile[playerid];
gActivePlayers[playerid]--;
numplayers--;
PlayerInfo[playerid][pAdjustable] = 1;
if(HasPlantWeed[playerid] != 0) DestroyObject(Weed[playerid]);
DestroyPickup(BizPickupTemp[playerid]); Delete3DTextLabel(Text3D:Biz3dTextID[playerid]);
GetPlayerName(playerid, sendername, sizeof(sendername));
switch(reason)
{
case 0: format(string, sizeof(string), "* %s has left the server. (Timeout)", sendername);
case 1: format(string, sizeof(string), "* %s has left the server. (Leaving)", sendername);
case 2: format(string, sizeof(string), "* %s has left the server. (Kicked)", sendername);
}
if(PlayerInfo[playerid][pAdmin] < 2)
{
ProxDetector(30.0, playerid, string, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
}
if(PlayerTied[playerid] > 0 || PlayerCuffed[playerid] > 0 && PlayerInfo[playerid][pJailed] == 0)
{
PlayerInfo[playerid][pJailed] = 1; PlayerInfo[playerid][pJailTime] = 800;
}
OnPlayerSave(playerid);
new x = 0;
while(x != MAX_PLAYERS)
{
if(IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING && SpectatedID[x] == playerid)
{
SetPlayerHealth(x, PlayerInfo[x][pHealth]);
SetPlayerArmour(x, PlayerInfo[x][pArmor]);
SetPlayerVirtualWorld(x, PlayerInfo[x][pVirtualWorld]);
SetPlayerInterior(x, PlayerInfo[x][pInt]);
SetPlayerPos(x, PlayerInfo[x][pSPos_x], PlayerInfo[x][pSPos_y], PlayerInfo[x][pSPos_z]);
SetPlayerFacingAngle(x, PlayerInfo[x][pSPos_r]);
SendClientMessage(x, COLOR_WHITE, "You are no longer spectating.");
TogglePlayerSpectating(x, 0);
SpectatedID[x] = INVALID_PLAYER_ID;
SpectateType[x] = ADMIN_SPEC_TYPE_NONE;
HidePM[x] = 0;
PhoneOnline[x] = 0;
ResetPlayerAdminWeaponsEx(x);
}
x++;
}