02.11.2014, 01:58
I'm on the last bit until I open my community to the public, and I've noticed a slight bug when people leave. When it's only you and someone else on server. And they leave, it'll teleport you to a random spot *not far from where you recently were.
^ Forgot about it xD
Код:
public OnPlayerDisconnect(playerid, reason)
{
SetPlayerColor(playerid, 0xFFFFFFFF);
if(playerData[playerid][playerLoggedIn])
{
savePlayerStats(playerid);
}
if(reason == 1) // Manual game-quit.
{
new administratorAlert[128];
if(playerData[playerid][playerIsTazed])
{
format(administratorAlert, sizeof(administratorAlert), "{C73E3E}[AVOID-DETECTION] {FFFFFF}%s(%i) quit the game while tazed.", playerData[playerid][playerNamee], playerid);
adminchat(COLOR_WHITE, administratorAlert);
}
else if(playerData[playerid][playerIsCuffed])
{
format(administratorAlert, sizeof(administratorAlert), "{C73E3E}[AVOID-DETECTION] {FFFFFF}%s(%i) quit the game while cuffed.", playerData[playerid][playerNamee], playerid);
adminchat(COLOR_WHITE, administratorAlert);
}
else if(playerData[playerid][playerIsTied])
{
format(administratorAlert, sizeof(administratorAlert), "{C73E3E}[AVOID-DETECTION] {FFFFFF}%s(%i) quit the game while tied.", playerData[playerid][playerNamee], playerid);
adminchat(COLOR_WHITE, administratorAlert);
}
}
if(playerData[playerid][playerGangID] != INVALID_GANG_ID)
{
cmd_g(playerid, "leave");
}
ClearStats(playerid);
removePlayerRoadblocks(playerid);
destroyPlayersExplosives(playerid);
// Delete labels
Delete3DTextLabel(playerData[playerid][playerAdminLabel]);
// Destroy timers
KillTimer(playerData[playerid][unfreezeTimer]);
KillTimer(playerData[playerid][arrestTimer]);
KillTimer(playerData[playerid][untieTimer]);
KillTimer(playerData[playerid][uncuffTimer]);
KillTimer(playerData[playerid][recuffTimer]);
KillTimer(playerData[playerid][retazeTimer]);
KillTimer(playerData[playerid][fixTimer]);
KillTimer(playerData[playerid][nosTimer]);
KillTimer(playerData[playerid][mechREMPTimer]);
KillTimer(playerData[playerid][reactivateRapeStatus]);
KillTimer(playerData[playerid][reactivateRobStatus]);
KillTimer(playerData[playerid][hcpTimer]);
KillTimer(playerData[playerid][courierTimer]);
KillTimer(playerData[playerid][playerCanKidnap]);
KillTimer(playerData[playerid][rapedTimer]);
KillTimer(playerData[playerid][jailTimer]);
KillTimer(playerData[playerid][spawnPlayerTimer]);
KillTimer(playerData[playerid][truckExitTimer]);
KillTimer(playerData[playerid][breakCuffsTimer]);
KillTimer(playerData[playerid][achieveTimer]);
KillTimer(playerData[playerid][spamTimer]);
KillTimer(playerData[playerid][CheckSpeed]);
KillTimer(playerData[playerid][retruckTimer]);
KillTimer(playerData[playerid][saveStatsTimer]);
KillTimer(playerData[playerid][rehealTimer]);
KillTimer(playerData[playerid][recureTimer]);
KillTimer(playerData[playerid][breakinTimer]);
KillTimer(playerData[playerid][houseTimer]);
playerData[playerid][shotTime] = 0;
playerData[playerid][shot] = 0;
playerData[playerid][shotWarnings] = 0;
// Reset weapons for next player
ResetPlayerWeapons(playerid);
SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
// Vehicles
/*for(new v = 0; v < MAX_SCRIPT_VEHICLES; v++)
{
if (oVehicle[v][vehicle_id] != -1)
{
if(!strcmp(oVehicle[v][vehicle_owner], playerData[playerid][playerNamee], true))
{
DestroyVehicle(oVehicle[v][vehicle_sid]);
}
}
}*/
for(new i; i < MAX_SAVED_VEHICLES; i++)
{
if(VehicleInfo[i][vOwner] != playerData[playerid][actualID]) continue;
DestroyVehicle(VehicleInfo[i][vehicleID]);
VehicleInfo[i][vehicleID] = INVALID_VEHICLE_ID;
}
return 1;
}

