Код:
// Timer Name: EMSUpdate()
// TickRate: 5 secs.
Timer:EMSUpdate[5000]()
{
foreach(Player, i)
{
new Float:posX, Float:posY, Float:posZ;
GetPlayerPos(i, posX, posY, posZ);
if(GetPlayerInterior(i) == 0 && !IsPlayerInAnyVehicle(i) && MP3Station[i] == 0)
{
StopAudioStreamForPlayer(i);
}
new Float:iArmor;
GetPlayerArmour(i, iArmor);
if(iArmor > ValidArmor[i] && AdminDuty[i] == 0)
{
new string[128];
format(string, sizeof(string), "%s may have hacked their armor.", GetPlayerNameEx(i));
AddAutomatedFlag(i, string);
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may possibly be armor hacking.", GetPlayerNameEx(i), i);
ABroadCast(COLOR_YELLOW, string, 2);
}
if(GetPVarType(i, "Injured"))
{
if(GetPVarInt(i, "EMSAttempt") != 0)
{
new Float:health;
GetPlayerHealth(i,health);
SetPlayerHealth(i, health-1);
if(GetPVarInt(i, "EMSAttempt") == -1)
{
if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
{
SendClientMessage(i, COLOR_WHITE, "You fell unconscious, you were immediately sent to the hospital.");
KillEMSQueue(i);
SpawnPlayer(i);
}
GameTextForPlayer(i, "~r~Injured~n~~w~/accept death or /service ems", 5000, 3);
}
if(GetPVarInt(i, "EMSAttempt") == 1)
{
if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
{
SendClientMessage(i, COLOR_WHITE, "You fell unconscious, you were immediately sent to the hospital.");
KillEMSQueue(i);
SpawnPlayer(i);
}
GameTextForPlayer(i, "~r~Injured~n~~w~Waiting for EMS to Arrive...", 5000, 3);
}
if(GetPVarInt(i, "EMSAttempt") == 2)
{
if(!IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")))
{
SendClientMessage(i, COLOR_WHITE, "You fell unconscious, you were immediately sent to the hospital.");
KillEMSQueue(i);
SpawnPlayer(i);
}
GameTextForPlayer(i, "~g~Rescued~n~~w~Awaiting Treatment...", 5000, 3);
}
if(GetPVarInt(i, "EMSAttempt") == 3)
{
if(IsPlayerInAnyVehicle(i))
{
new ambmodel = GetPlayerVehicleID(i);
if(IsAnAmbulance(ambmodel))
{
GameTextForPlayer(i, "~g~Rescued~n~~w~Waiting for EMS to take to Hospital...", 5000, 3);
}
else
{
SendClientMessage(i, COLOR_WHITE, "You fell unconscious due to no life support, you were immediately sent to the hospital.");
KillEMSQueue(i);
SpawnPlayer(i);
}
}
else
{
SendClientMessage(i, COLOR_WHITE, "You fell out of the vehicle, you were immediately sent to the hospital.");
KillEMSQueue(i);
SpawnPlayer(i);
}
}
GetPlayerHealth(i, health);
if(health <= 5)
{
SendClientMessage(i, COLOR_WHITE, "You fell unconscious, you were immediately sent to the hospital.");
KillEMSQueue(i);
SpawnPlayer(i);
}
}
}
}
}