Код:
// Timer Name: ServerHeartbeat()
// TickRate: 1 secs.
task ServerHeartbeat[1000]() {
if(++AdminWarning == 15) {
for(new z = 0; z < MAX_REPORTS; z++)
{
if(Reports[z][BeingUsed] == 1)
{
if(Reports[z][ReportPriority] == 1 || Reports[z][ReportPriority] == 2)
{
ABroadCast(COLOR_LIGHTRED,"A priority report is pending.", 2, true);
break;
}
}
}
AdminWarning = 0;
}
static string[128];
foreach(new i: Player)
{
if(playerTabbed[i] == 0) {
switch(PlayerInfo[i][pLevel]) {
case 0 .. 2: PlayerInfo[i][pPayCheck] += 1;
case 3 .. 4: PlayerInfo[i][pPayCheck] += 2;
case 5 .. 6: PlayerInfo[i][pPayCheck] += 3;
case 7 .. 8: PlayerInfo[i][pPayCheck] += 4;
case 9 .. 10: PlayerInfo[i][pPayCheck] += 5;
case 11 .. 12: PlayerInfo[i][pPayCheck] += 6;
case 13 .. 14: PlayerInfo[i][pPayCheck] += 7;
case 15 .. 16: PlayerInfo[i][pPayCheck] += 8;
case 17 .. 18: PlayerInfo[i][pPayCheck] += 9;
case 19 .. 20: PlayerInfo[i][pPayCheck] += 10;
default: PlayerInfo[i][pPayCheck] += 11;
}
if(++PlayerInfo[i][pConnectSeconds] >= 3600) {
PayDay(i);
}
}
if(PlayerInfo[i][pJudgeJailType] != 0 && PlayerInfo[i][pJudgeJailTime] > 0 && !PlayerInfo[i][pBeingSentenced]) PlayerInfo[i][pJudgeJailTime]--;
if(PlayerInfo[i][pJudgeJailTime] <= 0 && PlayerInfo[i][pJudgeJailType] != 0) PlayerInfo[i][pJudgeJailType] = 0;
if(PlayerInfo[i][pJailTime] > 0 && --PlayerInfo[i][pJailTime] <= 0) {
if(strfindex(PlayerInfo[i][pPrisonReason], "[IC]", true) != -1 || strfindex(PlayerInfo[i][pPrisonReason], "[ISOLATE]", true) != -1) {
SetPlayerInterior(i, 0);
PlayerInfo[i][pInt] = 0;
SetPlayerVirtualWorld(i, 0);
PlayerInfo[i][pVW] = 0;
SetPlayerPosEx(i, -2028.5829,-96.5533,35.1641);
}
else {
SetPlayerInterior(i, 0);
PlayerInfo[i][pInt] = 0;
SetPlayerVirtualWorld(i, 0);
PlayerInfo[i][pVW] = 0;
SetPlayerPosEx(i, 1544.5059,-1675.5673,13.5585);
}
PlayerInfo[i][pJailTime] = 0;
PhoneOnline[i] = 0;
SendClientMessageEx(i, COLOR_GRAD1," You have paid your debt to society.");
GameTextForPlayer(i, "~g~Freedom~n~~w~Try to be a better citizen", 5000, 1);
ClearCrimes(i);
strcpy(PlayerInfo[i][pPrisonReason], "None", 128);
SetPlayerToTeamColor(i);
}
if(CommandSpamTimes[i] != 0)
{
CommandSpamTimes[i]--;
}
if(TextSpamTimes[i] != 0)
{
TextSpamTimes[i]--;
}
if(UsedFind[i] >= 1) --UsedFind[i];
if(PlayerInfo[i][pMechTime] > 0) PlayerInfo[i][pMechTime]--;
if(PlayerInfo[i][pLawyerTime] > 0) PlayerInfo[i][pLawyerTime]--;
if(PlayerInfo[i][pDrugsTime] > 0) PlayerInfo[i][pDrugsTime]--;
if(PlayerInfo[i][pRMuted] == 2) {
PlayerInfo[i][pRMutedTime]--;
if(PlayerInfo[i][pRMutedTime] <= 0) {
PlayerInfo[i][pRMuted] = 0;
}
}
if(PlayerInfo[i][pVMuted] == 2) {
PlayerInfo[i][pVMutedTime]--;
if(PlayerInfo[i][pVMutedTime] <= 0) {
PlayerInfo[i][pVMuted] = 0;
}
}
if(GetPVarType(i, "hFind"))
{
new Float:X, Float:Y, Float:Z, pID = GetPVarInt(i, "hFind");
if(IsPlayerConnected(pID))
{
GetPlayerPos(pID, X, Y, Z);
SetPlayerCheckpoint(i, X, Y, Z, 4.0);
}
}
if(WantLawyer[i] >= 1)
{
CallLawyer[i] = 111;
if(WantLawyer[i] == 1)
{
SendClientMessageEx(i, COLOR_LIGHTRED, "Do you want a Lawyer? (Type yes or no)");
}
WantLawyer[i] ++;
if(WantLawyer[i] == 8)
{
SendClientMessageEx(i, COLOR_LIGHTRED, "Do you want a Lawyer? (Type yes or no)");
}
if(WantLawyer[i] == 15)
{
SendClientMessageEx(i, COLOR_LIGHTRED, "Do you want a Lawyer? (Type yes or no)");
}
if(WantLawyer[i] == 20)
{
SendClientMessageEx(i, COLOR_LIGHTRED, "There is no Lawyer available to you anymore, Jail Time started.");
WantLawyer[i] = 0;
CallLawyer[i] = 0;
}
}
if(PlayerDrunk[i] >= 5)
{
PlayerDrunkTime[i] += 1;
if(PlayerDrunkTime[i] == 8)
{
PlayerDrunkTime[i] = 0;
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerState(i) == 2)
{
new Float:angle;
GetPlayerFacingAngle(i, angle);
SetVehicleZAngle(GetPlayerVehicleID(i), angle + random(10) - 5);
}
}
else
{
ApplyAnimation(i,"PED", "WALK_DRUNK",4.0,0,1,0,0,0);
}
}
}
if(PlayerStoned[i] >= 3)
{
PlayerStoned[i] += 1;
SetPlayerDrunkLevel(i, 40000);
if(PlayerStoned[i] == 50)
{
PlayerStoned[i] = 0;
SetPlayerDrunkLevel(i, 0);
SendClientMessageEx(i, COLOR_GRAD1, " You are no longer stoned!");
}
}
if(PlayerInfo[i][pSexTime] > 0)
{
if(PlayerInfo[i][pSexTime] <= 0)
{
PlayerInfo[i][pSexTime] = 0;
}
else
{
PlayerInfo[i][pSexTime] -= 1;
}
}
if(BoxWaitTime[i] > 0)
{
if(BoxWaitTime[i] >= BoxDelay)
{
BoxDelay = 0;
BoxWaitTime[i] = 0;
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
GameTextForPlayer(i, "~g~Match Started", 5000, 1);
TogglePlayerControllable(i, 1);
RoundStarted = 1;
}
else
{
format(string, sizeof(string), "%d", BoxDelay - BoxWaitTime[i]);
GameTextForPlayer(i, string, 1500, 6);
BoxWaitTime[i] += 1;
}
}
if(RoundStarted > 0)
{
if(PlayerBoxing[i] > 0)
{
new trigger = 0;
new Lost = 0;
new Float:angle;
new Float:health;
GetPlayerHealth(i, health);
if(health < 12)
{
if(i == Boxer1) { Lost = 1; trigger = 1; }
else if(i == Boxer2) { Lost = 2; trigger = 1; }
}
if(health < 28) { GetPlayerFacingAngle(i, angle); SetPlayerFacingAngle(i, angle + 85); }
if(trigger)
{
new winner[MAX_PLAYER_NAME];
new loser[MAX_PLAYER_NAME];
new titel[MAX_PLAYER_NAME];
if(Lost == 1)
{
if(IsPlayerConnected(Boxer1) && IsPlayerConnected(Boxer2))
{
if(IsPlayerInRangeOfPoint(Boxer1,25.0,768.48, -73.66, 1000.57) || IsPlayerInRangeOfPoint(Boxer2,25.0,768.48, -73.66, 1000.57))
{
SetPlayerPosEx(Boxer1, 768.48, -73.66, 1000.57); SetPlayerPosEx(Boxer2, 768.48, -73.66, 1000.57);
SetPlayerInterior(Boxer1, 7); SetPlayerInterior(Boxer2, 7);
GetPlayerName(Boxer1, loser, sizeof(loser));
GetPlayerName(Boxer2, winner, sizeof(winner));
SetPlayerWeapons(Boxer1);
SetPlayerWeapons(Boxer2);
if(PlayerInfo[Boxer1][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12) { PlayerInfo[Boxer1][pLoses] += 1; }
if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12) { PlayerInfo[Boxer2][pWins] += 1; }
if(TBoxer != INVALID_PLAYER_ID)
{
if(IsPlayerConnected(TBoxer))
{
if(TBoxer != Boxer2)
{
if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer2][pJob2] == 12)
{
TBoxer = Boxer2;
GetPlayerName(TBoxer, titel, sizeof(titel));
new nstring[MAX_PLAYER_NAME];
format(nstring, sizeof(nstring), "%s", titel);
strmid(Titel[TitelName], nstring, 0, strlen(nstring), 255);
Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
Titel[TitelLoses] = PlayerInfo[TBoxer][pLoses];
Misc_Save();
format(string, sizeof(string), "Boxing News: %s has Won the fight against Champion %s and is now the new Boxing Champion.", titel, loser);
ProxDetector(30.0, Boxer1, string, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
}
else
{
SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You would have been the Champion if you had the Boxer Job!");
}
}
else
{
GetPlayerName(TBoxer, titel, sizeof(titel));
format(string, sizeof(string), "Boxing News: Boxing Champion %s has Won the fight against %s.", titel, loser);
ProxDetector(30.0, Boxer1, string, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
Titel[TitelLoses] = PlayerInfo[Boxer2][pLoses];
Misc_Save();
}
}