Код:
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(tempotd[playerid]);
new caller = Mobile[playerid];
OnPlayerSave(playerid);
new nome[24], str[50];
GetPlayerName(playerid, nome, 24);
format(str, sizeof str, "%s - Arara", nome);
dini_BoolSet("Araras.ini", str, Infoa[playerid][Arara]);
format(str, sizeof str, "%s - Racao", nome);
dini_BoolSet("Araras.ini", str, Infoa[playerid][Racao]);
format(str, sizeof str, "%s - Grande", nome);
dini_IntSet("Araras.ini", str, Infoa[playerid][Grande]);
if(caller != 255)
{
if(caller < 255)
{
SendClientMessage(caller, COLOR_GRAD2, "A ligaзгo caiu...");
CellTime[caller] = 0;
CellTime[playerid] = 0;
Mobile[caller] = 255;
}
Mobile[playerid] = 255;
CellTime[playerid] = 0;
}
if(HireCar[playerid] > 0)
{
VTrancado[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
SetVehicleToRespawn(HireCar[playerid]);
HireCar[playerid] = 0;
}
if (PlayerInfo[playerid][pBarraca] != 0)
{
RemoveBarraca(playerid);
}
if (PlayerInfo[playerid][pParedao] != 0)
{
RemoveParedao(playerid);
}
if(pRoadblock[playerid] != 0)
{
RemoveRoadblock(playerid);
}
if(SpikeInfo[playerid][sCreated] != 0)
{
RemoveRoadPregos(playerid);
}
if(pRoadCones[playerid] != 0)
{
RemoveRoadCones(playerid);
}
if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] != 3000)
{
/*format(gstring, sizeof(gstring), "~p~%s: ~r~~h~OFF", PlayerName(playerid));
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GameTextForPlayer(i, gstring , 1000, 1);
}
}*/
ContarAdmin --;
}
if(InfoVinny[playerid][NumSenha] != 999)
{
InfoVinny[playerid][NumSenha] = 999;
SenhasAtendimento --;
}
switch(reason)
{
case 0: format(gstring, sizeof(gstring), "%s saiu do server por perda de conexгo ou crash.", PlayerName(playerid));
case 1: format(gstring, sizeof(gstring), "%s saiu por vontade propria.", PlayerName(playerid));
case 2: format(gstring, sizeof(gstring), "%s Saiu do servidor kickado ou banido.", PlayerName(playerid));
}
ProxDetector(100.0, playerid, gstring,0xFFBB77AA,0xFFBB77AA,0xFFBB77AA,0xFFBB77AA,0xFFBB77AA);
gActivePlayers[playerid]--;
numplayers--;
if(MudarNickAceito[playerid] == 1)
{
MudarNickAceito[playerid] = 0;
}
if(ProvocoCasarao[playerid] == 1)
{
GangZoneStopFlashForAll(GZCasarao);
GangZoneShowForAll(GZCasarao, 0xFFFFFF96);
GuerranoCasarao = 0;
ProvocoCasarao[playerid] = 0;
donocasarao = 0;
Dominando[playerid] = 0;
KillTimer(TempoGuerraCasarao);
}
if(ProvocoEstacao[playerid] == 1)
{
GangZoneStopFlashForAll(GZEstacao);
GangZoneShowForAll(GZEstacao, 0xFFFFFF96);
GuerranaEstacao = 0;
ProvocoEstacao[playerid] = 0;
donoestacao = 0;
Dominando[playerid] = 0;
KillTimer(TempoGuerraEstacao);
}
if(ProvocoCemiterio[playerid] == 1)
{
GangZoneStopFlashForAll(GZCemiterio);
GangZoneShowForAll(GZCemiterio, 0xFFFFFF96);
GuerranoCemiterio = 0;
ProvocoCemiterio[playerid] = 0;
donoCemiterio = 0;
Dominando[playerid] = 0;
KillTimer(TempoGuerraCemiterio);
}
if(ProvocoShop[playerid] == 1)
{
GangZoneStopFlashForAll(GZShop);
GangZoneShowForAll(GZShop, 0xFFFFFF96);
GuerranoShop = 0;
ProvocoShop[playerid] = 0;
donoShop = 0;
Dominando[playerid] = 0;
KillTimer(TempoGuerraShop);
}
if(ProvocoPark[playerid] == 1)
{
GangZoneStopFlashForAll(GZPark);
GangZoneShowForAll(GZPark, 0xFFFFFF96);
GuerranoPark = 0;
ProvocoPark[playerid] = 0;
donoPark = 0;
Dominando[playerid] = 0;
KillTimer(TempoGuerraPark);
}
if(ProvocoSkate[playerid] == 1)
{
GangZoneStopFlashForAll(GZSkate);
GangZoneShowForAll(GZSkate, 0xFFFFFF96);
GuerranoSkate = 0;
ProvocoSkate[playerid] = 0;
donoskate = 0;
Dominando[playerid] = 0;
KillTimer(TempoGuerraSkate);
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(TaxiAccepted[i] < 999)
{
if(TaxiAccepted[i] == playerid)
{
TaxiAccepted[i] = 999;
GameTextForPlayer(i, "~w~O Cliente~n~~r~Saiu do jogo", 5000, 1);
TaxiCallTime[i] = 0;
DisablePlayerCheckpoint(i);
}
}
else if(CopsrondaAccepted[i] < 999)
{
if(CopsrondaAccepted[i] == playerid)
{
CopsrondaAccepted[i] = 999;
GameTextForPlayer(i, "~w~Policial o player~n~~r~Deixou o jogo", 5000, 1);
CopsrondaCallTime[i] = 0;
DisablePlayerCheckpoint(i);
}
}
else if(MedicAccepted[i] < 999)
{
if(MedicAccepted[i] == playerid)
{
MedicAccepted[i] = 999;
GameTextForPlayer(i, "~w~O Cliente~n~~r~Saiu do jogo", 5000, 1);
MedicCallTime[i] = 0;
DisablePlayerCheckpoint(i);
}
}
else if(MechanicAccepted[i] < 999)
{
if(MechanicAccepted[i] == playerid)
{
MechanicAccepted[i] = 999;
GameTextForPlayer(i, "~w~O Cliente~n~~r~Saiu do jogo", 5000, 1);
MechanicCallTime[i] = 0;
DisablePlayerCheckpoint(i);
}
}
else if(BusAccepted[i] < 999)
{
if(BusAccepted[i] == playerid)
{
BusAccepted[i] = 999;
GameTextForPlayer(i, "~w~O Cliente~n~~r~Saiu do jogo", 5000, 1);
BusCallTime[i] = 0;
DisablePlayerCheckpoint(i);
}
}
}
}