03.04.2014, 13:45
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
SeatBelt[playerid] = 0;
Smask[playerid] = 0;
TextDrawDestroy(JoinText[playerid]);
Delete3DTextLabel(MaskIDLab[playerid]);
new PlayerName[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(ServerInfo[ConnectMessages] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && playerid != i)
{
switch (reason)
{
case 0: format(str, sizeof(str), "[!] %s (%d) has left West Coast Life Roleplay. (Timeout)", PlayerName, playerid);
case 1: format(str, sizeof(str), "[!] %s (%d) has left West Coast Life Roleplay. (Leaving)", PlayerName, playerid);
case 2: format(str, sizeof(str), "[!] %s (%d) has left West Coast Life Roleplay. (Kicked/Banned)", PlayerName, playerid);
}
if(PlayerInfo[i][Level] > 1) SendClientMessage(i,grey,str);
else {
//format(string,sizeof(string),"[!] %s (%d) has joined West Coast Life Roleplay.", PlayerName, playerid);
//SendClientMessage(i,grey,string);
}
}
}
if(PlayerInfo[playerid][Jailed]==1){
new file[MAX_PLAYER_NAME+10], plaName[MAX_PLAYER_NAME];
GetPlayerName(playerid,plaName, sizeof(plaName));
format(file, sizeof(file), "%s.jail", plaName);
new File:jailfile = fopen(file, io_write);
new numstr[16];
format(numstr, sizeof(numstr), "%i", PlayerInfo[playerid][JailTime]);
fwrite(jailfile, numstr);
fclose(jailfile);
}
if(PlayerInfo[playerid][LoggedIn] == 1)
{
SavePlayer(playerid);
for(new i; i < 13; i++)
{
GivePlayerWeapon(playerid, --pSpawnWeapon[playerid][i], --pSpawnAmmo[playerid][i]);
}
}
if(udb_Exists(PlayerName2(playerid))) dUserSetINT(PlayerName2(playerid)).("LoggedIn",0);
PlayerInfo[playerid][LoggedIn] = 0;
PlayerInfo[playerid][Level] = 0;
PlayerInfo[playerid][Jailed] = 0;
PlayerInfo[playerid][Frozen] = 0;
if(PlayerInfo[playerid][Jailed] == 1) KillTimer( JailTimer[playerid] );
if(PlayerInfo[playerid][Frozen] == 1) KillTimer( FreezeTimer[playerid] );
if(ServerInfo[Locked] == 1) KillTimer( LockKickTimer[playerid] );
if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]);
#if defined ENABLE_SPEC
for(new x=0; x<MAX_PLAYERS; x++)
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
AdvanceSpectate(x);
#endif
return 1;
}