OnPlayerDisconnect isn't too large- only about 100 lines considering how I don't have anything fancy like a hitman or advisor system.
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
PlayersConnected--;
if(GetPVarInt(playerid, "SpeedGun") == 1) GivePlayerValidWeapon(playerid, GetPVarInt(playerid, "RadarGunPrevious"), 60000);
if(GetPVarInt(playerid, "HospitalSpawning") > 0)
{
PlayerInformation[playerid][HospitalSpawning] = 1;
}
if(control[playerid] == 1)
{
control[playerid] = 0;
KillTimer(ControlTimer[playerid]);
}
new string[128];
switch (reason)
{
case 0:
{
format(string, sizeof(string), "%s has timed out from the server.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2);
}
case 1:
{
format(string, sizeof(string), "%s has left the server.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2);
}
case 2:
{
format(string, sizeof(string), "%s was removed from the server.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2,COLOR_YELLOW2);
}
}
if(GetPVarInt(playerid, "gpsonoff") == 1) TextDrawDestroy(GPS[playerid]);
if(GetPVarInt(playerid, "fuelbar") == 1)
{
DestroyProgressBar(CarFuelBar[playerid]);
textdrawscount--;
}
gActivePlayers[playerid]--;
numplayers--;
PlayerUpdateStats(playerid);
UnloadPVehicles(playerid);
ResetPlayerWeapons(playerid);
if(PlayerBoxing[playerid] > 0)
{
if(Boxer1 == playerid)
{
if(IsPlayerConnected(Boxer1))
{
if(IsPlayerInRangeOfPoint(PlayerBoxing[Boxer2], 20.0, 768.94, -70.87, 1001.56))
{
PlayerBoxing[Boxer2] = 0;
SetPlayerPos(Boxer2, 768.48, -73.66, 1000.57);
SetPlayerInterior(Boxer2, 7);
GameTextForPlayer(Boxer2, "Opponent Disconnected", 6000, 1);
return 1;
}
PlayerBoxing[Boxer2] = 0;
SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
SetPlayerInterior(Boxer2, 5);
GameTextForPlayer(Boxer2, "Opponent Disconnected", 6000, 1);
}
}
else if(Boxer2 == playerid)
{
if(IsPlayerConnected(Boxer1))
{
if(IsPlayerInRangeOfPoint(PlayerBoxing[Boxer1],20.0,764.35, -66.48, 1001.56))
{
PlayerBoxing[Boxer1] = 0;
SetPlayerPos(Boxer1, 768.48, -73.66, 1000.57);
SetPlayerInterior(Boxer1, 7);
GameTextForPlayer(Boxer1, "Opponent Disconnected", 5000, 1);
return 1;
}
PlayerBoxing[Boxer1] = 0;
SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
SetPlayerInterior(Boxer1, 5);
GameTextForPlayer(Boxer1, "Opponent Disconnected", 5000, 1);
}
}
BoxerInsideRing = 0;
RoundStart = 0;
}
return 1;
}