Advertisement
mista__g__

Untitled

Feb 27th, 2024
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 115.19 KB | None | 0 0
  1. /*
  2.                   /$$$$$$   /$$$$$$                      /$$$$$$$  /$$$$$$$
  3.                  /$$__  $$ /$$__  $$                    | $$__  $$| $$__  $$
  4.                 | $$  \ $$| $$  \__/                    | $$  \ $$| $$  \ $$
  5.                 | $$  | $$| $$ /$$$$       /$$$$$$      | $$$$$$$/| $$$$$$$/
  6.                 | $$  | $$| $$|_  $$      |______/      | $$__  $$| $$____/
  7.                 | $$  | $$| $$  \ $$                    | $$  \ $$| $$      
  8.                 |  $$$$$$/|  $$$$$$/                    | $$  | $$| $$      
  9.                  \______/  \______/                     |__/  |__/|__/    
  10.  
  11. //--------------------------------[TIMERS.PWN]--------------------------------
  12.  
  13.  
  14.  * Copyright (c) 2016, Opis Gaming Gaming, LLC
  15.  *
  16.  * All rights reserved.
  17.  *
  18.  * Redistribution and use in source and binary forms, with or without modification,
  19.  * are not permitted in any case.
  20.  *
  21.  *
  22.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  26.  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  27.  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  28.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  29.  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  30.  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  31.  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32.  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33.  */
  34.  
  35.  // Timer Name: SkinDelay(playerid)
  36. timer SkinDelay[1000](playerid)
  37. {
  38.     SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
  39.  
  40.     // Attach Storage Objects
  41.     if(PlayerInfo[playerid][pBackpack] > 0 && PlayerInfo[playerid][pBEquipped])
  42.     {
  43.         switch(PlayerInfo[playerid][pBackpack])
  44.         {
  45.             case 1: // Small
  46.             {
  47.                 if(PlayerHoldingObject[playerid][9] != 0 || IsPlayerAttachedObjectSlotUsed(playerid, 9))
  48.                     RemovePlayerAttachedObject(playerid, 9), PlayerHoldingObject[playerid][9] = 0;
  49.                 SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
  50.                 //PlayerInfo[playerid][pBEquipped] = 1;
  51.             }
  52.             case 2: // Med
  53.             {
  54.                 if(PlayerHoldingObject[playerid][9] != 0 || IsPlayerAttachedObjectSlotUsed(playerid, 9))
  55.                     RemovePlayerAttachedObject(playerid, 9), PlayerHoldingObject[playerid][9] = 0;
  56.                 SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
  57.                 //PlayerInfo[playerid][pBEquipped] = 1;
  58.             }
  59.             case 3: // Large
  60.             {
  61.                 if(PlayerHoldingObject[playerid][9] != 0 || IsPlayerAttachedObjectSlotUsed(playerid, 9))
  62.                     RemovePlayerAttachedObject(playerid, 9), PlayerHoldingObject[playerid][9] = 0;
  63.                 SetPlayerAttachedObject(playerid, 9, 3026, 1, -0.254999, -0.109, -0.022999, 10.6, -1.20002, 3.4, 1.265, 1.242, 1.062);
  64.                 //PlayerInfo[playerid][pBEquipped] = 1;
  65.             }
  66.         }
  67.     }
  68.     return 1;
  69. }
  70.  
  71. // Timer Name: NOPCheck(playerid)
  72. timer NOPCheck[5000](playerid)
  73. {
  74.     if(GetPlayerState(playerid) != 2) NOPTrigger[playerid] = 0;
  75.     new newcar = GetPlayerVehicleID(playerid);
  76.     if(PlayerInfo[playerid][pAdmin] > 1 || GetPlayerState(playerid) != 2) return 1;
  77.     else if(IsAPlane(newcar) && (PlayerInfo[playerid][pFlyLic] != 1)) ExecuteNOPAction(playerid);
  78.     else if(IsAPizzaCar(newcar) && PlayerInfo[playerid][pJob] != 21 && PlayerInfo[playerid][pJob2] != 21 && PlayerInfo[playerid][pJob3] != 21) ExecuteNOPAction(playerid);
  79.     else if(IsVIPcar(newcar) && PlayerInfo[playerid][pDonateRank] == 0) ExecuteNOPAction(playerid);
  80.     else if(IsATruckerCar(newcar) && PlayerInfo[playerid][pJob] != 20 && PlayerInfo[playerid][pJob2] != 20 && PlayerInfo[playerid][pJob3] != 20) ExecuteNOPAction(playerid);
  81.     else if(GetCarBusiness(newcar) != INVALID_BUSINESS_ID && PlayerInfo[playerid][pBusiness] != GetCarBusiness(newcar)) ExecuteNOPAction(playerid);
  82.     else if(DynVeh[newcar] != -1)
  83.     {
  84.         if(DynVehicleInfo[DynVeh[newcar]][gv_igID] != 0 && (PlayerInfo[playerid][pMember] != DynVehicleInfo[DynVeh[newcar]][gv_igID] || PlayerInfo[playerid][pLeader] != DynVehicleInfo[DynVeh[newcar]][gv_igID])|| DynVehicleInfo[DynVeh[newcar]][gv_irID] != 0 && PlayerInfo[playerid][pRank] < DynVehicleInfo[DynVeh[newcar]][gv_irID])
  85.         {
  86.             ExecuteNOPAction(playerid);
  87.         }
  88.     }
  89.     return 1;
  90. }
  91.  
  92.  
  93. timer FinishMedKit[5000](playerid)
  94. {
  95.     if(GetPVarInt(playerid, "BackpackMedKit") == 1)
  96.     {
  97.         SetHealth(playerid, 100);
  98.         SetArmour(playerid, 150);
  99.         PlayerInfo[playerid][pBItems][5]--;
  100.         SendClientMessageEx(playerid, COLOR_WHITE, "You have used the Med Kit from the backpack.", 255, 255, 255, 1, 1);
  101.         new ip[MAX_PLAYER_NAME];
  102.         GetPlayerIp(playerid, ip, sizeof(ip));
  103.         format(szMiscArray, sizeof(szMiscArray), "[MEDKIT] %s(%d) (IP:%s) used a medkit (%d Kits Total) [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, PlayerInfo[playerid][pBItems][5], PlayerInfo[playerid][pBackpack]);
  104.         Log("logs/backpack.log", szMiscArray);
  105.         DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt");
  106.     }
  107.     else
  108.     {
  109.         SendClientMessageEx(playerid, COLOR_RED, "You have taken damage or tried entering a car during the 5 seconds, therefore you couldn't use the Med Kit.");
  110.         SetPVarInt(playerid, "BackpackDisabled", 60);
  111.     }
  112.     DeletePVar(playerid, "BackpackMedKit");
  113.     return 1;
  114. }
  115.  
  116. timer FinishMeal[5000](playerid)
  117. {
  118.     if(GetPVarInt(playerid, "BackpackMeal") == 1)
  119.     {
  120.         PlayerInfo[playerid][pBItems][0]--;
  121.         format(szMiscArray, sizeof(szMiscArray),"* You have used a Full Meal from your backpack(%d remaining meals).",PlayerInfo[playerid][pBItems][0]);
  122.         SendClientMessage(playerid, COLOR_GRAD2, szMiscArray);
  123.         SetHealth(playerid, 100.0);
  124.  
  125.         new ip[MAX_PLAYER_NAME];
  126.         GetPlayerIp(playerid, ip, sizeof(ip));
  127.         format(szMiscArray, sizeof(szMiscArray), "[MEDKIT] %s(%d) (IP:%s) used a meal (%d Meals Total) [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, PlayerInfo[playerid][pBItems][0], PlayerInfo[playerid][pBackpack]);
  128.         Log("logs/backpack.log", szMiscArray);
  129.     }
  130.     else
  131.     {
  132.         SendClientMessageEx(playerid, COLOR_RED, "You have taken damage or tried entering a car during the 5 seconds, therefore you couldn't use the Full Meal.");
  133.         SetPVarInt(playerid, "BackpackDisabled", 120);
  134.     }
  135.     ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
  136.     DeletePVar(playerid, "BackpackMeal");
  137.     return 1;
  138. }
  139.  
  140. timer CheckVehiclesLeftSpawned[5000](playerid)
  141. {
  142.     foreach(new j: Player)
  143.     {
  144.         if(!GetPVarType(j, "LockPickVehicleSQLId")) return 1;
  145.         if(GetPVarInt(j, "LockPickPlayerSQLId") == GetPlayerSQLId(playerid)) {
  146.             new v = FindPlayerVehicleWithSQLId(playerid, GetPVarInt(j, "LockPickVehicleSQLId"));
  147.             if(v != -1) {
  148.                 new szMessage[185];
  149.                 if(GetPVarType(j, "AttemptingLockPick")) PlayerVehicleInfo[playerid][v][pvBeingPickLocked] = 1;
  150.                 else if(GetPVarType(j, "DeliveringVehicleTime")) PlayerVehicleInfo[playerid][v][pvBeingPickLocked] = 2;
  151.                 SetPVarInt(j, "LockPickPlayer", playerid);
  152.                 PlayerVehicleInfo[playerid][v][pvBeingPickLockedBy] = j;
  153.                 ++PlayerCars;
  154.                 VehicleSpawned[playerid]++;
  155.                 PlayerVehicleInfo[playerid][v][pvId] = GetPVarInt(j, "LockPickVehicle");
  156.                 PlayerVehicleInfo[playerid][v][pvSpawned] = 1;
  157.                 PlayerVehicleInfo[playerid][v][pvFuel] = VehicleFuel[GetPVarInt(j, "LockPickVehicle")];
  158.                 g_mysql_SaveVehicle(playerid, v);
  159.                 SendClientMessageEx(j, COLOR_GREY, "(( The player that owns this vehicle has logged back in! ))");
  160.                 new ip[MAX_PLAYER_NAME], ip2[MAX_PLAYER_NAME];
  161.                 GetPlayerIp(playerid, ip, sizeof(ip));
  162.                 GetPlayerIp(j, ip2, sizeof(ip2));
  163.                 format(szMessage, sizeof(szMessage), "[LOCK PICK] %s (IP:%s SQLId: %d) has logged back in while his %s(VID:%d Slot %d) was lock picked by %s(IP:%s SQLId:%d)", GetPlayerNameEx(playerid), ip, GetPlayerSQLId(playerid), GetVehicleName(PlayerVehicleInfo[playerid][v][pvId]), PlayerVehicleInfo[playerid][v][pvId], v, GetPlayerNameEx(j), ip2, GetPlayerSQLId(j));
  164.                 Log("logs/playervehicle.log", szMessage);
  165.                 DeletePVar(j, "LockPickVehicleSQLId");
  166.                 DeletePVar(j, "LockPickPlayerSQLId");
  167.                 DeletePVar(j, "LockPickPlayerName");
  168.             }
  169.             else SendClientMessageEx(j, COLOR_GREY, "Error on function FindPlayerVehicleWithSQLId");
  170.         }
  171.     }
  172.     return 1;
  173. }
  174.  
  175.  
  176. /* Tasks - Optimized (Jingles) */
  177.  
  178. // Timer Name: ServerHeartbeat()
  179. // TickRate: 1 secs.
  180. task ServerHeartbeat[1000]() {
  181.  
  182.     arrGroupData[0][g_iDeptRadioAccess] = 0; // Temporary fix for LSPD's dept radio access.
  183.  
  184.     if(++AdminWarning == 15) {
  185.         for(new z = 0; z < MAX_REPORTS; z++)
  186.         {
  187.             if(Reports[z][BeingUsed] == 1)
  188.             {
  189.                 if(Reports[z][ReportPriority] == 1 || Reports[z][ReportPriority] == 2)
  190.                 {
  191.                     ABroadCast(COLOR_LIGHTRED,"A priority report is pending.", 2);
  192.                     break;
  193.                 }
  194.             }
  195.         }
  196.         AdminWarning = 0;
  197.     }
  198.     UpdateCarRadars();
  199.     //CharmTimer();
  200. }
  201.  
  202. // Timer Name: TurfWarsUpdate()
  203. // TickRate: 1 secs.
  204. task TurfWarsUpdate[1000]()
  205. {
  206.     for(new i = 0; i < MAX_TURFS; i++)
  207.     {
  208.         if(TurfWars[i][twActive] == 1)
  209.         {
  210.             if(TurfWars[i][twTimeLeft] > 0)
  211.             {
  212.                 TurfWars[i][twTimeLeft]--;
  213.             }
  214.             else
  215.             {
  216.                 if(TurfWars[i][twAttemptId] != -1)
  217.                 {
  218.                     CaptureTurfWarsZone(TurfWars[i][twAttemptId],i);
  219.                 }
  220.                 TurfWars[i][twVulnerable] = 12;
  221.                 ResetTurfWarsZone(1, i);
  222.             }
  223.         }
  224.         // SaveTurfWar(i);
  225.     }
  226. }
  227.  
  228. // Task Name: SyncTime()
  229. // TickRate: 60 Secs
  230. task SyncTime[60000]()
  231. {
  232.     PlantTimer();
  233.  
  234.     new reports, priority;
  235.     for(new i=0;i<MAX_REPORTS;i++) { if(Reports[i][BeingUsed] == 1) reports++; if(Reports[i][ReportPriority] <= 2 && Reports[i][BeingUsed] == 1) priority++; }
  236.     if(reports >= 5)
  237.     {
  238.         format(szMiscArray, 80, "There are currently %d reports pending. (%d priority)", reports, priority);
  239.         ABroadCast(COLOR_LIGHTRED, szMiscArray, 2);
  240.     }
  241.    
  242.     for(new i = 0; i < MAX_ITEMS; i++) // Moved from 1000 to 60000 check - Jingles
  243.     {
  244.         if(Price[i] != ShopItems[i][sItemPrice])
  245.         {
  246.             format(szMiscArray, 128, "Item: %d - Price: %d - Reset: %d", i, ShopItems[i][sItemPrice], Price[i]);
  247.             Log("error.log", szMiscArray);
  248.             ShopItems[i][sItemPrice] = Price[i];
  249.         }
  250.     }
  251.  
  252.     if(zombieevent) {
  253.  
  254.         foreach(new i: Player)  {
  255.             SaveZombieStats(i);
  256.         }
  257.     }
  258.     new tmphour, tmpminute, tmpsecond;
  259.     gettime(tmphour, tmpminute, tmpsecond);
  260.     FixHour(tmphour);
  261.     tmphour = shifthour;
  262.  
  263.     if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
  264.     {
  265.         if(tmphour == 0 && ghour == 23)
  266.         {
  267.             //CallLocalFunction("InactiveResourceCheck", "");
  268.  
  269.             /*
  270.             new month, day, year;
  271.             getdate(year,month,day);
  272.             if(month == 4 && (day == 25 || day == 26)) // NGG B-Day 2015
  273.             {
  274.                 foreach(Player, i)
  275.                 {
  276.                     PlayerInfo[i][pReceivedPrize] = 0;
  277.                 }
  278.                 mysql_tquery(MainPipeline, "UPDATE `accounts` SET `ReceivedPrize` = 0", false, "OnQueryFinish", "i", SENDDATA_THREAD);
  279.             }*/
  280.         }
  281.         if(tmphour == 3 || tmphour == 6 || tmphour == 9 || tmphour == 12 || tmphour == 15 || tmphour == 18 || tmphour == 21 || tmphour == 0) PrepareLotto();
  282.         else
  283.         {
  284.             if(SpecLotto) {
  285.                 format(szMiscArray, sizeof(szMiscArray), "Special Lottery: Remember to buy a lotto ticket at a 24/7. Next drawing is at %s. The total Jackpot is $%s", ConvertToTwelveHour(tmphour), number_format(Jackpot));
  286.                 SendClientMessageToAllEx(COLOR_WHITE, szMiscArray);
  287.                 format(szMiscArray, sizeof(szMiscArray), "Special Prize: %s", LottoPrize);
  288.                 SendClientMessageToAllEx(COLOR_WHITE, szMiscArray);
  289.             }
  290.             else {
  291.                 format(szMiscArray, sizeof(szMiscArray), "Lottery: Remember to buy a lotto ticket at a 24/7. Next drawing is at %s. The total Jackpot is $%s", ConvertToTwelveHour(tmphour), number_format(Jackpot));
  292.                 SendClientMessageToAllEx(COLOR_WHITE, szMiscArray);
  293.             }
  294.         }
  295.         for(new iGroupID; iGroupID < MAX_GROUPS; iGroupID++)
  296.         {
  297.             MemberCount(iGroupID);
  298.             if(arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_GOV && arrGroupData[iGroupID][g_iAllegiance] == 1)
  299.             {
  300.                 format(szMiscArray, sizeof(szMiscArray), "The tax vault is at $%s", number_format(Tax));
  301.                 GroupPayLog(iGroupID, szMiscArray);
  302.             }
  303.             else if(arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_GOV && arrGroupData[iGroupID][g_iAllegiance] == 2)
  304.             {
  305.                 format(szMiscArray, sizeof(szMiscArray), "The tax vault is at $%s", number_format(TRTax));
  306.                 GroupPayLog(iGroupID, szMiscArray);
  307.             }
  308.             else
  309.             {
  310.                 format(szMiscArray, sizeof(szMiscArray), "The faction vault is at $%s.", number_format(arrGroupData[iGroupID][g_iBudget]));
  311.                 GroupPayLog(iGroupID, szMiscArray);
  312.             }
  313.             if(arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_LEA || arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_MEDIC || arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_JUDICIAL || arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_TAXI || arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_TOWING)
  314.             {
  315.                 if(arrGroupData[iGroupID][g_iBudgetPayment] > 0)
  316.                 {
  317.                     if(Tax > arrGroupData[iGroupID][g_iBudgetPayment] && arrGroupData[iGroupID][g_iAllegiance] == 1)
  318.                     {
  319.                         Tax -= arrGroupData[iGroupID][g_iBudgetPayment];
  320.                         arrGroupData[iGroupID][g_iBudget] += arrGroupData[iGroupID][g_iBudgetPayment];
  321.                         format(szMiscArray, sizeof(szMiscArray), "SA Gov Paid $%s to %s budget fund.", number_format(arrGroupData[iGroupID][g_iBudgetPayment]), arrGroupData[iGroupID][g_szGroupName]);
  322.                         GroupPayLog(iGroupID, szMiscArray);
  323.                         Misc_Save();
  324.                         SaveGroup(iGroupID);
  325.                         for(new z; z < MAX_GROUPS; z++)
  326.                         {
  327.                             if(arrGroupData[z][g_iAllegiance] == 1)
  328.                             {
  329.                                 if(arrGroupData[z][g_iGroupType] == GROUP_TYPE_GOV)
  330.                                 {
  331.                                     format(szMiscArray, sizeof(szMiscArray), "SA Gov Paid $%s to %s budget fund.", number_format(arrGroupData[iGroupID][g_iBudgetPayment]), arrGroupData[iGroupID][g_szGroupName]);
  332.                                     GroupPayLog(z, szMiscArray);
  333.                                     break;
  334.                                 }
  335.                             }
  336.                         }
  337.                     }
  338.                     else if(TRTax > arrGroupData[iGroupID][g_iBudgetPayment] && arrGroupData[iGroupID][g_iAllegiance] == 2)
  339.                     {
  340.                         TRTax -= arrGroupData[iGroupID][g_iBudgetPayment];
  341.                         arrGroupData[iGroupID][g_iBudget] += arrGroupData[iGroupID][g_iBudgetPayment];
  342.                         format(szMiscArray, sizeof(szMiscArray), "NE Gov Paid $%s to %s budget fund.", number_format(arrGroupData[iGroupID][g_iBudgetPayment]), arrGroupData[iGroupID][g_szGroupName]);
  343.                         GroupPayLog(iGroupID, szMiscArray);
  344.                         Misc_Save();
  345.                         SaveGroup(iGroupID);
  346.                         for(new z; z < MAX_GROUPS; z++)
  347.                         {
  348.                             if(arrGroupData[z][g_iAllegiance] == 2)
  349.                             {
  350.                                 if(arrGroupData[z][g_iGroupType] == GROUP_TYPE_GOV)
  351.                                 {
  352.                                     format(szMiscArray, sizeof(szMiscArray), "NE Gov Paid $%s to %s budget fund.", number_format(arrGroupData[iGroupID][g_iBudgetPayment]), arrGroupData[iGroupID][g_szGroupName]);
  353.                                     GroupPayLog(z, szMiscArray);
  354.                                     break;
  355.                                 }
  356.                             }
  357.                         }
  358.                     }
  359.                     else
  360.                     {
  361.                         format(szMiscArray, sizeof(szMiscArray), "Warning: The Government Vault has insufficient funds to fund %s.", arrGroupData[iGroupID][g_szGroupName]);
  362.                         SendGroupMessage(GROUP_TYPE_GOV, COLOR_RED, szMiscArray);
  363.                     }
  364.                 }
  365.                 for(new iDvSlotID = 0; iDvSlotID < MAX_DYNAMIC_VEHICLES; iDvSlotID++)
  366.                 {
  367.                     if(DynVehicleInfo[iDvSlotID][gv_igID] != INVALID_GROUP_ID && DynVehicleInfo[iDvSlotID][gv_igID] == iGroupID)
  368.                     {
  369.                         if(DynVehicleInfo[iDvSlotID][gv_iModel] != 0 && (400 < DynVehicleInfo[iDvSlotID][gv_iModel] < 612))
  370.                         {
  371.                             if(arrGroupData[iGroupID][g_iBudget] >= DynVehicleInfo[iDvSlotID][gv_iUpkeep])
  372.                             {
  373.                                 arrGroupData[iGroupID][g_iBudget] -= DynVehicleInfo[iDvSlotID][gv_iUpkeep];
  374.                                 format(szMiscArray, sizeof(szMiscArray), "Vehicle ID %d (Slot ID %d) Maintainence fee cost $%s to %s's budget fund.",DynVehicleInfo[iDvSlotID][gv_iSpawnedID], iDvSlotID, number_format(DynVehicleInfo[iDvSlotID][gv_iUpkeep]), arrGroupData[iGroupID][g_szGroupName]);
  375.                                 GroupPayLog(iGroupID, szMiscArray);
  376.                             }
  377.                             else
  378.                             {
  379.                                 DynVehicleInfo[iDvSlotID][gv_iDisabled] = 1;
  380.                                 DynVeh_Save(iDvSlotID);
  381.                                 DynVeh_Spawn(iDvSlotID);
  382.                             }
  383.                         }
  384.                     }
  385.                 }
  386.                 SaveGroup(iGroupID);
  387.                 for(new cratebox = 0; cratebox < MAX_CRATES; cratebox++) {
  388.                     if(CrateBox[cratebox][cbActive]) {
  389.                         SaveCrate(cratebox);
  390.                     }
  391.                 }
  392.                 for(new facility = 0; facility < MAX_CRATE_FACILITY; facility++) {
  393.                     if(CrateFacility[facility][cfActive]) {
  394.                         SyncFacility(facility);
  395.                     }
  396.                 }
  397.             }
  398.         }
  399.  
  400.         WeatherCalling += random(5) + 1;
  401.         #if defined zombiemode
  402.         if(WeatherCalling > 20)
  403.         {
  404.             WeatherCalling = 1;
  405.             gWeather = random(19) + 1;
  406.             if(gWeather == 1 || gWeather == 8 || gWeather == 9) gWeather=1;
  407.         }
  408.         #else
  409.         if(WeatherCalling > 20)
  410.         {
  411.             WeatherCalling = 1;
  412.             gWeather = random(19) + 1;
  413.             gWeather = 1;
  414.             if(gWeather == 1 || gWeather == 8 || gWeather == 9) gWeather=1;
  415.  
  416.         }
  417.         #endif
  418.  
  419.         ghour = tmphour;
  420.         TotalUptime += 1;
  421.         GiftAllowed = 1;
  422.  
  423.         new bmonth, bday, byear;
  424.         new year, month, day;
  425.         getdate(year, month, day);
  426.  
  427.         new ttTime = CalculateWorldGameTime(hour, minuite);
  428.  
  429.         format(szMiscArray, sizeof(szMiscArray), "The time is now %s. ((ST: %s))", ConvertToTwelveHour(ttTime), ConvertToTwelveHour(tmphour));
  430.         SendClientMessageToAllEx(COLOR_WHITE, szMiscArray);
  431.         new query[300];
  432.         mysql_format(MainPipeline, query, sizeof(query), "SELECT b.shift, b.needs_%e, COUNT(DISTINCT s.id) as ShiftCount FROM cp_shift_blocks b LEFT JOIN cp_shifts s ON b.shift_id = s.shift_id AND s.date = '%d-%02d-%02d' AND s.status >= 2 AND s.type = 1 WHERE b.time_start = '%02d:00:00' AND b.type = 1 GROUP BY b.shift, b.needs_%e", GetWeekday(), year, month, day, tmphour, GetWeekday());
  433.         mysql_tquery(MainPipeline, query, "GetShiftInfo", "is", INVALID_PLAYER_ID, szMiscArray);
  434.         foreach(new i: Player)
  435.         {
  436.             if(PlayerInfo[i][pAdmin] >= 2)
  437.             {
  438.                 if(tmphour == 0) ReportCount[i] = 0;
  439.                 ReportHourCount[i] = 0;
  440.             }
  441.             if(PlayerInfo[i][pWatchdog])
  442.             {
  443.                 if(tmphour == 0) WDReportCount[i] = 0;
  444.                 WDReportHourCount[i] = 0;
  445.             }
  446.             if(PlayerInfo[i][pLevel] <= 5) SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Need to travel somewhere and don't have wheels? Use '/service taxi' to call a cab!");
  447.             if(PlayerInfo[i][pDonateRank] >= 3)
  448.             {
  449.                 sscanf(PlayerInfo[i][pBirthDate], "p<->iii", byear, bmonth, bday);
  450.                 if(month == bmonth && day == bday)
  451.                 {
  452.                     if(PlayerInfo[i][pLastBirthday] >= gettime()-86400 || gettime() >= PlayerInfo[i][pLastBirthday]+28512000)
  453.                     {
  454.                         SetPVarInt(i, "pBirthday", 1);
  455.                         PlayerInfo[i][pLastBirthday] = gettime();
  456.                         mysql_format(MainPipeline, query, sizeof(query), "UPDATE `accounts` SET `LastBirthday`=%d WHERE `Username` = '%e'", PlayerInfo[i][pLastBirthday], GetPlayerNameExt(i));
  457.                         mysql_tquery(MainPipeline, query, "OnQueryFinish", "ii", SENDDATA_THREAD, i);
  458.                     }
  459.                 }
  460.                 else
  461.                 {
  462.                     DeletePVar(i, "pBirthday");
  463.                 }
  464.                 if(GetPVarInt(i, "pBirthday") == 1)
  465.                 {
  466.                     if(PlayerInfo[i][pReceivedBGift] != 1)
  467.                     {
  468.                         PlayerInfo[i][pReceivedBGift] = 1;
  469.                         GiftPlayer(MAX_PLAYERS, i);
  470.                         format(szMiscArray, sizeof(szMiscArray), "Happy Birthday %s! You have received a free gift!", GetPlayerNameEx(i));
  471.                         SendClientMessageEx(playerid, COLOR_YELLOW, szMiscArray);
  472.                         format(szMiscArray, sizeof(szMiscArray), "%s(%d) has received a free gift for his birthday (%s) (Payday).", GetPlayerNameEx(i), GetPlayerSQLId(i), PlayerInfo[i][pBirthDate]);
  473.                         Log("logs/birthday.log", szMiscArray);
  474.                         SendClientMessageEx(playerid, COLOR_YELLOW, "Gold VIP: You will get x2 paycheck as a birthday gift today.");
  475.                         OnPlayerStatsUpdate(i);
  476.                     }
  477.                 }
  478.             }
  479.         }
  480.         new iTempHour = CalculateWorldGameTime(hour, minuite);
  481.         SetWorldTime(iTempHour);
  482.  
  483.         if(tmphour == 0) CountCitizens();
  484.  
  485.         for(new x = 0; x < MAX_POINTS; x++)
  486.         {
  487.             if(strcmp(DynPoints[x][poName], "NULL", true) != 0) {
  488.                 if(DynPoints[x][poTimer] > 0) DynPoints[x][poTimer]--, SavePoint(x);
  489.                 if(!DynPoints[x][poTimer] && !DynPoints[x][poCapturable] && !DynPoints[x][poLocked]) {
  490.                     format(szMiscArray, sizeof(szMiscArray), "%s has become available for capture.", DynPoints[x][poName]);
  491.                     SendClientMessageToAllEx(COLOR_YELLOW, szMiscArray);
  492.                     DynPoints[x][poCapturable] = 1;
  493.                     SavePoint(x);
  494.                 }
  495.                 if((0 <= DynPoints[x][poCaptureGroup] < MAX_GROUPS) && DynPoints[x][poAmountHour] > 0) {
  496.                     format(szMiscArray, sizeof(szMiscArray), "Your family has recieved %s %s for owning %s.", number_format(DynPoints[x][poAmountHour]), PointTypeToName(DynPoints[x][poType]), DynPoints[x][poName]);
  497.                     foreach(new i: Player)
  498.                     {
  499.                         if(PlayerInfo[i][pMember] == DynPoints[x][poCaptureGroup]) {
  500.                             SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMiscArray);
  501.                         }
  502.                     }
  503.                     if(DynPoints[x][poType] == 0) arrGroupData[DynPoints[x][poCaptureGroup]][g_iMaterials] += DynPoints[x][poAmountHour];
  504.                     if((1 <= DynPoints[x][poType] < 5)) arrGroupData[DynPoints[x][poCaptureGroup]][g_iDrugs][DynPoints[x][poType]-1] += DynPoints[x][poAmountHour];
  505.                 }
  506.             }
  507.         }
  508.  
  509.         Misc_Save();
  510.  
  511.         for(new i = 0; i < MAX_TURFS; i++)
  512.         {
  513.             if(TurfWars[i][twVulnerable] > 0)
  514.             {
  515.                 TurfWars[i][twVulnerable]--;
  516.  
  517.                 if(TurfWars[i][twVulnerable] == 0)
  518.                 {
  519.                     if(TurfWars[i][twOwnerId] != -1)
  520.                     {
  521.                         format(szMiscArray,sizeof(szMiscArray),"%s that you currently own is vulnerable for capture!",TurfWars[i][twName]);
  522.                         foreach(new x: Player) if(PlayerInfo[x][pMember] == TurfWars[i][twOwnerId]) SendClientMessageEx(x, COLOR_YELLOW, szMiscArray);
  523.                     }
  524.                 }
  525.             }
  526.             if(TurfWars[i][twOwnerId] != INVALID_GROUP_ID && TurfWars[i][twSpecial] == 2)
  527.             {
  528.                 arrGroupData[TurfWars[i][twOwnerId]][g_iDrugs][0] += 20;
  529.                 arrGroupData[TurfWars[i][twOwnerId]][g_iDrugs][1] += 20;
  530.                 arrGroupData[TurfWars[i][twOwnerId]][g_iDrugs][2] += 10;
  531.                 arrGroupData[TurfWars[i][twOwnerId]][g_iDrugs][3] += 10;
  532.                 arrGroupData[TurfWars[i][twOwnerId]][g_iDrugs][4] += 5;
  533.  
  534.                 foreach(new x: Player) if(PlayerInfo[x][pMember] == TurfWars[i][twOwnerId]) SendClientMessageEx(x, COLOR_LIGHTBLUE, "Your family has recieved drugs for owning a drug turf.");
  535.             }
  536.         }
  537.         //CallRemoteFunction("ActivateRandomQuestion", "");//Olympics
  538.         if(tmphour == 0 && day == 1) {
  539.             foreach(new i: Player)
  540.             {
  541.                 if(PlayerInfo[i][pDedicatedHours] > 0) {
  542.                     SendClientMessageEx(playerid, COLOR_YELLOW, "Player Dedicated has entered a new month your hours and rank have been reset.");
  543.                     PlayerInfo[i][pDedicatedHours] = 0;
  544.                     if(PlayerInfo[i][pDedicatedPlayer] != 4) PlayerInfo[i][pDedicatedPlayer] = 0;
  545.                 }
  546.             }
  547.             mysql_format(MainPipeline, query, sizeof(query), "UPDATE `accounts` SET `pDedicatedPlayer` = 0, `DedicatedHours` = 0 WHERE `DedicatedHours` > 0 AND `pDedicatedPlayer` != 4");
  548.             mysql_tquery(MainPipeline, query, "OnQueryFinish", "i", SENDDATA_THREAD);
  549.         }
  550.     }
  551. }
  552.  
  553. // Timer Name: ProductionUpdate()
  554. // TickRate: 5 Minutes.
  555. task ProductionUpdate[300000]()
  556. {
  557.     // Dump Accounts to /accdump/ for Crash Recovery.
  558.     // g_mysql_DumpAccounts();
  559.  
  560.     SaveTurfWars();
  561.     AdvisorMessage++;
  562.     foreach(new i: Player)
  563.     {
  564.         if(GetPVarInt(i, "ManualSave")) DeletePVar(i, "ManualSave");
  565.  
  566.         if(AdvisorMessage == 3 && Advisors > 0 && PlayerInfo[i][pLevel] < 4)
  567.         {
  568.             SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Need help? The Advisors are here to help you. (/requesthelp to get help)");
  569.         }
  570.         if(PlayerInfo[i][pConnectHours] < 2) {
  571.             SendClientMessageEx(playerid, COLOR_LIGHTRED, "Due to an increase in new playing accounts being created for Death Matching.");
  572.             SendClientMessageEx(playerid, COLOR_LIGHTRED, "Weapons for new players are restricted for the first two hours of game play.");
  573.         }
  574.  
  575.         /*if(PlayerInfo[i][pFishes] >= 5) {
  576.             if(FishCount[i] >= 3) PlayerInfo[i][pFishes] = 0;
  577.             else ++FishCount[i];
  578.         }*/
  579.         if(PlayerDrunk[i] > 0) { PlayerDrunk[i] = 0; PlayerDrunkTime[i] = 0; GameTextForPlayer(i, "~p~Drunk effect~n~~w~Gone", 3500, 1); }
  580.     }
  581.     if(AdvisorMessage == 3) {
  582.         AdvisorMessage = 0;
  583.     }
  584.     if(VIPGifts == 1) {
  585.         if(VIPGiftsTimeLeft > 0)
  586.         {
  587.             VIPGiftsTimeLeft -= 5;
  588.             if(VIPGiftsTimeLeft > 0)
  589.             {
  590.                 format(szMiscArray, sizeof(szMiscArray), "%s would like for you to come to Club VIP for free gifts and great times [%d minutes remains]", VIPGiftsName, VIPGiftsTimeLeft);
  591.                 SendVIPMessage(COLOR_LIGHTGREEN, szMiscArray);
  592.             }
  593.         }
  594.         else
  595.         {
  596.             VIPGiftsTimeLeft = 0;
  597.             VIPGifts = 0;
  598.             format(szMiscArray, sizeof(szMiscArray), "Club VIP is no longer giving away free gifts. Thanks for coming!", VIPGiftsName, VIPGiftsTimeLeft);
  599.             SendVIPMessage(COLOR_LIGHTGREEN, szMiscArray);
  600.         }
  601.     }
  602.     ResetElevatorQueue();
  603.     for(new h; h < MAX_HOUSES; h++)
  604.     {
  605.         if(HouseInfo[h][hSignExpire] && gettime() >= HouseInfo[h][hSignExpire])
  606.         {
  607.             format(szMiscArray, sizeof(szMiscArray), "[EXPIRE] House Sale Sign Expired - Housed ID: %d", h);
  608.             ABroadCast(COLOR_YELLOW, szMiscArray, 4);
  609.             Log("logs/house.log", szMiscArray);
  610.             DeleteHouseSaleSign(h);
  611.         }
  612.     }
  613. }
  614.  
  615.  
  616. // Timer Name: MoneyUpdate()
  617. // TickRate: 1 secs.
  618. task MoneyUpdate[1000]()
  619. {
  620.     new minuitet=minuite;
  621.     gettime(hour,minuite,second);
  622.     FixHour(hour);
  623.     hour = shifthour;
  624.  
  625.     if(minuitet != minuite)
  626.     {
  627.         if(minuite < 10)format(szMiscArray, sizeof(szMiscArray), "%d:0%d", hour, minuite);
  628.         else format(szMiscArray, sizeof(szMiscArray), "%d:%d", hour, minuite);
  629.         TextDrawSetString(WristWatch, szMiscArray);
  630.     }
  631.     if(EventKernel[EventStatus] >= 2 && EventKernel[EventTime] > 0)
  632.     {
  633.         if(--EventKernel[EventTime] <= 0) {
  634.             foreach(new i: Player)
  635.             {
  636.                 if( GetPVarInt( i, "EventToken" ) == 1 )
  637.                 {
  638.                     if(EventKernel[EventType] == 3) {
  639.                         if(IsValidDynamic3DTextLabel(RFLTeamN3D[i])) {
  640.                             DestroyDynamic3DTextLabel(RFLTeamN3D[i]);
  641.                             RFLTeamN3D[i] = Text3D:-1;
  642.                         }
  643.                         DisablePlayerCheckpoint(i);
  644.                     }
  645.                     ResetPlayerWeapons( i );
  646.                     SetPlayerWeapons(i);
  647.                     SetPlayerToTeamColor(i);
  648.                     SetPlayerSkin(i, PlayerInfo[i][pModel]);
  649.                     SetPlayerPos(i,EventFloats[i][1],EventFloats[i][2],EventFloats[i][3]);
  650.                     Player_StreamPrep(i, EventFloats[i][1],EventFloats[i][2],EventFloats[i][3], FREEZE_TIME);
  651.                     SetPlayerVirtualWorld(i, EventLastVW[i]);
  652.                     SetPlayerFacingAngle(i, EventFloats[i][0]);
  653.                     SetPlayerInterior(i,EventLastInt[i]);
  654.                     SetHealth(i, EventFloats[i][4]);
  655.                     if(EventFloats[i][5] > 0) {
  656.                         SetArmour(i, EventFloats[i][5]);
  657.                     }
  658.                     for(new d = 0; d < 6; d++)
  659.                     {
  660.                         EventFloats[i][d] = 0.0;
  661.                     }
  662.                     EventLastVW[i] = 0;
  663.                     EventLastInt[i] = 0;
  664.                     DeletePVar(i, "EventToken");
  665.                     SendClientMessageEx( i, COLOR_YELLOW, "You have been removed from the event as it has been terminated by the timer." );
  666.                 }
  667.             }
  668.             EventKernel[ EventPositionX ] = 0;
  669.             EventKernel[ EventPositionY ] = 0;
  670.             EventKernel[ EventPositionZ ] = 0;
  671.             EventKernel[ EventTeamPosX1 ] = 0;
  672.             EventKernel[ EventTeamPosY1 ] = 0;
  673.             EventKernel[ EventTeamPosZ1 ] = 0;
  674.             EventKernel[ EventTeamPosX2 ] = 0;
  675.             EventKernel[ EventTeamPosY2 ] = 0;
  676.             EventKernel[ EventTeamPosZ2 ] = 0;
  677.             EventKernel[ EventStatus ] = 0;
  678.             EventKernel[ EventType ] = 0;
  679.             EventKernel[ EventHealth ] = 0;
  680.             EventKernel[ EventLimit ] = 0;
  681.             EventKernel[ EventPlayers ] = 0;
  682.             EventKernel[ EventWeapons ][0] = 0;
  683.             EventKernel[ EventWeapons ][1] = 0;
  684.             EventKernel[ EventWeapons ][2] = 0;
  685.             EventKernel[ EventWeapons ][3] = 0;
  686.             EventKernel[ EventWeapons ][4] = 0;
  687.             for(new i = 0; i < 20; i++)
  688.             {
  689.                 EventRCPU[i] = 0;
  690.                 EventRCPX[i] = 0.0;
  691.                 EventRCPY[i] = 0.0;
  692.                 EventRCPZ[i] = 0.0;
  693.                 EventRCPS[i] = 0.0;
  694.                 EventRCPT[i] = 0;
  695.             }
  696.             EventKernel[EventCreator] = INVALID_PLAYER_ID;
  697.             EventKernel[VipOnly] = 0;
  698.             EventKernel[EventJoinStaff] = 0;
  699.             SendClientMessageToAllEx( COLOR_LIGHTBLUE, "* The event has been finished because the time limit has been reached." );
  700.         }
  701.     }
  702. }
  703.  
  704. // Timer Name: SpecUpdate()
  705. // TickRate: 3 secs.
  706. /*task SpecUpdate[3000]()
  707. {
  708.     foreach(new i: Player)
  709.     {
  710.         if(PlayerInfo[i][pAdmin] >= 2 || PlayerInfo[i][pHelper] >= 3 || PlayerInfo[i][pWatchdog] == 1)
  711.         {
  712.             if(Spectating[i] >= 1)
  713.             {
  714.                 if(Spectate[i] < 553)
  715.                 {
  716.                     new targetid = Spectate[ i ];
  717.                     if( !IsPlayerConnected( targetid ) )
  718.                     {
  719.                         SendClientMessageEx( i, COLOR_WHITE, "The player you were spectating has left the server." );
  720.                         GettingSpectated[Spectate[i]] = INVALID_PLAYER_ID;
  721.                         Spectating[i] = 0;
  722.                         Spectate[i] = INVALID_PLAYER_ID;
  723.                         SetPVarInt(i, "SpecOff", 1 );
  724.                         TogglePlayerSpectating( i, false );
  725.                         SetCameraBehindPlayer(i);
  726.  
  727.                         if(GetPVarType(i, "pWatchdogWatching")) DeletePVar(i, "pWatchdogWatching");
  728.                     }
  729.                 }
  730.                 if(Spectate[i] == 553)
  731.                 {
  732.                     TogglePlayerControllable(i, 1);
  733.                     TogglePlayerSpectating(i, 0);
  734.                     DeletePVar(i, "MedicBill");
  735.                     SpawnPlayer( i );
  736.                     Spectate[i] = INVALID_PLAYER_ID;
  737.                     Spectating[i] = 0;
  738.                 }
  739.                 if(Spectate[i] == 556)
  740.                 {
  741.                     SetPlayerToTeamColor(i);
  742.                     Spectate[i] = INVALID_PLAYER_ID;
  743.                 }
  744.             }
  745.         }
  746.     }
  747. }*/
  748.  
  749. // Timer Name: PaintballArenaUpdate()
  750. // TickRate: 1 secs.
  751. task PaintballArenaUpdate[1000]()
  752. {
  753.     for(new i = 0; i < MAX_ARENAS; i++)
  754.     {
  755.         if(PaintBallArena[i][pbActive] == 1)
  756.         {
  757.             if(PaintBallArena[i][pbGameType] == 3)
  758.             {
  759.                 if(PaintBallArena[i][pbFlagRedActive] == 1)
  760.                 {
  761.                     if(PaintBallArena[i][pbFlagRedActiveTime] <= 0)
  762.                     {
  763.                         ResetFlagPaintballArena(i,1);
  764.                         PaintBallArena[i][pbFlagRedActiveTime] = 0;
  765.                     }
  766.                     PaintBallArena[i][pbFlagRedActiveTime]--;
  767.                 }
  768.                 if(PaintBallArena[i][pbFlagBlueActive] == 1)
  769.                 {
  770.                     if(PaintBallArena[i][pbFlagBlueActiveTime] <= 0)
  771.                     {
  772.                         ResetFlagPaintballArena(i,2);
  773.                         PaintBallArena[i][pbFlagBlueActiveTime] = 0;
  774.                     }
  775.                     PaintBallArena[i][pbFlagBlueActiveTime]--;
  776.                 }
  777.             }
  778.  
  779.             // Inactive Players Check
  780.             if(PaintBallArena[i][pbPlayers] > 1)
  781.             {
  782.                 PaintBallArena[i][pbTimeLeft]--;
  783.             }
  784.  
  785.             if(PaintBallArena[i][pbTimeLeft] == 300-1)
  786.             {
  787.                 SendPaintballArenaMessage(i, COLOR_YELLOW, "Five minutes left in this round!");
  788.                 //SendPaintballArenaSound(i, 1057);
  789.                 ////SendPaintballArenaAudio(i, 5, 100);
  790.             }
  791.  
  792.             if(PaintBallArena[i][pbTimeLeft] == 180)
  793.             {
  794.                 SendPaintballArenaMessage(i, COLOR_YELLOW, "Three minutes left in this round!");
  795.                 //SendPaintballArenaSound(i, 1057);
  796.                 ////SendPaintballArenaAudio(i, 4, 100);
  797.             }
  798.             if(PaintBallArena[i][pbTimeLeft] == 120)
  799.             {
  800.                 SendPaintballArenaMessage(i, COLOR_YELLOW, "Two minutes left in this round!");
  801.                 //SendPaintballArenaSound(i, 1057);
  802.                 //SendPaintballArenaAudio(i, 3, 100);
  803.             }
  804.             if(PaintBallArena[i][pbTimeLeft] == 60)
  805.             {
  806.                 SendPaintballArenaMessage(i, COLOR_YELLOW, "One minute left in this round!");
  807.                 //SendPaintballArenaSound(i, 1057);
  808.                 //SendPaintballArenaAudio(i, 2, 100);
  809.             }
  810.             if(PaintBallArena[i][pbTimeLeft] == 30)
  811.             {
  812.                 SendPaintballArenaMessage(i, COLOR_YELLOW, "30 seconds left in this round!");
  813.                 //SendPaintballArenaSound(i, 1057);
  814.                 //SendPaintballArenaAudio(i, 6, 100);
  815.             }
  816.             if(PaintBallArena[i][pbTimeLeft] == 12)
  817.             {
  818.                 SendPaintballArenaMessage(i, COLOR_RED, "Sudden death, 5 seconds left!");
  819.                 //SendPaintballArenaSound(i, 1057);
  820.                 //SendPaintballArenaAudio(i, 37, 100);
  821.             }
  822.             if(PaintBallArena[i][pbTimeLeft] == 7)
  823.             {
  824.                 SendPaintballArenaMessage(i, COLOR_YELLOW, "Round Over!");
  825.                 //SendPaintballArenaSound(i, 1057);
  826.                 //SendPaintballArenaAudio(i, 20, 100);
  827.             }
  828.             if(PaintBallArena[i][pbTimeLeft] >= 1 && PaintBallArena[i][pbTimeLeft] <= 7)
  829.             {
  830.                 foreach(new p: Player)
  831.                 {
  832.                     new arenaid = GetPVarInt(p, "IsInArena");
  833.                     if(arenaid == i)
  834.                     {
  835.                         TogglePlayerControllable(p, 0);
  836.                         PaintballScoreboard(p, arenaid);
  837.                     }
  838.                 }
  839.                 //SendPaintballArenaSound(i, 1057);
  840.             }
  841.             if(PaintBallArena[i][pbTimeLeft] <= 0)
  842.             {
  843.                 new
  844.                     winnerid = SortWinnerPaintballScores(i);
  845.  
  846.                 format(szMiscArray, sizeof(szMiscArray), "%s has won $%d from the Paintball Match, thanks for playing!", GetPlayerNameEx(winnerid),PaintBallArena[i][pbMoneyPool]);
  847.                 GivePlayerCash(winnerid,PaintBallArena[i][pbMoneyPool]);
  848.                 SendPaintballArenaMessage(i, COLOR_YELLOW, szMiscArray);
  849.                 foreach(new p: Player)
  850.                 {
  851.                     new arenaid = GetPVarInt(p, "IsInArena");
  852.                     if(arenaid == i)
  853.                     {
  854.                         PaintballScoreboard(p, arenaid);
  855.                         TogglePlayerControllable(p, 1);
  856.                     }
  857.                 }
  858.                 foreach(new p: Player)
  859.                 {
  860.                     new arenaid = GetPVarInt(p, "IsInArena");
  861.                     if(arenaid == i)
  862.                     {
  863.                         LeavePaintballArena(p, arenaid);
  864.                     }
  865.                 }
  866.                 ResetPaintballArena(i);
  867.             }
  868.         }
  869.     }
  870. }
  871.  
  872. // Timer Name: VehicleUpdate()
  873. // TickRate: 60 secs.
  874. task VehicleUpdate[60000]() {
  875.  
  876.     static engine, lights, alarm, doors, bonnet, boot, objective;
  877.  
  878.     foreach(new v : Vehicles) {
  879.  
  880.         new i = GetVehicleModel(v);
  881.         switch(i) {
  882.  
  883.             case 481, 509, 510: {}
  884.             default: {
  885.  
  886.                 GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);
  887.  
  888.                 if(engine == VEHICLE_PARAMS_ON) {
  889.  
  890.                     if(arr_Engine{v} == 0) SetVehicleParamsEx(v, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
  891.  
  892.                     else if(!IsVIPcar(v) && !IsFamedVeh(v)) {
  893.  
  894.                         if(VehicleFuel[v] > 0.0) {
  895.  
  896.                             VehicleFuel[v] -= 1.0;
  897.                             if(VehicleFuel[v] <= 0.0) SetVehicleParamsEx(v, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
  898.                         }
  899.                     }
  900.                 }
  901.             }
  902.         }
  903.     }
  904. }
  905.  
  906. // Task Name: hungerGames()
  907. task hungerGames[1000]()
  908. {
  909.     if(hgActive)
  910.     {
  911.         if(hgCountdown > 0)
  912.         {
  913.             hgCountdown--;
  914.  
  915.             format(szMiscArray, sizeof(szMiscArray), "Time left until start: %d", hgCountdown);
  916.             foreach(new i: Player)
  917.             {
  918.                 if(HungerPlayerInfo[i][hgInEvent] == 1)
  919.                 {
  920.                     PlayerTextDrawSetString(i, HungerPlayerInfo[i][hgTimeLeftText], szMiscArray);
  921.                 }
  922.             }
  923.  
  924.             if(hgCountdown == 300)
  925.             {
  926.                 SendClientMessageToAll(COLOR_LIGHTBLUE, "The Hunger Games Event will start in 5 minutes, type /joinhunger to participate.");
  927.             }
  928.             else if(hgCountdown == 60)
  929.             {
  930.                 SendClientMessageToAll(COLOR_LIGHTBLUE, "The Hunger Games Event will start in 1 minute, type /joinhunger to participate.");
  931.             }
  932.             else if(hgCountdown == 30)
  933.             {
  934.                 foreach(new i: Player)
  935.                 {
  936.                     if(HungerPlayerInfo[i][hgInEvent] == 1)
  937.                     {
  938.                         SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* The event will be starting in 30 seconds...");
  939.                         SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Godmode will be disabled and backpacks will be spawned in 30 seconds.");
  940.                     }
  941.                 }
  942.             }
  943.         }
  944.         else if(hgCountdown == 0 && hgActive == 1)
  945.         {
  946.             LoadHGBackpacks();
  947.             hgActive = 2;
  948.  
  949.             format(szMiscArray, sizeof(szMiscArray), "Time left until start: %d", hgCountdown);
  950.             foreach(new i: Player)
  951.             {
  952.                 if(HungerPlayerInfo[i][hgInEvent] == 1)
  953.                 {
  954.                     PlayerTextDrawSetString(i, HungerPlayerInfo[i][hgTimeLeftText], szMiscArray);
  955.  
  956.                     if(GetPVarInt(i, "HungerVoucher") == 1)
  957.                     {
  958.                         GivePlayerValidWeapon(i, 29);
  959.                         SetHealth(i, 100.0);
  960.                         DeletePVar(i, "HungerVoucher");
  961.                     }
  962.                     else
  963.                     {
  964.                         SetHealth(i, 50.0);
  965.                     }
  966.  
  967.                     SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Let the Hunger Games Begin!");
  968.                     GameTextForPlayer(i, "The Game is on!", 2000, 6);
  969.                     PlayerTextDrawHide(i, HungerPlayerInfo[i][hgTimeLeftText]);
  970.                     PlayerTextDrawHide(i, HungerPlayerInfo[i][hgLoadingText]);
  971.                 }
  972.             }
  973.         }
  974.     }
  975.     return true;
  976. }
  977.  
  978.  
  979. /* Player Tasks - (Optimized from tasks + foreach loop) - Jingles */
  980.  
  981. task PlayerHeartBeat[1000]() {
  982. foreach(new i: Player)
  983. {
  984.         // alerttimer - Merged by Jingles
  985.         if(AlertTime[i] != 0) AlertTime[i]--;
  986.  
  987.         new Float:playerArmour = GetArmour(i, playerArmour);
  988.         // playertabbedloop - Merged by Jingles
  989.         new
  990.             iTick = gettime() - 1;
  991.  
  992.         if(floatround(playerArmour, floatround_round) < 0)
  993.         {
  994.             SetPlayerArmour(i, 0);
  995.         }
  996.  
  997.         if(1 <= GetPlayerState(i) <= 3) {
  998.             if(playerTabbed[i] >= 1) {
  999.                 if(++playerTabbed[i] >= 1200 && PlayerInfo[i][pAdmin] < 2) {
  1000.                     SendClientMessageEx(playerid, COLOR_WHITE, "You have been automatically kicked for alt-tabbing.");
  1001.                     return Disconnect(i);
  1002.                 }
  1003.             }
  1004.             else if(++playerSeconds[i] < iTick && playerTabbed[i] == 0) {
  1005.                 playerTabbed[i] = 1;
  1006.             }
  1007.             else if((IsPlayerInRangeOfPoint(i, 2.0, PlayerPos[i][0], PlayerPos[i][1], PlayerPos[i][2]) || InsidePlane[i] != INVALID_PLAYER_ID) && ++playerLastTyped[i] >= 10) {
  1008.                 if(++playerAFK[i] >= 1200 && PlayerInfo[i][pAdmin] < 2) {
  1009.                     SendClientMessageEx(playerid, COLOR_WHITE, "You have been automatically kicked for idling.");
  1010.                     return Disconnect(i);
  1011.                 }
  1012.             }
  1013.             else playerAFK[i] = 0;
  1014.             GetPlayerPos(i, PlayerPos[i][0], PlayerPos[i][1], PlayerPos[i][2]);
  1015.         }
  1016.         if(GetPVarType(i, "IsInArena") && GetPlayerVirtualWorld(i) == 0)
  1017.         {
  1018.             SendClientMessageEx(playerid, COLOR_WHITE, "SERVER: You have been kicked for PaintBall Exploiting.");
  1019.             format(szMiscArray, sizeof(szMiscArray), " %s(%d) (ID: %d) (IP: %s) has been kicked for attempting to Paint Ball Exploit.", GetPlayerNameEx(i), GetPlayerSQLId(i), i, GetPlayerIpEx(i));
  1020.             Log("logs/pbexploit.log", szMiscArray);
  1021.             SetTimerEx("KickEx", 1000, 0, "i", i);
  1022.         }
  1023.         // MoneyHeartBeat - Merged by Jingles
  1024.         if(gPlayerLogged{i})
  1025.         {
  1026.             if(IsSpawned[i] == 0 && PlayerInfo[i][pAdmin] < 1337)
  1027.             {
  1028.                 SpawnKick[i]++;
  1029.                 if(SpawnKick[i] >= 120)
  1030.                 {
  1031.                     IsSpawned[i] = 1;
  1032.                     SpawnKick[i] = 0;
  1033.  
  1034.                     SendClientMessageEx(playerid, COLOR_WHITE, "SERVER: You have been kicked for being AFK.");
  1035.                     format(szMiscArray, sizeof(szMiscArray), " %s(%d) (ID: %d) (IP: %s) has been kicked for not being spawned over 2 minutes.", GetPlayerNameEx(i), GetPlayerSQLId(i), i, GetPlayerIpEx(i));
  1036.                     Log("logs/spawnafk.log", szMiscArray);
  1037.                     SetTimerEx("KickEx", 1000, 0, "i", i);
  1038.                 }
  1039.             }
  1040.             if(IsSpawned[i] > 0 && SpawnKick[i] > 0)
  1041.             {
  1042.                 SpawnKick[i] = 0;
  1043.             }
  1044.             if(GetPlayerPing(i) > MAX_PING)
  1045.             {
  1046.                 if(playerTabbed[i] == 0)
  1047.                 {
  1048.                     if(GetPVarInt(i, "BeingKicked") != 1)
  1049.                     {
  1050.                         new ping;
  1051.  
  1052.                         ping = GetPlayerPing(i);
  1053.                         if(ping != 65535) // Invalid Ping
  1054.                         {
  1055.                             format(szMiscArray, sizeof(szMiscArray), "{AA3333}AdmWarning{FFFF00}: %s has just been kicked for %d ping (maximum: %d).", GetPlayerNameEx(i), ping, MAX_PING);
  1056.                             ABroadCast(COLOR_YELLOW, szMiscArray, 2);
  1057.                             SendClientMessageEx(playerid, COLOR_WHITE, "You have been kicked because your ping is higher than the maximum.");
  1058.                             SetPVarInt(i, "BeingKicked", 1);
  1059.                             SetTimerEx("KickEx", 1000, 0, "i", i);
  1060.                         }
  1061.                     }
  1062.                 }
  1063.             }
  1064.             if(rBigEarT[i] > 0) {
  1065.                 rBigEarT[i]--;
  1066.                 if(rBigEarT[i] == 0) {
  1067.                     DeletePVar(i, "BigEar");
  1068.                     DeletePVar(i, "BigEarPlayer");
  1069.                     SendClientMessageEx(playerid, COLOR_WHITE, "Big Ears has been turned off.");
  1070.                 }
  1071.             }
  1072.             if(PlayerInfo[i][pTriageTime] != 0) PlayerInfo[i][pTriageTime]--;
  1073.             if(PlayerInfo[i][pTicketTime] != 0) PlayerInfo[i][pTicketTime]--;
  1074.  
  1075.             if(GetPVarInt(i, "InRangeBackup") > 0) SetPVarInt(i, "InRangeBackup", GetPVarInt(i, "InRangeBackup")-1);
  1076.  
  1077.             if(GetPVarInt(i, "HitCooldown") > 0) {
  1078.  
  1079.                 SetPVarInt(i, "HitCooldown", GetPVarInt(i, "HitCooldown")-1);
  1080.                 format(szMiscArray, sizeof(szMiscArray), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~%d seconds until approval", GetPVarInt(i, "HitCooldown"));
  1081.                 GameTextForPlayer(i, szMiscArray, 1100, 3);
  1082.                 if(GetPVarInt(i, "HitCooldown") == 0)
  1083.                 {
  1084.                     GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~Contract Approved.", 5000, 3);
  1085.                 }
  1086.             }
  1087.             if(GetPVarType(i, "IsTackled")) {
  1088.  
  1089.                 new copcount;
  1090.                 foreach(new j: Player)
  1091.                 {
  1092.                     if(ProxDetectorS(4.0, i, j) && IsACop(j) && j != i)
  1093.                     {
  1094.                         copcount++;
  1095.                     }
  1096.                 }
  1097.                 if(copcount == 0 || !ProxDetectorS(5.0, i, GetPVarInt(i, "IsTackled")))
  1098.                 {
  1099.                     SendClientMessageEx(playerid, COLOR_GREEN, "You're able to escape due to the cops leaving you unrestrained.");
  1100.                     ClearTackle(i);
  1101.                 }
  1102.                 if(GetPVarInt(i, "TackleCooldown") > 0)
  1103.                 {
  1104.                     if(IsPlayerConnected(GetPVarInt(i, "IsTackled")) && GetPVarInt(GetPVarInt(i, "IsTackled"), "Tackling") == i)
  1105.                     {
  1106.                         format(szMiscArray, sizeof(szMiscArray), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~%d", GetPVarInt(i, "TackleCooldown"));
  1107.                         GameTextForPlayer(i, szMiscArray, 1100, 3);
  1108.                         SetPVarInt(i, "TackleCooldown", GetPVarInt(i, "TackleCooldown")-1);
  1109.                         if(GetPVarInt(i, "TackledResisting") == 2 && copcount <= 2 && GetPVarInt(i, "TackleCooldown") < 12) // resisting
  1110.                         {
  1111.                             new escapechance = random(100);
  1112.                             switch(escapechance)
  1113.                             {
  1114.                                 case 35,40,22,72,11..16, 62..64:
  1115.                                 {
  1116.                                     GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~ESCAPE!", 10000, 3);
  1117.                                     SendClientMessageEx(playerid, COLOR_GREEN, "You're able to push the officer off you and escape.");
  1118.                                     format(szMiscArray, sizeof(szMiscArray), "** %s pushes %s aside and is able to escape.", GetPlayerNameEx(i), GetPlayerNameEx(GetPVarInt(i, "IsTackled")));
  1119.                                     ProxDetector(30.0, i, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1120.                                     TogglePlayerControllable(GetPVarInt(i, "IsTackled"), 0);
  1121.                                     ApplyAnimation(GetPVarInt(i, "IsTackled"), "SWEET", "Sweet_injuredloop", 4.0, 1, 1, 1, 1, 0, 1);
  1122.                                     SetTimerEx("CopGetUp", 2500, 0, "i", GetPVarInt(i, "IsTackled"));
  1123.                                     ClearTackle(i);
  1124.                                 }
  1125.                             }
  1126.                         }
  1127.                         else if(GetPVarInt(i, "TackledResisting") == 2 && copcount <= 3 && GetPVarInt(i, "TackleCooldown") < 12) // resisting
  1128.                         {
  1129.                             new escapechance = random(100);
  1130.                             switch(escapechance)
  1131.                             {
  1132.                                 case 35,40,22,62:
  1133.                                 {
  1134.                                     GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~ESCAPE!", 10000, 3);
  1135.                                     SendClientMessageEx(playerid, COLOR_GREEN, "You're able to push the officer off you and escape.");
  1136.                                     format(szMiscArray, sizeof(szMiscArray), "** %s pushes %s aside and is able to escape.", GetPlayerNameEx(i), GetPlayerNameEx(GetPVarInt(i, "IsTackled")));
  1137.                                     ProxDetector(30.0, i, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1138.                                     TogglePlayerControllable(GetPVarInt(i, "IsTackled"), 0);
  1139.                                     ApplyAnimation(GetPVarInt(i, "IsTackled"), "SWEET", "Sweet_injuredloop", 4.0, 1, 1, 1, 1, 0, 1);
  1140.                                     SetTimerEx("CopGetUp", 2500, 0, "i", GetPVarInt(i, "IsTackled"));
  1141.                                     ClearTackle(i);
  1142.                                 }
  1143.                             }
  1144.                         }
  1145.                     }
  1146.                 }
  1147.                 else
  1148.                 {
  1149.                     if(ProxDetectorS(5.0, i, GetPVarInt(i, "IsTackled")))
  1150.                     {
  1151.                         CopGetUp(GetPVarInt(i, "IsTackled"));
  1152.                     }
  1153.                     SetPVarInt(GetPVarInt(i, "IsTackled"), "CopTackleCooldown", 30);
  1154.                     ShowPlayerDialogEx(i, -1, DIALOG_STYLE_LIST, "Close", "Close", "Close", "Close");
  1155.                     ClearTackle(i);
  1156.                 }
  1157.             }
  1158.             if(GetPVarInt(i, "CopTackleCooldown") > 0)
  1159.             {
  1160.                 SetPVarInt(i, "CopTackleCooldown", GetPVarInt(i, "CopTackleCooldown")-1);
  1161.             }
  1162.             if(GetPVarInt(i, "CantBeTackledCount") > 0)
  1163.             {
  1164.                 SetPVarInt(i, "CantBeTackledCount", GetPVarInt(i, "CantBeTackledCount")-1);
  1165.             }
  1166.             if(PlayerInfo[i][pCash] != GetPlayerMoney(i))
  1167.             {
  1168.                 ResetPlayerMoney(i);
  1169.                 GivePlayerMoney(i, PlayerInfo[i][pCash]);
  1170.             }
  1171.             if(PlayerInfo[i][pGPS] > 0 && GetPVarType(i, "gpsonoff"))
  1172.             {
  1173.                 new zone[28];
  1174.                 GetPlayer3DZone(i, zone, MAX_ZONE_NAME);
  1175.                 PlayerTextDrawSetString(i, GPS[i], zone);
  1176.             }
  1177.             if(GetPVarType(i, "Injured")) SetPlayerArmedWeapon(i, 0);
  1178.             if(GetPVarType(i, "IsFrozen")) TogglePlayerControllable(i, 0);
  1179.             if(PlayerCuffed[i] > 1) {
  1180.                 SetHealth(i, 1000);
  1181.                 SetArmour(i, GetPVarFloat(i, "cuffarmor"));
  1182.             }
  1183.         }
  1184.  
  1185.         if(playerTabbed[i] == 0) {
  1186.  
  1187.             switch(PlayerInfo[i][pLevel]) {
  1188.  
  1189.                 case 0 .. 2: PlayerInfo[i][pPayCheck] += 1;
  1190.                 case 3 .. 4: PlayerInfo[i][pPayCheck] += 2;
  1191.                 case 5 .. 6: PlayerInfo[i][pPayCheck] += 3;
  1192.                 case 7 .. 8: PlayerInfo[i][pPayCheck] += 4;
  1193.                 case 9 .. 10: PlayerInfo[i][pPayCheck] += 5;
  1194.                 case 11 .. 12: PlayerInfo[i][pPayCheck] += 6;
  1195.                 case 13 .. 14: PlayerInfo[i][pPayCheck] += 7;
  1196.                 case 15 .. 16: PlayerInfo[i][pPayCheck] += 8;
  1197.                 case 17 .. 18: PlayerInfo[i][pPayCheck] += 9;
  1198.                 case 19 .. 20: PlayerInfo[i][pPayCheck] += 10;
  1199.                 default: PlayerInfo[i][pPayCheck] += 11;
  1200.             }
  1201.             if(++PlayerInfo[i][pConnectSeconds] >= 3600) {
  1202.                 PayDay(i);
  1203.             }
  1204.         }
  1205.  
  1206.         if (GetPVarInt(i, "MailTime") > 0) SetPVarInt(i, "MailTime", GetPVarInt(i, "MailTime") - 1);
  1207.         else DeletePVar(i, "MailTime");
  1208.  
  1209.         if(PlayerInfo[i][pJudgeJailType] != 0 && PlayerInfo[i][pJudgeJailTime] > 0 && !PlayerInfo[i][pBeingSentenced]) PlayerInfo[i][pJudgeJailTime]--;
  1210.         if(PlayerInfo[i][pJudgeJailTime] <= 0 && PlayerInfo[i][pJudgeJailType] != 0) PlayerInfo[i][pJudgeJailType] = 0;
  1211.  
  1212.  
  1213.         if(playerTabbed[i] == 0)
  1214.         {
  1215.             if(PlayerInfo[i][pJailTime] > 0 && --PlayerInfo[i][pJailTime] <= 0)
  1216.             {
  1217.                 if(strfind(PlayerInfo[i][pPrisonReason], "[IC]", true) != -1)
  1218.                 {
  1219.                     ShowPlayerDialogEx(i, DIALOG_STAYPRISON, DIALOG_STYLE_MSGBOX, "Notice", "Your initial prison time has ran out. However, you can choose to stay.\nWould you like to be released?", "Yes", "No");
  1220.                 }
  1221.                 else
  1222.                 {
  1223.                     ReleasePlayerFromPrison(i);
  1224.                 }
  1225.             }
  1226.             if(gettime() >= PlayerInfo[i][pPrisonWineTime] && GetPVarInt(i, "pPrisonMWine") == 1 && strfind(PlayerInfo[i][pPrisonReason], "[IC]", true) != -1)
  1227.             {
  1228.                 SetPVarInt(i, "pPrisonMWine", 2);
  1229.                 SendClientMessageEx(playerid, COLOR_GREY, "Your pruno is finished. Go to your cell and type /finishpruno to collect it.");
  1230.             }
  1231.            
  1232.  
  1233.             if(GetPVarType(i, "AttemptingLockPick") && GetPVarType(i, "LockPickCountdown")) {
  1234.  
  1235.                 new Float: vehSize[3],
  1236.                     Float: Pos[3],
  1237.                     vehicleid = GetPVarInt(i, "LockPickVehicle"),
  1238.                     ownerid = GetPVarInt(i, "LockPickPlayer");
  1239.                 GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, vehSize[0], vehSize[1], vehSize[2]);
  1240.                 GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_FRONTSEAT, Pos[0], Pos[1], Pos[2]);
  1241.                 GetVehicleRelativePos(vehicleid, Pos[0], Pos[1], Pos[2], Pos[0]+((vehSize[0] / 2)-(vehSize[0])), Pos[1], 0.0);
  1242.                 if(IsPlayerInRangeOfPoint(i, 1.0, Pos[0], Pos[1], Pos[2]) && !IsPlayerInAnyVehicle(i)) {
  1243.                     SetPVarInt(i, "LockPickCountdown", GetPVarInt(i, "LockPickCountdown")-1);
  1244.                     UpdateVLPTextDraws(i, vehicleid);
  1245.                     if(GetPVarType(i, "LockPickVehicleSQLId")) {
  1246.                         if(GetPVarInt(i, "LockPickCountdown") <= 0) {
  1247.                             LockStatus{vehicleid} = 0;
  1248.                             vehicle_unlock_doors(vehicleid);
  1249.                             SetPVarInt(i, "VLPLocksLeft", GetPVarInt(i, "VLPLocksLeft")-1);
  1250.                             mysql_format(MainPipeline, szMiscArray, sizeof(szMiscArray), "UPDATE `vehicles` SET `pvLocksLeft` = '%d', `pvLastLockPickedBy` = '%e' WHERE `id` = '%d' AND `sqlID` = '%d'", GetPVarInt(i, "VLPLocksLeft"), GetPlayerNameExt(i), GetPVarInt(i, "LockPickVehicleSQLId"), GetPVarInt(i, "LockPickPlayerSQLId"));
  1251.                             mysql_tquery(MainPipeline, szMiscArray, "OnQueryFinish", "ii", SENDDATA_THREAD, i);
  1252.                             new ip[MAX_PLAYER_NAME], ownername[MAX_PLAYER_NAME];
  1253.                             GetPlayerIp(i, ip, sizeof(ip)), GetPVarString(i, "LockPickPlayerName", ownername, sizeof(ownername));
  1254.                             format(szMiscArray, sizeof(szMiscArray), "[LOCK PICK] %s (IP:%s, SQLId: %d) successfully lock picked a %s(VID:%d SQLId %d) owned by %s(Offline, SQLId: %d)", GetPlayerNameEx(i), ip, GetPlayerSQLId(i), GetVehicleName(vehicleid), vehicleid, GetPVarInt(i, "LockPickVehicleSQLId"), ownername, GetPVarInt(i, "LockPickPlayerSQLId"));
  1255.                             Log("logs/playervehicle.log", szMiscArray);
  1256.                             /* DeletePVar(i, "LockPickVehicle");
  1257.                             DeletePVar(i, "LockPickPlayer"); */
  1258.                         }
  1259.                     }
  1260.                     else {
  1261.                         new slot = GetPlayerVehicle(GetPVarInt(i, "LockPickPlayer"), GetPVarInt(i, "LockPickVehicle"));
  1262.                         if(!PlayerVehicleInfo[ownerid][slot][pvAlarmTriggered] && (GetPVarInt(i, "LockPickCountdown") <= floatround((GetPVarInt(i, "LockPickTotalTime") * 0.4), floatround_ceil))) {
  1263.                             TriggerVehicleAlarm(i, ownerid, vehicleid);
  1264.                         }
  1265.                         if(GetPVarInt(i, "LockPickCountdown") <= 0) {
  1266.                             PlayerVehicleInfo[ownerid][slot][pvLocked] = 0;
  1267.                             UnLockPlayerVehicle(ownerid, PlayerVehicleInfo[ownerid][slot][pvId], PlayerVehicleInfo[ownerid][slot][pvLock]);
  1268.                             PlayerVehicleInfo[ownerid][slot][pvBeingPickLocked] = 2;
  1269.                             if(--PlayerVehicleInfo[ownerid][slot][pvLocksLeft] <= 0 && PlayerVehicleInfo[ownerid][slot][pvLock]) {
  1270.                                 SendClientMessageEx(playerid, COLOR_PURPLE, "(( The lock has been damaged as result of the lock pick! ))");
  1271.                             }
  1272.                             strcpy(PlayerVehicleInfo[ownerid][slot][pvLastLockPickedBy], GetPlayerNameEx(i));
  1273.                             new ip[MAX_PLAYER_NAME], ip2[MAX_PLAYER_NAME];
  1274.                             GetPlayerIp(i, ip, sizeof(ip));
  1275.                             GetPlayerIp(ownerid, ip2, sizeof(ip2));
  1276.                             format(szMiscArray, sizeof(szMiscArray), "[LOCK PICK] %s (IP:%s SQLId: %d) successfully lock picked a %s(VID:%d Slot %d) owned by %s(IP:%s SQLId: %d)", GetPlayerNameEx(i), ip, GetPlayerSQLId(i), GetVehicleName(vehicleid), vehicleid, slot, GetPlayerNameEx(ownerid), ip2, GetPlayerSQLId(ownerid));
  1277.                             Log("logs/playervehicle.log", szMiscArray);
  1278.                         }
  1279.                     }
  1280.  
  1281.                     if(GetPVarInt(i, "LockPickCountdown") <= 0) {
  1282.                         if(--PlayerInfo[i][pToolBox] <= 0) SendClientMessageEx(playerid, COLOR_PURPLE, "(( The tools from the Tool Box look spoiled, you may need to get a new Tool Box ))");
  1283.                         if(++PlayerInfo[i][pLockPickVehCount] > 11) {
  1284.                             PlayerInfo[i][pLockPickTime] = gettime() + 21600;
  1285.                             PlayerInfo[i][pLockPickVehCount] = 0;
  1286.                         }
  1287.                         ClearCheckpoint(i);
  1288.                         new engine, lights, alarm, doors, bonnet, boot, objective;
  1289.                         GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
  1290.                         SetVehicleParamsEx(vehicleid,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
  1291.                         SendClientMessageEx(playerid, COLOR_YELLOW, "You have successfully picked this vehicle lock, you may now deliver this to the checkpoint mark to get money.");
  1292.                         if(PlayerInfo[i][pCrowBar] > 0) SendClientMessageEx(playerid, COLOR_CYAN, "Optionally, you may try to open the trunk to see what's inside (/cracktrunk).");
  1293.                         PlayerPlaySound(i, 1145, 0.0, 0.0, 0.0);
  1294.                         SetPlayerSkin(i, GetPlayerSkin(i));
  1295.                         SetPlayerSpecialAction(i, SPECIAL_ACTION_NONE);
  1296.                         new rand = random(sizeof(lpRandomLocations));
  1297.                         while(IsPlayerInRangeOfPoint(i, 1000.0, lpRandomLocations[rand][0], lpRandomLocations[rand][1], lpRandomLocations[rand][2]))
  1298.                             rand = random(sizeof(lpRandomLocations));
  1299.                         SetPlayerCheckpoint(i, lpRandomLocations[rand][0], lpRandomLocations[rand][1], lpRandomLocations[rand][2], 8.0);
  1300.                         SetPVarInt(i, "DeliveringVehicleTime", gettime()+900);
  1301.                         new Float: pX, Float: pY, Float: pZ;
  1302.                         GetPlayerPos(i, pX, pY, pZ);
  1303.                         SetPVarFloat(i, "tpDeliverVehX", pX);
  1304.                         SetPVarFloat(i, "tpDeliverVehY", pY);
  1305.                         SetPVarFloat(i, "tpDeliverVehZ", pZ);
  1306.                         SetPVarInt(i, "tpDeliverVehTimer", 80);
  1307.                         SetTimerEx("OtherTimerEx", 1000, false, "ii", i, TYPE_DELIVERVEHICLE);
  1308.                         DestroyVLPTextDraws(i);
  1309.                         DeletePVar(i, "AttemptingLockPick");
  1310.                         DeletePVar(i, "LockPickCountdown");
  1311.                         DeletePVar(i, "LockPickTotalTime");
  1312.                         ClearAnimationsEx(i, 1);
  1313.  
  1314.                         if(PlayerInfo[i][pDoubleEXP] > 0) {
  1315.                             format(szMiscArray, sizeof(szMiscArray), "You have gained 2 Vehicle Lock Picking skill points instead of 1. You have %d hours left on the Double EXP token.", PlayerInfo[i][pDoubleEXP]);
  1316.                             SendClientMessageEx(playerid, COLOR_YELLOW, szMiscArray);
  1317.                             PlayerInfo[i][pCarLockPickSkill] += 2;
  1318.                         }
  1319.                         else ++PlayerInfo[i][pCarLockPickSkill];
  1320.  
  1321.                         switch(PlayerInfo[i][pCarLockPickSkill]) {
  1322.                             case 50: SendClientMessageEx(playerid, COLOR_YELLOW, "* Your Car Lock Picking Skill is now Level 2, you will get more rewards & time will be reduced.");
  1323.                             case 125: SendClientMessageEx(playerid, COLOR_YELLOW, "* Your Car Lock Picking Skill is now Level 3, you will get more rewards & time will be reduced.");
  1324.                             case 225: SendClientMessageEx(playerid, COLOR_YELLOW, "* Your Car Lock Picking Skill is now Level 4, you will get more rewards & time will be reduced.");
  1325.                             case 350: SendClientMessageEx(playerid, COLOR_YELLOW, "* Your Car Lock Picking Skill is now Level 5, you will get more rewards & time will be reduced.");
  1326.                         }
  1327.                         /* DeletePVar(i, "LockPickVehicle");
  1328.                         DeletePVar(i, "LockPickPlayer"); */
  1329.                     }
  1330.                     else if((GetPVarInt(i, "LockPickCountdown") <= floatround((GetPVarInt(i, "LockPickTotalTime") * 0.9), floatround_ceil)) && GetPlayerAnimationIndex(i) != 368) {
  1331.                         SendClientMessageEx(playerid, COLOR_YELLOW, "Warning{FFFFFF}: You have moved from your current position therefore you have failed this lock pick.");
  1332.                         DeletePVar(i, "AttemptingLockPick");
  1333.                         DeletePVar(i, "LockPickCountdown");
  1334.                         DeletePVar(i, "LockPickTotalTime");
  1335.                         if(GetPVarType(i, "LockPickVehicleSQLId")) {
  1336.                             DeletePVar(i, "LockPickVehicleSQLId");
  1337.                             DeletePVar(i, "LockPickPlayerSQLId");
  1338.                             DeletePVar(i, "LockPickPlayerName");
  1339.                             DestroyVehicle(GetPVarInt(i, "LockPickVehicle"));
  1340.                         }
  1341.                         else {
  1342.                             new slot = GetPlayerVehicle(GetPVarInt(i, "LockPickPlayer"), GetPVarInt(i, "LockPickVehicle"));
  1343.                             PlayerVehicleInfo[GetPVarInt(i, "LockPickPlayer")][slot][pvBeingPickLocked] = 0;
  1344.                             PlayerVehicleInfo[GetPVarInt(i, "LockPickPlayer")][slot][pvBeingPickLockedBy] = INVALID_PLAYER_ID;
  1345.                         }
  1346.                         DeletePVar(i, "LockPickVehicle");
  1347.                         DeletePVar(i, "LockPickPlayer");
  1348.                         DestroyVLPTextDraws(i);
  1349.                         ClearAnimationsEx(i, 1);
  1350.                     }
  1351.                 }
  1352.                 else {
  1353.                     SendClientMessageEx(playerid, COLOR_YELLOW, "Warning{FFFFFF}: You have moved from your current position therefore you have failed this lock pick.");
  1354.                     DeletePVar(i, "AttemptingLockPick");
  1355.                     DeletePVar(i, "LockPickCountdown");
  1356.                     DeletePVar(i, "LockPickTotalTime");
  1357.                     if(GetPVarType(i, "LockPickVehicleSQLId")) {
  1358.                         DeletePVar(i, "LockPickVehicleSQLId");
  1359.                         DeletePVar(i, "LockPickPlayerSQLId");
  1360.                         DeletePVar(i, "LockPickPlayerName");
  1361.                         DestroyVehicle(GetPVarInt(i, "LockPickVehicle"));
  1362.                     }
  1363.                     else {
  1364.                         new slot = GetPlayerVehicle(GetPVarInt(i, "LockPickPlayer"), GetPVarInt(i, "LockPickVehicle"));
  1365.                         PlayerVehicleInfo[GetPVarInt(i, "LockPickPlayer")][slot][pvBeingPickLocked] = 0;
  1366.                         PlayerVehicleInfo[GetPVarInt(i, "LockPickPlayer")][slot][pvBeingPickLockedBy] = INVALID_PLAYER_ID;
  1367.                     }
  1368.                     DeletePVar(i, "LockPickVehicle");
  1369.                     DeletePVar(i, "LockPickPlayer");
  1370.                     DestroyVLPTextDraws(i);
  1371.                     ClearAnimationsEx(i, 1);
  1372.                 }
  1373.             }
  1374.             if(GetPVarType(i, "AttemptingCrackTrunk") && GetPVarType(i, "CrackTrunkCountdown")) {
  1375.                 new vehicleid = GetPVarInt(i, "LockPickVehicle"),
  1376.                     Float: Pos[3];
  1377.  
  1378.                 GetPosBehindVehicle(vehicleid, Pos[0], Pos[1], Pos[2], 1.0);
  1379.                 if(IsPlayerInRangeOfPoint(i, 1.0, Pos[0], Pos[1], Pos[2]) && !IsPlayerInAnyVehicle(i)) {
  1380.                     SetPVarInt(i, "CrackTrunkCountdown", GetPVarInt(i, "CrackTrunkCountdown")-1);
  1381.                     UpdateVLPTextDraws(i, vehicleid, 1);
  1382.                     if(GetPVarInt(i, "CrackTrunkCountdown") <= 0) {
  1383.                         new
  1384.                             wslot,
  1385.                             ownerid = GetPVarInt(i, "LockPickPlayer");
  1386.                         SendClientMessageEx(playerid, COLOR_PURPLE, "(( The trunk cracks, you begin to search for any items ))");
  1387.                         PlayerPlaySound(i, 1145, 0.0, 0.0, 0.0);
  1388.                         new engine, lights, alarm, doors, bonnet, boot, objective;
  1389.                         GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
  1390.                         SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
  1391.                         ClearAnimationsEx(i, 1);
  1392.                         SetPlayerSkin(i, GetPlayerSkin(i));
  1393.                         SetPlayerSpecialAction(i, SPECIAL_ACTION_NONE);
  1394.                         if(GetPVarType(i, "LockPickVehicleSQLId")) {
  1395.                             mysql_format(MainPipeline, szMiscArray, sizeof(szMiscArray), "SELECT `pvWeapon0`, `pvWeapon1`, `pvWeapon2` FROM `vehicles` WHERE `id` = '%d' AND `sqlID` = '%d'", GetPVarInt(i, "LockPickVehicleSQLId"), GetPVarInt(i, "LockPickPlayerSQLId"));
  1396.                             mysql_tquery(MainPipeline, szMiscArray, "CheckTrunkContents", "i", i);
  1397.                         }
  1398.                         else {
  1399.                             new slot = GetPlayerVehicle(GetPVarInt(i, "LockPickPlayer"), GetPVarInt(i, "LockPickVehicle"));
  1400.                             wslot = FindGunInVehicleForPlayer(ownerid, slot, i);
  1401.                             if(wslot != -1) {
  1402.                                 format(szMiscArray, sizeof(szMiscArray), "You found a %s.", GetWeaponNameEx(PlayerVehicleInfo[ownerid][slot][pvWeapons][wslot]));
  1403.                                 SendClientMessageEx(playerid, COLOR_YELLOW, szMiscArray);
  1404.                                 GivePlayerValidWeapon(i, PlayerVehicleInfo[ownerid][slot][pvWeapons][wslot]);
  1405.                                 PlayerVehicleInfo[ownerid][slot][pvWeapons][wslot] = 0;
  1406.                                 g_mysql_SaveVehicle(ownerid, slot);
  1407.                                 new ip[MAX_PLAYER_NAME], ip2[MAX_PLAYER_NAME];
  1408.                                 GetPlayerIp(i, ip, sizeof(ip));
  1409.                                 GetPlayerIp(ownerid, ip2, sizeof(ip2));
  1410.                                 format(szMiscArray, sizeof(szMiscArray), "[LOCK PICK] %s(%s) (IP:%s) successfully cracked the trunk of a %s(VID:%d Slot %d Weapon ID: %d) owned by %s(IP:%s)", GetPlayerNameEx(i), GetPlayerSQLId(i), ip, GetVehicleName(vehicleid), vehicleid, slot, PlayerVehicleInfo[ownerid][slot][pvWeapons][wslot], GetPlayerNameEx(ownerid), ip2);
  1411.                                 Log("logs/playervehicle.log", szMiscArray);
  1412.                             }
  1413.                             else SendClientMessageEx(playerid, COLOR_YELLOW, "Warning{FFFFFF}: There was nothing inside the trunk.");
  1414.                         }
  1415.                         DestroyVLPTextDraws(i);
  1416.                         if(--PlayerInfo[i][pCrowBar] <= 0) SendClientMessageEx(playerid, COLOR_PURPLE, "(( The tools from the Tool Box look spoiled, you may need to get a new Tool Box ))");
  1417.                         SetPVarInt(i, "TrunkAlreadyCracked", 1);
  1418.                         DeletePVar(i, "AttemptingCrackTrunk");
  1419.                         DeletePVar(i, "CrackTrunkCountdown");
  1420.                     }
  1421.                     if(GetPlayerAnimationIndex(i) != 368 && GetPVarInt(i, "CrackTrunkCountdown") <= 50) {
  1422.                         DestroyVLPTextDraws(i);
  1423.                         SendClientMessageEx(playerid, COLOR_YELLOW, "Warning{FFFFFF}: You have moved from your current position therefore you have failed this lock pick.");
  1424.                         DeletePVar(i, "AttemptingCrackTrunk");
  1425.                         DeletePVar(i, "CrackTrunkCountdown");
  1426.                         ClearAnimationsEx(i, 1);
  1427.                     }
  1428.                 }
  1429.                 else {
  1430.                     DestroyVLPTextDraws(i);
  1431.                     SendClientMessageEx(playerid, COLOR_YELLOW, "Warning{FFFFFF}: You have moved from your current position therefore you have failed this lock pick.");
  1432.                     DeletePVar(i, "AttemptingCrackTrunk");
  1433.                     DeletePVar(i, "CrackTrunkCountdown");
  1434.                     ClearAnimationsEx(i, 1);
  1435.                 }
  1436.             }
  1437.             if(GetPVarType(i, "TrackVehicleBurglary")) {
  1438.                 if(IsPlayerConnected(GetPVarInt(i, "CallId"))) {
  1439.                     SetPVarInt(i, "TrackVehicleBurglary", GetPVarInt(i, "TrackVehicleBurglary")-1);
  1440.                     new Float: carPos[3];
  1441.                     GetVehiclePos(Calls[GetPVarInt(i, "CallId")][CallVehicleId], carPos[0], carPos[1], carPos[2]);
  1442.                     if(GetPVarFloat(i, "CarLastX") != carPos[0] || GetPVarFloat(i, "CarLastY") != carPos[1] || GetPVarFloat(i, "CarLastZ") != carPos[2])
  1443.                         SetPVarFloat(i, "CarLastX", carPos[0]), SetPVarFloat(i, "CarLastY", carPos[1]), SetPVarFloat(i, "CarLastZ", carPos[2]), SetPlayerCheckpoint(i, carPos[0], carPos[1], carPos[2], 15.0);
  1444.                     if(GetPVarInt(i, "TrackVehicleBurglary") <= 0) {
  1445.                         DisablePlayerCheckpoint(i);
  1446.                         DeletePVar(i, "TrackVehicleBurglary");
  1447.                         DeletePVar(i, "CallId");
  1448.                         DeletePVar(i, "CarLastX");
  1449.                         DeletePVar(i, "CarLastY");
  1450.                         DeletePVar(i, "CarLastZ");
  1451.                         SendClientMessageEx(playerid, COLOR_PURPLE, "(( The 2 minutes have been reached, you lost trace of this vehicle! ))");
  1452.                     }
  1453.                 }
  1454.                 else {
  1455.                     DisablePlayerCheckpoint(i);
  1456.                     DeletePVar(i, "TrackVehicleBurglary");
  1457.                     DeletePVar(i, "CallId");
  1458.                     DeletePVar(i, "CarLastX");
  1459.                     DeletePVar(i, "CarLastY");
  1460.                     DeletePVar(i, "CarLastZ");
  1461.                     SendClientMessageEx(playerid, COLOR_PURPLE, "The caller has disconnected!");
  1462.                 }
  1463.             }
  1464.             if(GetPVarType(i, "wheelclampcountdown")) {
  1465.                 SetPVarInt(i, "wheelclampcountdown", GetPVarInt(i, "wheelclampcountdown")-1);
  1466.                 new vehicleid = GetPVarInt(i, "wheelclampvehicle"),
  1467.                     Float:CarPos[3],
  1468.                     arrVehParams[7];
  1469.                 GetVehiclePos(vehicleid, CarPos[0], CarPos[1], CarPos[2]);
  1470.                 if(!IsPlayerInRangeOfPoint(i, 5.0, CarPos[0], CarPos[1], CarPos[2]) || IsPlayerInAnyVehicle(i)) {
  1471.                     DeletePVar(i, "wheelclampvehicle");
  1472.                     DeletePVar(i, "wheelclampcountdown");
  1473.                     SendClientMessageEx(playerid, COLOR_PURPLE, "(( You failed placing the Wheel Clamp in the vehicle's front tire. ))");
  1474.                 }
  1475.                 else if(GetPVarInt(i, "wheelclampcountdown") <= 0) {
  1476.                     WheelClamp{vehicleid} = 1;
  1477.                     arr_Engine{vehicleid} = 0;
  1478.                     GetVehicleParamsEx(vehicleid, arrVehParams[0], arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
  1479.                     if(arrVehParams[0] == VEHICLE_PARAMS_ON) SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF, arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
  1480.                     DeletePVar(i, "wheelclampvehicle");
  1481.                     DeletePVar(i, "wheelclampcountdown");
  1482.                     format(szMiscArray, sizeof(szMiscArray), "* %s has attached a Wheel Clamp on the %s's front tire.", GetPlayerNameEx(i), GetVehicleName(vehicleid), vehicleid);
  1483.                     ProxDetector(30.0, i, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1484.                 }
  1485.             }
  1486.             if(CommandSpamTimes[i] != 0)
  1487.             {
  1488.                 CommandSpamTimes[i]--;
  1489.             }
  1490.             if(TextSpamTimes[i] != 0)
  1491.             {
  1492.                 TextSpamTimes[i]--;
  1493.             }
  1494.             if(PlayerInfo[i][pRMuted] == 2) {
  1495.                 PlayerInfo[i][pRMutedTime]--;
  1496.                 if(PlayerInfo[i][pRMutedTime] <= 0) {
  1497.                     PlayerInfo[i][pRMuted] = 0;
  1498.                 }
  1499.             }
  1500.             if(PlayerInfo[i][pVMuted] == 2) {
  1501.                 PlayerInfo[i][pVMutedTime]--;
  1502.                 if(PlayerInfo[i][pVMutedTime] <= 0) {
  1503.                     PlayerInfo[i][pVMuted] = 0;
  1504.                 }
  1505.             }
  1506.             if(PlayerInfo[i][pRHMuteTime] > 0) {
  1507.                 PlayerInfo[i][pRHMuteTime]--;
  1508.             }
  1509.  
  1510.             if(GetPVarType(i, "hFind"))
  1511.             {
  1512.                 new Float:X, Float:Y, Float:Z, pID = GetPVarInt(i, "hFind");
  1513.                 if(IsPlayerConnected(pID))
  1514.                 {
  1515.                     if(PhoneOnline[pID] == 0 && PlayerInfo[pID][pPnumber] != 0|| PlayerInfo[pID][pBugged] == PlayerInfo[i][pMember])
  1516.                     {
  1517.                         if(GetPlayerInterior(pID) != 0) {
  1518.                             DeletePVar(i, "hFind");
  1519.                             DisablePlayerCheckpoint(i);
  1520.                             SendClientMessageEx(playerid, COLOR_GREY, "The signal is too weak to track (Interior).");
  1521.                         }
  1522.                         else {
  1523.                             GetPlayerPos(pID, X, Y, Z);
  1524.                             SetPlayerCheckpoint(i, X, Y, Z, 4.0);
  1525.                         }
  1526.                     }
  1527.                     else
  1528.                     {
  1529.  
  1530.                         SendClientMessageEx(playerid, COLOR_GRAD2, "Your tracker has lost its signal.");
  1531.                         DeletePVar(i, "hFind");
  1532.                         DisablePlayerCheckpoint(i);
  1533.                     }
  1534.                 }
  1535.             }
  1536.             if(PlayerDrunk[i] >= 5)
  1537.             {
  1538.                 PlayerDrunkTime[i] += 1;
  1539.                 if(PlayerDrunkTime[i] == 8)
  1540.                 {
  1541.                     PlayerDrunkTime[i] = 0;
  1542.  
  1543.                     if(IsPlayerInAnyVehicle(i))
  1544.                     {
  1545.                         if(GetPlayerState(i) == 2)
  1546.                         {
  1547.                             new Float:angle;
  1548.                             GetPlayerFacingAngle(i, angle);
  1549.                             SetVehicleZAngle(GetPlayerVehicleID(i), angle + random(10) - 5);
  1550.                         }
  1551.                     }
  1552.                     else
  1553.                     {
  1554.                         ApplyAnimation(i,"PED", "WALK_DRUNK",4.0,0,1,0,0,0);
  1555.                     }
  1556.                 }
  1557.             }
  1558.             if(PlayerStoned[i] >= 3)
  1559.             {
  1560.                 PlayerStoned[i] += 1;
  1561.                 SetPlayerDrunkLevel(i, 40000);
  1562.                 if(PlayerStoned[i] == 50)
  1563.                 {
  1564.                     PlayerStoned[i] = 0;
  1565.                     SetPlayerDrunkLevel(i, 0);
  1566.                     SendClientMessageEx(playerid, COLOR_GRAD1, " You are no longer stoned!");
  1567.                 }
  1568.             }
  1569.             if(BoxWaitTime[i] > 0)
  1570.             {
  1571.                 if(BoxWaitTime[i] >= BoxDelay)
  1572.                 {
  1573.                     BoxDelay = 0;
  1574.                     BoxWaitTime[i] = 0;
  1575.                     PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  1576.                     GameTextForPlayer(i, "~g~Match Started", 5000, 1);
  1577.                     TogglePlayerControllable(i, 1);
  1578.                     RoundStarted = 1;
  1579.                 }
  1580.                 else
  1581.                 {
  1582.                     format(szMiscArray, sizeof(szMiscArray), "%d", BoxDelay - BoxWaitTime[i]);
  1583.                     GameTextForPlayer(i, szMiscArray, 1500, 6);
  1584.                     BoxWaitTime[i] += 1;
  1585.                 }
  1586.             }
  1587.             if(RoundStarted > 0)
  1588.             {
  1589.                 if(PlayerBoxing[i] > 0)
  1590.                 {
  1591.                     new trigger = 0;
  1592.                     new Lost = 0;
  1593.                     new Float:angle;
  1594.                     new Float:health;
  1595.                     GetHealth(i, health);
  1596.                     if(health < 12)
  1597.                     {
  1598.                         if(i == Boxer1) { Lost = 1; trigger = 1; }
  1599.                         else if(i == Boxer2) { Lost = 2; trigger = 1; }
  1600.                     }
  1601.                     if(health < 28) { GetPlayerFacingAngle(i, angle); SetPlayerFacingAngle(i, angle + 85); }
  1602.                     if(trigger)
  1603.                     {
  1604.                         new winner[MAX_PLAYER_NAME];
  1605.                         new loser[MAX_PLAYER_NAME];
  1606.                         new titel[MAX_PLAYER_NAME];
  1607.                         if(Lost == 1)
  1608.                         {
  1609.                             if(IsPlayerConnected(Boxer1) && IsPlayerConnected(Boxer2))
  1610.                             {
  1611.                                 if(IsPlayerInRangeOfPoint(Boxer1,25.0,768.48, -73.66, 1000.57) || IsPlayerInRangeOfPoint(Boxer2,25.0,768.48, -73.66, 1000.57))
  1612.                                 {
  1613.                                     SetPlayerPos(Boxer1, 768.48, -73.66, 1000.57); SetPlayerPos(Boxer2, 768.48, -73.66, 1000.57);
  1614.                                     SetPlayerInterior(Boxer1, 7); SetPlayerInterior(Boxer2, 7);
  1615.                                     GetPlayerName(Boxer1, loser, sizeof(loser));
  1616.                                     GetPlayerName(Boxer2, winner, sizeof(winner));
  1617.                                     SetPlayerWeapons(Boxer1);
  1618.                                     SetPlayerWeapons(Boxer2);
  1619.                                     if(PlayerInfo[Boxer1][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12 || PlayerInfo[Boxer1][pJob3] == 12) { PlayerInfo[Boxer1][pLoses] += 1; }
  1620.                                     if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer2][pJob2] == 12 || PlayerInfo[Boxer2][pJob3] == 12) { PlayerInfo[Boxer2][pWins] += 1; }
  1621.                                     if(TBoxer != INVALID_PLAYER_ID)
  1622.                                     {
  1623.                                         if(IsPlayerConnected(TBoxer))
  1624.                                         {
  1625.                                             if(TBoxer != Boxer2)
  1626.                                             {
  1627.                                                 if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer2][pJob2] == 12 || PlayerInfo[Boxer2][pJob3] == 12)
  1628.                                                 {
  1629.                                                     TBoxer = Boxer2;
  1630.                                                     GetPlayerName(TBoxer, titel, sizeof(titel));
  1631.                                                     format(szMiscArray, sizeof(szMiscArray), "%s", titel);
  1632.                                                     strmid(Titel[TitelName], szMiscArray, 0, strlen(szMiscArray), 255);
  1633.                                                     Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
  1634.                                                     Titel[TitelLoses] = PlayerInfo[TBoxer][pLoses];
  1635.                                                     Misc_Save();
  1636.                                                     format(szMiscArray, sizeof(szMiscArray), "Boxing News: %s has Won the fight against Champion %s and is now the new Boxing Champion.",  titel, loser);
  1637.                                                     ProxDetector(30.0, Boxer1, szMiscArray, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
  1638.                                                 }
  1639.                                                 else
  1640.                                                 {
  1641.                                                     SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You would have been the Champion if you had the Boxer Job!");
  1642.                                                 }
  1643.                                             }
  1644.                                             else
  1645.                                             {
  1646.                                                 GetPlayerName(TBoxer, titel, sizeof(titel));
  1647.                                                 format(szMiscArray, sizeof(szMiscArray), "Boxing News: Boxing Champion %s has Won the fight against %s.",  titel, loser);
  1648.                                                 ProxDetector(30.0, Boxer1, szMiscArray, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
  1649.                                                 Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
  1650.                                                 Titel[TitelLoses] = PlayerInfo[Boxer2][pLoses];
  1651.                                                 Misc_Save();
  1652.                                             }
  1653.                                         }
  1654.                                     }//TBoxer
  1655.                                     format(szMiscArray, sizeof(szMiscArray), "* You have Lost the Fight against %s.", winner);
  1656.                                     SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, szMiscArray);
  1657.                                     GameTextForPlayer(Boxer1, "~r~You lost", 3500, 1);
  1658.                                     format(szMiscArray, sizeof(szMiscArray), "* You have Won the Fight against %s.", loser);
  1659.                                     SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, szMiscArray);
  1660.                                     GameTextForPlayer(Boxer2, "~r~You won", 3500, 1);
  1661.                                     if(GetHealth(Boxer1, health) < 20)
  1662.                                     {
  1663.                                         SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You feel exhausted from the Fight, go eat somewhere.");
  1664.                                         SetHealth(Boxer1, 30.0);
  1665.                                     }
  1666.                                     else
  1667.                                     {
  1668.                                         SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You feel perfect, even after the Fight.");
  1669.                                         SetHealth(Boxer1, 50.0);
  1670.                                     }
  1671.                                     if(GetHealth(Boxer2, health) < 20)
  1672.                                     {
  1673.                                         SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You feel exhausted from the Fight, go eat somewhere.");
  1674.                                         SetHealth(Boxer2, 30.0);
  1675.                                     }
  1676.                                     else
  1677.                                     {
  1678.                                         SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You feel perfect, even after the Fight.");
  1679.                                         SetHealth(Boxer2, 50.0);
  1680.                                     }
  1681.                                     GameTextForPlayer(Boxer1, "~g~Match Over", 5000, 1); GameTextForPlayer(Boxer2, "~g~Match Over", 5000, 1);
  1682.                                     if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer2][pJob2] == 12 || PlayerInfo[Boxer2][pJob3] == 12) { PlayerInfo[Boxer2][pBoxSkill] += 1; }
  1683.                                     PlayerBoxing[Boxer1] = 0;
  1684.                                     PlayerBoxing[Boxer2] = 0;
  1685.                                 }
  1686.                                 SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186); SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
  1687.                                 SetPlayerInterior(Boxer1, 5); SetPlayerInterior(Boxer2, 5);
  1688.                                 GetPlayerName(Boxer1, loser, sizeof(loser));
  1689.                                 GetPlayerName(Boxer2, winner, sizeof(winner));
  1690.                                 SetPlayerWeapons(Boxer1);
  1691.                                 SetPlayerWeapons(Boxer2);
  1692.                                 if(PlayerInfo[Boxer1][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12 || PlayerInfo[Boxer1][pJob3] == 12) { PlayerInfo[Boxer1][pLoses] += 1; }
  1693.                                 if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer2][pJob2] == 12 || PlayerInfo[Boxer2][pJob3] == 12) { PlayerInfo[Boxer2][pWins] += 1; }
  1694.                                 if(TBoxer != INVALID_PLAYER_ID)
  1695.                                 {
  1696.                                     if(IsPlayerConnected(TBoxer))
  1697.                                     {
  1698.                                         if(TBoxer != Boxer2)
  1699.                                         {
  1700.                                             if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer2][pJob2] == 12 || PlayerInfo[Boxer2][pJob3] == 12)
  1701.                                             {
  1702.                                                 TBoxer = Boxer2;
  1703.                                                 GetPlayerName(TBoxer, titel, sizeof(titel));
  1704.                                                 format(szMiscArray, sizeof(szMiscArray), "%s", titel);
  1705.                                                 strmid(Titel[TitelName], szMiscArray, 0, strlen(szMiscArray), 255);
  1706.                                                 Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
  1707.                                                 Titel[TitelLoses] = PlayerInfo[TBoxer][pLoses];
  1708.                                                 Misc_Save();
  1709.                                                 format(szMiscArray, sizeof(szMiscArray), "Boxing News: %s has Won the fight against Champion %s and is now the new Boxing Champion.",  titel, loser);
  1710.                                                 ProxDetector(30.0, Boxer1, szMiscArray, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
  1711.                                             }
  1712.                                             else
  1713.                                             {
  1714.                                                 SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You would have been the Champion if you had the Boxer Job!");
  1715.                                             }
  1716.                                         }
  1717.                                         else
  1718.                                         {
  1719.                                             GetPlayerName(TBoxer, titel, sizeof(titel));
  1720.                                             format(szMiscArray, sizeof(szMiscArray), "Boxing News: Boxing Champion %s has Won the fight against %s.",  titel, loser);
  1721.                                             ProxDetector(30.0, Boxer1, szMiscArray, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
  1722.                                             Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
  1723.                                             Titel[TitelLoses] = PlayerInfo[Boxer2][pLoses];
  1724.                                             Misc_Save();
  1725.                                         }
  1726.                                     }
  1727.                                 }//TBoxer
  1728.                                 format(szMiscArray, sizeof(szMiscArray), "* You have Lost the Fight against %s.", winner);
  1729.                                 SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, szMiscArray);
  1730.                                 GameTextForPlayer(Boxer1, "~r~You lost", 3500, 1);
  1731.                                 format(szMiscArray, sizeof(szMiscArray), "* You have Won the Fight against %s.", loser);
  1732.                                 SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, szMiscArray);
  1733.                                 GameTextForPlayer(Boxer2, "~r~You won", 3500, 1);
  1734.                                 if(GetHealth(Boxer1, health) < 20)
  1735.                                 {
  1736.                                     SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You feel exhausted from the Fight, go eat somewhere.");
  1737.                                     SetHealth(Boxer1, 30.0);
  1738.                                 }
  1739.                                 else
  1740.                                 {
  1741.                                     SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You feel perfect, even after the Fight.");
  1742.                                     SetHealth(Boxer1, 50.0);
  1743.                                 }
  1744.                                 if(GetHealth(Boxer2, health) < 20)
  1745.                                 {
  1746.                                     SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You feel exhausted from the Fight, go eat somewhere.");
  1747.                                     SetHealth(Boxer2, 30.0);
  1748.                                 }
  1749.                                 else
  1750.                                 {
  1751.                                     SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You feel perfect, even after the Fight.");
  1752.                                     SetHealth(Boxer2, 50.0);
  1753.                                 }
  1754.                                 GameTextForPlayer(Boxer1, "~g~Match Over", 5000, 1); GameTextForPlayer(Boxer2, "~g~Match Over", 5000, 1);
  1755.                                 if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer2][pJob2] == 12 || PlayerInfo[Boxer2][pJob3] == 12) { PlayerInfo[Boxer2][pBoxSkill] += 1; }
  1756.                                 PlayerBoxing[Boxer1] = 0;
  1757.                                 PlayerBoxing[Boxer2] = 0;
  1758.                             }
  1759.                         }
  1760.                         else if(Lost == 2)
  1761.                         {
  1762.                             if(IsPlayerConnected(Boxer1) && IsPlayerConnected(Boxer2))
  1763.                             {
  1764.                                 if(IsPlayerInRangeOfPoint(Boxer1,25.0,768.48, -73.66, 1000.57) || IsPlayerInRangeOfPoint(Boxer2,25.0, 768.48, -73.66, 1000.57))
  1765.                                 {
  1766.                                     SetPlayerPos(Boxer1, 768.48, -73.66, 1000.57); SetPlayerPos(Boxer2, 768.48, -73.66, 1000.57);
  1767.                                     SetPlayerInterior(Boxer1, 7); SetPlayerInterior(Boxer2, 7);
  1768.                                     GetPlayerName(Boxer1, winner, sizeof(winner));
  1769.                                     GetPlayerName(Boxer2, loser, sizeof(loser));
  1770.                                     if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer2][pJob2] == 12 || PlayerInfo[Boxer2][pJob3] == 12) { PlayerInfo[Boxer2][pLoses] += 1; }
  1771.                                     if(PlayerInfo[Boxer1][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12 || PlayerInfo[Boxer1][pJob3] == 12) { PlayerInfo[Boxer1][pWins] += 1; }
  1772.                                     if(TBoxer != INVALID_PLAYER_ID)
  1773.                                     {
  1774.                                         if(IsPlayerConnected(TBoxer))
  1775.                                         {
  1776.                                             if(TBoxer != Boxer1)
  1777.                                             {
  1778.                                                 if(PlayerInfo[Boxer1][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12 || PlayerInfo[Boxer1][pJob3] == 12)
  1779.                                                 {
  1780.                                                     TBoxer = Boxer1;
  1781.                                                     GetPlayerName(TBoxer, titel, sizeof(titel));
  1782.                                                     format(szMiscArray, sizeof(szMiscArray), "%s", titel);
  1783.                                                     strmid(Titel[TitelName], szMiscArray, 0, strlen(szMiscArray), 255);
  1784.                                                     Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
  1785.                                                     Titel[TitelLoses] = PlayerInfo[TBoxer][pLoses];
  1786.                                                     Misc_Save();
  1787.                                                     format(szMiscArray, sizeof(szMiscArray), "Boxing News: %s has Won the fight against Champion %s and is now the new Boxing Champion.",  titel, loser);
  1788.                                                     ProxDetector(30.0, Boxer1, szMiscArray, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
  1789.                                                 }
  1790.                                                 else
  1791.                                                 {
  1792.                                                     SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You would have been the Champion if you had the Boxer Job!");
  1793.                                                 }
  1794.                                             }
  1795.                                             else
  1796.                                             {
  1797.                                                 GetPlayerName(TBoxer, titel, sizeof(titel));
  1798.                                                 format(szMiscArray, sizeof(szMiscArray), "Boxing News: Boxing Champion %s has Won the fight against %s.",  titel, loser);
  1799.                                                 ProxDetector(30.0, Boxer1, szMiscArray, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
  1800.                                                 Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
  1801.                                                 Titel[TitelLoses] = PlayerInfo[Boxer1][pLoses];
  1802.                                                 Misc_Save();
  1803.                                             }
  1804.                                         }
  1805.                                     }
  1806.                                     //TBoxer
  1807.                                     format(szMiscArray, sizeof(szMiscArray), "* You have Lost the Fight against %s.", winner);
  1808.                                     SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, szMiscArray);
  1809.                                     GameTextForPlayer(Boxer2, "~r~You lost", 3500, 1);
  1810.                                     format(szMiscArray, sizeof(szMiscArray), "* You have Won the Fight against %s.", loser);
  1811.                                     SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, szMiscArray);
  1812.                                     GameTextForPlayer(Boxer1, "~g~You won", 3500, 1);
  1813.                                     if(GetHealth(Boxer1, health) < 20)
  1814.                                     {
  1815.                                         SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You feel exhausted from the fight, go eat somewhere.");
  1816.                                         SetHealth(Boxer1, 30.0);
  1817.                                     }
  1818.                                     else
  1819.                                     {
  1820.                                         SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You feel perfect, even after the Fight.");
  1821.                                         SetHealth(Boxer1, 50.0);
  1822.                                     }
  1823.                                     if(GetHealth(Boxer2, health) < 20)
  1824.                                     {
  1825.                                         SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You feel exhausted from the fight, go eat somewhere.");
  1826.                                         SetHealth(Boxer2, 30.0);
  1827.                                     }
  1828.                                     else
  1829.                                     {
  1830.                                         SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You feel perfect, even after the fight.");
  1831.                                         SetHealth(Boxer2, 50.0);
  1832.                                     }
  1833.                                     GameTextForPlayer(Boxer1, "~g~Match Over", 5000, 1); GameTextForPlayer(Boxer2, "~g~Match Over", 5000, 1);
  1834.                                     if(PlayerInfo[Boxer1][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12 || PlayerInfo[Boxer1][pJob3] == 12) { PlayerInfo[Boxer1][pBoxSkill] += 1; }
  1835.                                     PlayerBoxing[Boxer1] = 0;
  1836.                                     PlayerBoxing[Boxer2] = 0;
  1837.                                 }
  1838.                                 SetPlayerPos(Boxer1, 768.48, -73.66, 1000.57);
  1839.                                 SetPlayerPos(Boxer2, 768.48, -73.66, 1000.57);
  1840.                                 SetPlayerInterior(Boxer1, 7); SetPlayerInterior(Boxer2, 7);
  1841.                                 GetPlayerName(Boxer1, winner, sizeof(winner));
  1842.                                 GetPlayerName(Boxer2, loser, sizeof(loser));
  1843.                                 if(PlayerInfo[Boxer2][pJob] == 12 || PlayerInfo[Boxer2][pJob2] == 12 || PlayerInfo[Boxer2][pJob3] == 12) { PlayerInfo[Boxer2][pLoses] += 1; }
  1844.                                 if(PlayerInfo[Boxer1][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12 || PlayerInfo[Boxer1][pJob3] == 12) { PlayerInfo[Boxer1][pWins] += 1; }
  1845.                                 if(TBoxer != INVALID_PLAYER_ID)
  1846.                                 {
  1847.                                     if(IsPlayerConnected(TBoxer))
  1848.                                     {
  1849.                                         if(TBoxer != Boxer1)
  1850.                                         {
  1851.                                             if(PlayerInfo[Boxer1][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12 || PlayerInfo[Boxer1][pJob3] == 12)
  1852.                                             {
  1853.                                                 TBoxer = Boxer1;
  1854.                                                 GetPlayerName(TBoxer, titel, sizeof(titel));
  1855.                                                 format(szMiscArray, sizeof(szMiscArray), "%s", titel);
  1856.                                                 strmid(Titel[TitelName], szMiscArray, 0, strlen(szMiscArray), 255);
  1857.                                                 Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
  1858.                                                 Titel[TitelLoses] = PlayerInfo[TBoxer][pLoses];
  1859.                                                 Misc_Save();
  1860.                                                 format(szMiscArray, sizeof(szMiscArray), "Boxing News: %s has Won the fight against Champion %s and is now the new Boxing Champion.",  titel, loser);
  1861.                                                 ProxDetector(30.0, Boxer1, szMiscArray, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
  1862.                                             }
  1863.                                             else
  1864.                                             {
  1865.                                                 SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You would have been the Champion if you had the Boxer Job!");
  1866.                                             }
  1867.                                         }
  1868.                                         else
  1869.                                         {
  1870.                                             GetPlayerName(TBoxer, titel, sizeof(titel));
  1871.                                             format(szMiscArray, sizeof(szMiscArray), "Boxing News: Boxing Champion %s has Won the fight against %s.",  titel, loser);
  1872.                                             ProxDetector(30.0, Boxer1, szMiscArray, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
  1873.                                             Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
  1874.                                             Titel[TitelLoses] = PlayerInfo[Boxer1][pLoses];
  1875.                                             Misc_Save();
  1876.                                         }
  1877.                                     }
  1878.                                 }
  1879.                                 //TBoxer
  1880.                                 format(szMiscArray, sizeof(szMiscArray), "* You have Lost the Fight against %s.", winner);
  1881.                                 SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, szMiscArray);
  1882.                                 GameTextForPlayer(Boxer2, "~r~You lost", 3500, 1);
  1883.                                 format(szMiscArray, sizeof(szMiscArray), "* You have Won the Fight against %s.", loser);
  1884.                                 SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, szMiscArray);
  1885.                                 GameTextForPlayer(Boxer1, "~g~You won", 3500, 1);
  1886.                                 if(GetHealth(Boxer1, health) < 20)
  1887.                                 {
  1888.                                     SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You feel exhausted from the Fight, go eat somewhere.");
  1889.                                     SetHealth(Boxer1, 30.0);
  1890.                                 }
  1891.                                 else
  1892.                                 {
  1893.                                     SendClientMessageEx(Boxer1, COLOR_LIGHTBLUE, "* You feel perfect, even after the Fight.");
  1894.                                     SetHealth(Boxer1, 50.0);
  1895.                                 }
  1896.                                 if(GetHealth(Boxer2, health) < 20)
  1897.                                 {
  1898.                                     SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You feel exhausted from the Fight, go eat somewhere.");
  1899.                                     SetHealth(Boxer2, 30.0);
  1900.                                 }
  1901.                                 else
  1902.                                 {
  1903.                                     SendClientMessageEx(Boxer2, COLOR_LIGHTBLUE, "* You feel perfect, even after the Fight.");
  1904.                                     SetHealth(Boxer2, 50.0);
  1905.                                 }
  1906.                                 GameTextForPlayer(Boxer1, "~g~Match Over", 5000, 1); GameTextForPlayer(Boxer2, "~g~Match Over", 5000, 1);
  1907.                                 if(PlayerInfo[Boxer1][pJob] == 12 || PlayerInfo[Boxer1][pJob2] == 12 || PlayerInfo[Boxer1][pJob3] == 12) { PlayerInfo[Boxer1][pBoxSkill] += 1; }
  1908.                                 PlayerBoxing[Boxer1] = 0;
  1909.                                 PlayerBoxing[Boxer2] = 0;
  1910.                             }
  1911.                         }
  1912.                         InRing = 0;
  1913.                         RoundStarted = 0;
  1914.                         Boxer1 = INVALID_PLAYER_ID;
  1915.                         Boxer2 = INVALID_PLAYER_ID;
  1916.                         TBoxer = INVALID_PLAYER_ID;
  1917.                         trigger = 0;
  1918.                     }
  1919.                 }
  1920.             }
  1921.             if(FindTime[i] >= 1)
  1922.             {
  1923.                 if(FindTime[i] == FindTimePoints[i]) {
  1924.                     FindTime[i] = 0;
  1925.                     FindTimePoints[i] = 0;
  1926.                     SetPlayerToTeamColor(FindingPlayer[i]);
  1927.                     FindingPlayer[i] = -1;
  1928.                     PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  1929.                     GameTextForPlayer(i, "~r~Signal lost", 2500, 1);
  1930.                 }
  1931.                 else
  1932.                 {
  1933.                     format(szMiscArray, sizeof(szMiscArray), "%d", FindTimePoints[i] - FindTime[i]);
  1934.                     GameTextForPlayer(i, szMiscArray, 1500, 6);
  1935.                     FindTime[i] += 1;
  1936.                 }
  1937.             }
  1938.             if(CalledCops[i] >= 1)
  1939.             {
  1940.                 if(CopsCallTime[i] < 1) { CopsCallTime[i] = 0; HidePlayerBeaconForCops(i); CalledCops[i] = 0; }
  1941.                 else
  1942.                 {
  1943.                     CopsCallTime[i]--;
  1944.                 }
  1945.             }
  1946.             if(CalledMedics[i] >= 1)
  1947.             {
  1948.                 if(MedicsCallTime[i] < 1) { MedicsCallTime[i] = 0; HidePlayerBeaconForMedics(i); CalledMedics[i] = 0; }
  1949.                 else
  1950.                 {
  1951.                     MedicsCallTime[i]--;
  1952.                 }
  1953.             }
  1954.             if(JustReported[i] > 0)
  1955.             {
  1956.                 JustReported[i]--;
  1957.             }
  1958.             if(TaxiCallTime[i] > 0)
  1959.             {
  1960.                 if(TaxiAccepted[i] != INVALID_PLAYER_ID)
  1961.                 {
  1962.                     if(IsPlayerConnected(TaxiAccepted[i]))
  1963.                     {
  1964.                         new Float:X,Float:Y,Float:Z;
  1965.                         GetPlayerPos(TaxiAccepted[i], X, Y, Z);
  1966.                         SetPlayerCheckpoint(i, X, Y, Z, 5);
  1967.                     }
  1968.                 }
  1969.             }
  1970.             if(EMSCallTime[i] > 0)
  1971.             {
  1972.                 if(EMSAccepted[i] != INVALID_PLAYER_ID)
  1973.                 {
  1974.                     if(IsPlayerConnected(EMSAccepted[i]))
  1975.                     {
  1976.                         if(!GetPlayerInterior(EMSAccepted[i])) {
  1977.  
  1978.                             new Float:X,Float:Y,Float:Z;
  1979.                             GetPlayerPos(EMSAccepted[i], X, Y, Z);
  1980.                             new zone[MAX_ZONE_NAME];
  1981.                             Get3DZone(X, Y, Z, zone, sizeof(zone));
  1982.                             format(szMiscArray, sizeof(szMiscArray), "Your patient is located in %s.", zone);
  1983.                             SetPlayerCheckpoint(i, X, Y, Z, 5);
  1984.                         }
  1985.                     }
  1986.                 }
  1987.             }
  1988.  
  1989.             if(BusCallTime[i] > 0)
  1990.             {
  1991.                 if(BusAccepted[i] != INVALID_PLAYER_ID)
  1992.                 {
  1993.                     if(IsPlayerConnected(BusAccepted[i]))
  1994.                     {
  1995.                         new Float:X,Float:Y,Float:Z;
  1996.                         GetPlayerPos(BusAccepted[i], X, Y, Z);
  1997.                         SetPlayerCheckpoint(i, X, Y, Z, 5);
  1998.                     }
  1999.                 }
  2000.             }
  2001.             if(MedicCallTime[i] > 0)
  2002.             {
  2003.                 // if(MedicCallTime[i] == 45) { MedicCallTime[i] = 0; DisablePlayerCheckpoint(i); PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0); GameTextForPlayer(i, "~r~RedMarker gone", 2500, 1); }
  2004.                 // else
  2005.                 {
  2006.                     format(szMiscArray, sizeof(szMiscArray), "%d", 45 - MedicCallTime[i]);
  2007.                     new Float:X,Float:Y,Float:Z;
  2008.                     GetPlayerPos(MedicAccepted[i], X, Y, Z);
  2009.                     SetPlayerCheckpoint(i, X, Y, Z, 5);
  2010.                     GameTextForPlayer(i, szMiscArray, 1500, 6);
  2011.                     MedicCallTime[i] += 1;
  2012.                 }
  2013.             }
  2014.             if(MechanicCallTime[i] > 0)
  2015.             {
  2016.                 if(MechanicCallTime[i] == 30) { MechanicCallTime[i] = 0; DisablePlayerCheckpoint(i); PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0); GameTextForPlayer(i, "~r~RedMarker gone", 2500, 1); }
  2017.                 else
  2018.                 {
  2019.                     format(szMiscArray, sizeof(szMiscArray), "%d", 30 - MechanicCallTime[i]);
  2020.                     GameTextForPlayer(i, szMiscArray, 1500, 6);
  2021.                     MechanicCallTime[i] += 1;
  2022.                 }
  2023.             }
  2024.             if(PlayerCuffed[i] == 1)
  2025.             {
  2026.                 if(PlayerCuffedTime[i] <= 0)
  2027.                 {
  2028.                     //Frozen[i] = 0;
  2029.                     DeletePVar(i, "IsFrozen");
  2030.                     TogglePlayerControllable(i, 1);
  2031.                     PlayerCuffed[i] = 0;
  2032.                     DeletePVar(i, "PlayerCuffed");
  2033.                     PlayerCuffedTime[i] = 0;
  2034.                     ClearAnimationsEx(i);
  2035.                     new Float:X, Float:Y, Float:Z;
  2036.                     GetPlayerPos(i, X, Y, Z);
  2037.                     SetPlayerPos(i, X, Y, Z);
  2038.                     SetPlayerDrunkLevel(i, 0);
  2039.                 }
  2040.                 else
  2041.                 {
  2042.                     if(playerTabbed[i] == 0)
  2043.                     {
  2044.                         PlayerCuffedTime[i] -= 1;
  2045.                         SetPlayerDrunkLevel(i, 10000);
  2046.                     }
  2047.                 }
  2048.             }
  2049.             if(PlayerCuffed[i] == 2)
  2050.             {
  2051.                 if(PlayerCuffedTime[i] <= 0)
  2052.                 {
  2053.                     new Float:X, Float:Y, Float:Z;
  2054.                     GetPlayerPos(i, X, Y, Z);
  2055.                     new copinrange;
  2056.                     foreach(new j: Player)
  2057.                     {
  2058.                         if(IsPlayerInRangeOfPoint(j, 15, X, Y, Z) && IsACop(j))
  2059.                         {
  2060.                             copinrange = 1;
  2061.                         }
  2062.                     }
  2063.  
  2064.                     if(copinrange == 0)
  2065.                     {
  2066.                         //Frozen[i] = 0;
  2067.                         DeletePVar(i, "IsFrozen");
  2068.                         GameTextForPlayer(i, "~r~No-one is looking, run!", 2500, 3);
  2069.                         TogglePlayerControllable(i, 1);
  2070.                         PlayerCuffed[i] = 3;
  2071.                         //SetHealth(i, GetPVarFloat(i, "cuffhealth"));
  2072.                         //SetArmour(i, GetPVarFloat(i, "cuffarmor"));
  2073.                         //DeletePVar(i, "cuffhealth");
  2074.                         //DeletePVar(i, "PlayerCuffed");
  2075.                         PlayerCuffedTime[i] = 180;
  2076.                         //SetPlayerSpecialAction(i, SPECIAL_ACTION_NONE);
  2077.                         //ClearAnimationsEx(i);
  2078.                     }
  2079.                     else
  2080.                     {
  2081.                         PlayerCuffedTime[i] = 60;
  2082.                     }
  2083.                 }
  2084.                 else
  2085.                 {
  2086.                     if(playerTabbed[i] == 0)
  2087.                     {
  2088.                         PlayerCuffedTime[i] -= 1;
  2089.                     }
  2090.                 }
  2091.             }
  2092.             if(PlayerCuffed[i] == 3)
  2093.             {
  2094.                 new Float:X, Float:Y, Float:Z;
  2095.                 GetPlayerPos(i, X, Y, Z);
  2096.                 new copinrange;
  2097.                 foreach(new j: Player)
  2098.                 {
  2099.                     if(IsPlayerInRangeOfPoint(j, 4, X, Y, Z) && IsACop(j))
  2100.                     {
  2101.                         copinrange = 1;
  2102.                     }
  2103.                 }
  2104.  
  2105.                 if(copinrange == 1) {
  2106.                     TogglePlayerControllable(i, 0);
  2107.                     PlayerCuffed[i] = 2;
  2108.                     GameTextForPlayer(i, "~r~They caught you again!", 2500, 3);
  2109.                 }
  2110.  
  2111.                 if(PlayerCuffedTime[i] <= 0)
  2112.                 {
  2113.  
  2114.                     if(copinrange == 0)
  2115.                     {
  2116.                         //Frozen[i] = 0;
  2117.                         DeletePVar(i, "IsFrozen");
  2118.                         GameTextForPlayer(i, "~r~The cuffs broke!", 2500, 3);
  2119.                         TogglePlayerControllable(i, 1);
  2120.                         PlayerCuffed[i] = 0;
  2121.                         SetHealth(i, GetPVarFloat(i, "cuffhealth"));
  2122.                         SetArmour(i, GetPVarFloat(i, "cuffarmor"));
  2123.                         DeletePVar(i, "cuffhealth");
  2124.                         DeletePVar(i, "PlayerCuffed");
  2125.                         PlayerCuffedTime[i] = 0;
  2126.                         SetPlayerSpecialAction(i, SPECIAL_ACTION_NONE);
  2127.                         ClearAnimationsEx(i);
  2128.                     }
  2129.                 }
  2130.                 else
  2131.                 {
  2132.                     if(playerTabbed[i] == 0)
  2133.                     {
  2134.                         if(copinrange == 0) PlayerCuffedTime[i] -= 1;
  2135.                     }
  2136.                 }
  2137.             }
  2138.             UpdateSpeedCamerasForPlayer(i);
  2139.         }
  2140.  
  2141.         if (GetPVarInt(i, "_BoxingQueue") == 1)
  2142.         {
  2143.             SetPVarInt(i, "_BoxingQueueTick", GetPVarInt(i, "_BoxingQueueTick") + 1);
  2144.             new tick = GetPVarInt(i, "_BoxingQueueTick");
  2145.  
  2146.             if (tick == 10)
  2147.             {
  2148.                 SetPVarInt(i, "_BoxingQueueTick", 1);
  2149.  
  2150.                 foreach(new ii: Player)
  2151.                 {
  2152.                     if (GetPVarInt(ii, "_BoxingQueue") == 1 && i != ii)
  2153.                     {
  2154.                         new biz = InBusiness(i),
  2155.                             biz2 = InBusiness(ii);
  2156.  
  2157.                         if(biz == biz2)
  2158.                         {
  2159.                             if (Businesses[biz][bGymBoxingArena1][0] == INVALID_PLAYER_ID)
  2160.                             {
  2161.                                 Businesses[biz][bGymBoxingArena1][0] = i;
  2162.                                 Businesses[biz][bGymBoxingArena1][1] = ii;
  2163.  
  2164.                                 DeletePVar(i, "_BoxingQueue");
  2165.                                 DeletePVar(i, "_BoxingQueueTick");
  2166.                                 DeletePVar(ii, "_BoxingQueue");
  2167.                                 DeletePVar(ii, "_BoxingQueueTick");
  2168.  
  2169.                                 SetPlayerPos(i, 2924.0735, -2293.3145, 8.0905);
  2170.                                 SetPlayerFacingAngle(i, 136.0062);
  2171.                                 SetPlayerPos(ii, 2920.4709, -2296.9460, 8.0905);
  2172.                                 SetPlayerFacingAngle(ii, 308.0462);
  2173.  
  2174.                                 new Float:health, Float:armour;
  2175.  
  2176.                                 GetHealth(i, health);
  2177.                                 GetArmour(i, armour);
  2178.                                 SetPVarFloat(i, "_BoxingCacheHP", health);
  2179.                                 SetPVarFloat(i, "_BoxingCacheArmour", armour);
  2180.  
  2181.                                 GetHealth(ii, health);
  2182.                                 GetArmour(ii, armour);
  2183.                                 SetPVarFloat(ii, "_BoxingCacheHP", health);
  2184.                                 SetPVarFloat(ii, "_BoxingCacheArmour", armour);
  2185.  
  2186.                                 SetHealth(i, 100.0);
  2187.                                 SetHealth(ii, 100.0);
  2188.                                 RemoveArmor(i);
  2189.                                 RemoveArmor(ii);
  2190.  
  2191.                                 ResetPlayerWeapons(i);
  2192.                                 ResetPlayerWeapons(ii);
  2193.  
  2194.                                 TogglePlayerControllable(i, 0);
  2195.                                 TogglePlayerControllable(ii, 0);
  2196.  
  2197.                                 SetPVarInt(i, "_BoxingFight", ii + 1);
  2198.                                 SetPVarInt(ii, "_BoxingFight", i + 1);
  2199.                                 SetPVarInt(i, "_BoxingFightCountdown", 4);
  2200.  
  2201.                                 format(szMiscArray, sizeof(szMiscArray), "You are now in a boxing match with %s.", GetPlayerNameEx(ii));
  2202.                                 SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  2203.                                 format(szMiscArray, sizeof(szMiscArray), "You are now in a boxing match with %s.", GetPlayerNameEx(i));
  2204.                                 SendClientMessageEx(ii, COLOR_WHITE, szMiscArray);
  2205.                                 break;
  2206.                             }
  2207.                             else if (Businesses[biz][bGymBoxingArena2][0] == INVALID_PLAYER_ID)
  2208.                             {
  2209.                                 Businesses[biz][bGymBoxingArena2][0] = i;
  2210.                                 Businesses[biz][bGymBoxingArena2][1] = ii;
  2211.  
  2212.                                 DeletePVar(i, "_BoxingQueue");
  2213.                                 DeletePVar(i, "_BoxingQueueTick");
  2214.                                 DeletePVar(ii, "_BoxingQueue");
  2215.                                 DeletePVar(ii, "_BoxingQueueTick");
  2216.  
  2217.                                 SetPlayerPos(i, 2920.6958, -2257.4312, 8.0905);
  2218.                                 SetPlayerFacingAngle(i, 310.5444);
  2219.                                 SetPlayerPos(ii, 2924.3989, -2253.8279, 8.0905);
  2220.                                 SetPlayerFacingAngle(ii, 134.5329);
  2221.  
  2222.                                 new Float:health, Float:armour;
  2223.  
  2224.                                 GetHealth(i, health);
  2225.                                 GetArmour(i, armour);
  2226.                                 SetPVarFloat(i, "_BoxingCacheHP", health);
  2227.                                 SetPVarFloat(i, "_BoxingCacheArmour", armour);
  2228.  
  2229.                                 GetHealth(ii, health);
  2230.                                 GetArmour(ii, armour);
  2231.                                 SetPVarFloat(ii, "_BoxingCacheHP", health);
  2232.                                 SetPVarFloat(ii, "_BoxingCacheArmour", armour);
  2233.  
  2234.                                 ResetPlayerWeapons(i);
  2235.                                 ResetPlayerWeapons(ii);
  2236.  
  2237.                                 SetHealth(i, 100.0);
  2238.                                 SetHealth(ii, 100.0);
  2239.                                 RemoveArmor(i);
  2240.                                 RemoveArmor(ii);
  2241.  
  2242.                                 TogglePlayerControllable(i, 0);
  2243.                                 TogglePlayerControllable(ii, 0);
  2244.  
  2245.                                 SetPVarInt(i, "_BoxingFight", ii + 1);
  2246.                                 SetPVarInt(ii, "_BoxingFight", i + 1);
  2247.                                 SetPVarInt(i, "_BoxingFightCountdown", 4);
  2248.  
  2249.                                 format(szMiscArray, sizeof(szMiscArray), "You are now in a boxing match with %s.", GetPlayerNameEx(ii));
  2250.                                 SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  2251.                                 format(szMiscArray, sizeof(szMiscArray), "You are now in a boxing match with %s.", GetPlayerNameEx(i));
  2252.                                 SendClientMessageEx(ii, COLOR_WHITE, szMiscArray);
  2253.                                 break;
  2254.                             }
  2255.                             else // NO ARENA AVAILABLE
  2256.                             {
  2257.                             }
  2258.                         }
  2259.                     }
  2260.                 }
  2261.             }
  2262.         }
  2263.         else if (GetPVarInt(i, "_BoxingFightCountdown") >= 1)
  2264.         {
  2265.             new countdown = GetPVarInt(i, "_BoxingFightCountdown");
  2266.             new ii = GetPVarInt(i, "_BoxingFight") - 1;
  2267.  
  2268.             if (countdown == 4)
  2269.             {
  2270.                 SendClientMessageEx(playerid, COLOR_RED, "3..");
  2271.                 SendClientMessageEx(ii, COLOR_RED, "3..");
  2272.                 SetPVarInt(i, "_BoxingFightCountdown", 3);
  2273.             }
  2274.             else if (countdown == 3)
  2275.             {
  2276.                 SendClientMessageEx(playerid, COLOR_RED, "2..");
  2277.                 SendClientMessageEx(ii, COLOR_RED, "2..");
  2278.                 SetPVarInt(i, "_BoxingFightCountdown", 2);
  2279.             }
  2280.             else if (countdown == 2)
  2281.             {
  2282.                 SendClientMessageEx(playerid, COLOR_RED, "1..");
  2283.                 SendClientMessageEx(ii, COLOR_RED, "1..");
  2284.                 SetPVarInt(i, "_BoxingFightCountdown", 1);
  2285.             }
  2286.             else if (countdown == 1)
  2287.             {
  2288.                 SendClientMessageEx(playerid, COLOR_RED, "Fight!");
  2289.                 SendClientMessageEx(ii, COLOR_RED, "Fight!");
  2290.                 DeletePVar(i, "_BoxingFightCountdown");
  2291.                 TogglePlayerControllable(i, 1);
  2292.                 TogglePlayerControllable(ii, 1);
  2293.             }
  2294.         }
  2295.         if(GetPVarInt(i, "_BoxingFightOver") != 0 && gettime() >= GetPVarInt(i, "_BoxingFightOver"))
  2296.         {
  2297.             if (GetPVarInt(i, "Injured") == 1)
  2298.             {
  2299.                 KillEMSQueue(i);
  2300.                 ClearAnimationsEx(i);
  2301.                 new biz = InBusiness(i);
  2302.  
  2303.                 if (Businesses[biz][bGymBoxingArena1][0] == i || Businesses[biz][bGymBoxingArena1][1] == i) // first arena
  2304.                 {
  2305.                     Businesses[biz][bGymBoxingArena1][0] = INVALID_PLAYER_ID;
  2306.                     Businesses[biz][bGymBoxingArena1][1] = INVALID_PLAYER_ID;
  2307.                 }
  2308.                 else if (Businesses[biz][bGymBoxingArena2][0] == i || Businesses[biz][bGymBoxingArena2][1] == i) // second arena
  2309.                 {
  2310.                     Businesses[biz][bGymBoxingArena2][0] = INVALID_PLAYER_ID;
  2311.                     Businesses[biz][bGymBoxingArena2][1] = INVALID_PLAYER_ID;
  2312.                 }
  2313.             }
  2314.             else SetPlayerPos(i, 2907.50, -2275.39, 7.25);
  2315.  
  2316.             SetHealth(i, GetPVarFloat(i, "_BoxingCacheHP"));
  2317.             SetArmour(i, GetPVarFloat(i, "_BoxingCacheArmour"));
  2318.             DeletePVar(i, "_BoxingCacheHP");
  2319.             DeletePVar(i, "_BoxingCacheArmour");
  2320.             DeletePVar(i, "_BoxingFightOver");
  2321.             SetPlayerWeapons(i);
  2322.         }
  2323.         if(GetPVarInt(i, "BackpackDisabled") > 0) SetPVarInt(i, "BackpackDisabled", GetPVarInt(i, "BackpackDisabled")-1);
  2324.         else DeletePVar(i, "BackpackDisabled");
  2325.  
  2326.         // ServerHeartBeatTwo (merged by Jingles)
  2327.         if(IsPlayerInAnyVehicle(i)) {
  2328.             if(GetPlayerState(i) == PLAYER_STATE_DRIVER) SetPlayerArmedWeapon(i, 0);
  2329.             else if(!IsADriveByWeapon(GetPlayerWeapon(i)) && !IsADriveByWeapon(GetPVarInt(i, "LastWeapon"))) SetPlayerArmedWeapon(i,0);
  2330.         }
  2331.         if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && JetPack[i] == 0 && PlayerInfo[i][pAdmin] < 4)
  2332.         {
  2333.             if(GetPVarType(i, "Autoban")) return 1;
  2334.             SetPVarInt(i, "Autoban", 1);
  2335.             CreateBan(INVALID_PLAYER_ID, PlayerInfo[i][pId], i, PlayerInfo[i][pIP], "Jetpack Hacking", 180);
  2336.             TotalAutoBan++;
  2337.         }
  2338.  
  2339.         if(CellTime[i] > 0 && 0 <= Mobile[i] < sizeof Mobile)
  2340.         {
  2341.             if (CellTime[i] == 60)
  2342.             {
  2343.                 CellTime[i] = 1;
  2344.                 if(Mobile[Mobile[i]] == i)
  2345.                 {
  2346.                     CallCost[i] += 10;
  2347.                 }
  2348.             }
  2349.             CellTime[i]++;
  2350.             if (Mobile[Mobile[i]] == INVALID_PLAYER_ID && CellTime[i] == 5)
  2351.             {
  2352.                 if(IsPlayerConnected(Mobile[i]))
  2353.                 {
  2354.                     new Float:rX, Float:rY, Float:rZ;
  2355.                     GetPlayerPos(i, rX, rY, rZ);
  2356.  
  2357.                     format(szMiscArray, sizeof(szMiscArray), "* %s's phone rings.", GetPlayerNameEx(Mobile[i]));
  2358.                     RingTone[Mobile[i]] = 10;
  2359.                     ProxDetector(30.0, Mobile[i], szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  2360.                 }
  2361.             }
  2362.         }
  2363.  
  2364.         if(CellTime[i] == 0 && CallCost[i] > 0)
  2365.         {
  2366.             format(szMiscArray, sizeof(szMiscArray), "~w~The call cost~n~~r~$%d",CallCost[i]);
  2367.             GivePlayerCash(i, -CallCost[i]);
  2368.             GameTextForPlayer(i, szMiscArray, 5000, 1);
  2369.             CallCost[i] = 0;
  2370.         }
  2371.  
  2372.         if(TransportDriver[i] != INVALID_PLAYER_ID)
  2373.         {
  2374.             if(GetPlayerVehicleID(i) != GetPlayerVehicleID(TransportDriver[i]) || !TransportDuty[TransportDriver[i]])
  2375.             {
  2376.                 if(IsPlayerConnected(TransportDriver[i]))
  2377.                 {
  2378.                     TransportMoney[TransportDriver[i]] += TransportCost[i];
  2379.                     TransportTime[TransportDriver[i]] = 0;
  2380.                     TransportCost[TransportDriver[i]] = 0;
  2381.  
  2382.                     format(szMiscArray, sizeof(szMiscArray), "~w~Passenger left~n~~g~Earned $%d", TransportCost[i]);
  2383.                     GameTextForPlayer(TransportDriver[i], szMiscArray, 5000, 1);
  2384.                     TransportDriver[i] = INVALID_PLAYER_ID;
  2385.                 }
  2386.             }
  2387.             else if(TransportTime[i] >= 16)
  2388.             {
  2389.                 TransportTime[i] = 1;
  2390.                 if(TransportDriver[i] != INVALID_PLAYER_ID)
  2391.                 {
  2392.                     if(IsPlayerConnected(TransportDriver[i]))
  2393.                     {
  2394.                         TransportCost[i] += TransportValue[TransportDriver[i]];
  2395.                         TransportCost[TransportDriver[i]] = TransportCost[i];
  2396.                     }
  2397.                 }
  2398.             }
  2399.             TransportTime[i] += 1;
  2400.             format(szMiscArray, sizeof(szMiscArray), "~r~%d ~w~: ~g~$%d",TransportTime[i],TransportCost[i]);
  2401.             GameTextForPlayer(i, szMiscArray, 15000, 6);
  2402.             if(TransportCost[i] > GetPlayerCash(i))
  2403.             {
  2404.                 RemovePlayerFromVehicle(i);
  2405.                 new Float:slx, Float:sly, Float:slz;
  2406.                 GetPlayerPos(i, slx, sly, slz);
  2407.                 SetPlayerPos(i, slx, sly, slz + 2);
  2408.                 GameTextForPlayer(i, "~r~You're flat out of cash!", 4000, 4);
  2409.             }
  2410.         }
  2411.  
  2412.         if(GetVehicleModel(GetPlayerVehicleID(i)) != 594 && GetPVarType(i, "rccam")) {
  2413.             DestroyVehicle(GetPVarInt(i, "rcveh"));
  2414.             KillTimer(GetPVarInt(i, "rccamtimer"));
  2415.         }
  2416.     }
  2417. return 1;
  2418. }
  2419.  
  2420. // Timer Name: SyncUp()
  2421. // TickRate: 1 Minute.
  2422. task SyncUp[60000]()
  2423. {
  2424.     foreach(new i: Player)
  2425.     {
  2426.         SyncMinTime(i);
  2427.  
  2428.         if(PlayerInfo[i][pDedicatedWarn] > 0)
  2429.         {
  2430.             PlayerInfo[i][pDedicatedWarn]--;
  2431.         }
  2432.         DeliverVehicleTimer(i);
  2433.         RentVehicleTimer(i);
  2434.         SetPlayerScore(i, PlayerInfo[i][pLevel]);
  2435.         if(GetPVarInt(i, "TempLevel") > 0) { SetPlayerScore(i, GetPVarInt(i, "TempLevel")); }
  2436.         if(PlayerInfo[i][pProbationTime] > 0 && !PlayerInfo[i][pBeingSentenced])
  2437.         {
  2438.             PlayerInfo[i][pProbationTime]--;
  2439.         }
  2440.         if(PlayerInfo[i][pBeingSentenced] > 1) {
  2441.             if(--PlayerInfo[i][pBeingSentenced] == 1)
  2442.             {
  2443.                 TogglePlayerControllable(i, true);
  2444.                 DeletePVar(i, "IsFrozen");
  2445.                 //Frozen[i] = 0;
  2446.                 SetPlayerPos(i, 1415.5137,-1702.2272,13.5395);
  2447.                 SetPlayerFacingAngle(i, 240.0264);
  2448.                 SendClientMessageEx(playerid, COLOR_WHITE, "No Judge has attended your pending trial, you are free!");
  2449.                 PlayerInfo[i][pBeingSentenced] = 0;
  2450.             }
  2451.         }
  2452.         if(PlayerInfo[i][pGiftTime] > 0) {
  2453.             PlayerInfo[i][pGiftTime] -= 1;
  2454.         }
  2455.         if(PlayerInfo[i][pDefendTime] > 0) {
  2456.             PlayerInfo[i][pDefendTime] -= 1;
  2457.         }
  2458.         #if defined zombiemode
  2459.         if(GetPVarType(i, "pZombieBit"))
  2460.         {
  2461.             new Float:health;
  2462.             GetHealth(i, health);
  2463.             SetHealth(i, health - 10.0);
  2464.             SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Lost 10 health due to virus.");
  2465.             SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Seek a medic to cure you!");
  2466.         }
  2467.         #endif
  2468.         switch(GetPVarInt(i, "STD")) {
  2469.             case 1: {
  2470.                 new Float: health;
  2471.                 GetHealth(i, health);
  2472.                 SetHealth(i, health - 5.0);
  2473.                 SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Lost 4 health due to STD.");
  2474.             }
  2475.             case 2: {
  2476.                 new Float: health;
  2477.                 GetHealth(i, health);
  2478.                 SetHealth(i, health - 12.0);
  2479.                 SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Lost 8 health due to STD.");
  2480.             }
  2481.             case 3: {
  2482.                 new Float: health;
  2483.                 GetHealth(i, health);
  2484.                 SetHealth(i, health - 20.0);
  2485.                 SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Lost 12 health due to STD.");
  2486.             }
  2487.         }
  2488.         if(GetPlayerCash(i) < 0) {
  2489.             if(!GetPVarType(i, "debtMsg")) {
  2490.                 format(szMiscArray, sizeof(szMiscArray), "You're now in debt; you must repay the debt of $%s. If not, you will be arrested...", number_format(GetPlayerCash(i)));
  2491.                 SendClientMessageEx(playerid, COLOR_LIGHTRED, szMiscArray);
  2492.                 SetPVarInt(i, "debtMsg", 1);
  2493.             }
  2494.         }
  2495.         else DeletePVar(i, "debtMsg");
  2496.  
  2497.         if(PlayerInfo[i][mPurchaseCount][1] && --PlayerInfo[i][mCooldown][1] <= 0)
  2498.         {
  2499.             format(szMiscArray, sizeof(szMiscArray), "Your Job Boost has expired! Reset Info: Job: %s | Skill: %d (Level: %d)", GetJobName(PlayerInfo[i][mBoost][0]), PlayerInfo[i][mBoost][1], GetJobLevel(i, PlayerInfo[i][mBoost][0]));
  2500.             SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  2501.             format(szMiscArray, sizeof(szMiscArray), "[JOBBOOST - Expired] %s(%d) Job: %s (%d) Skill: %d (%d)", GetPlayerNameEx(i), GetPlayerSQLId(i), GetJobName(PlayerInfo[i][mBoost][0]), PlayerInfo[i][mBoost][0], PlayerInfo[i][mBoost][1], GetJobLevel(i, PlayerInfo[i][mBoost][0]));
  2502.             Log("logs/micro.log", szMiscArray);
  2503.             new skill;
  2504.             switch(PlayerInfo[i][mBoost][0])
  2505.             {
  2506.                 case 1: skill = pInfo:pDetSkill;
  2507.                 case 2: skill = pInfo:pLawSkill;
  2508.                 case 3: skill = pInfo:pSexSkill;
  2509.                 case 4: skill = pInfo:pDrugsSkill;
  2510.                 case 7: skill = pInfo:pMechSkill;
  2511.                 case 9: skill = pInfo:pArmsSkill;
  2512.                 case 12: skill = pInfo:pBoxSkill;
  2513.                 case 20: skill = pInfo:pTruckSkill;
  2514.             }
  2515.             PlayerInfo[i][pInfo:skill] = PlayerInfo[i][mBoost][1];
  2516.             PlayerInfo[i][mPurchaseCount][1] = 0;
  2517.             PlayerInfo[i][mCooldown][1] = 0;
  2518.             PlayerInfo[i][mBoost][0] = 0;
  2519.             PlayerInfo[i][mBoost][1] = 0;
  2520.         }
  2521.         if(PlayerInfo[i][mCooldown][4] && --PlayerInfo[i][mCooldown][4] <= 0)
  2522.         {
  2523.             SendClientMessageEx(playerid, COLOR_GREY, "Your Energy Bar has expired!");
  2524.             PlayerInfo[i][mCooldown][4] = 0;
  2525.         }
  2526.         if(PlayerInfo[i][mPurchaseCount][12] && --PlayerInfo[i][mCooldown][12] <= 0)
  2527.         {
  2528.             SendClientMessageEx(playerid, COLOR_GREY, "Your Quick Bank Access has expired!");
  2529.             PlayerInfo[i][mPurchaseCount][12] = 0;
  2530.             PlayerInfo[i][mCooldown][12] = 0;
  2531.         }
  2532.         if(PlayerInfo[i][pBuddyInvited] == 1 && --PlayerInfo[i][pTempVIP] <= 0)
  2533.         {
  2534.             PlayerInfo[i][pTempVIP] = 0;
  2535.             PlayerInfo[i][pBuddyInvited] = 0;
  2536.             PlayerInfo[i][pDonateRank] = 0;
  2537.             SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Your temporary VIP subscription has expired.");
  2538.             SetPlayerToTeamColor(i);
  2539.         }
  2540.         /*if(PlayerInfo[i][pBuddyInvited] == 1 && PlayerInfo[i][pTempVIP] == 15 && !PlayerInfo[i][pShopNotice])
  2541.         {
  2542.             PlayerTextDrawSetString(i, MicroNotice[i], ShopMsg[4]);
  2543.             PlayerTextDrawShow(i, MicroNotice[i]);
  2544.             SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", i, _:MicroNotice[i]);
  2545.         }*/
  2546.     }
  2547. }
  2548. // Player Task Name: AFKUpdate()
  2549. // TickRate: 10 Secs.
  2550. ptask AFKUpdate[10000](i)
  2551. {
  2552.     if(Iter_Count(Player) > MAX_PLAYERS - 100)
  2553.     {
  2554.         if((playerTabbed[i] > 300 || playerAFK[i] > 300) && PlayerInfo[i][pShopTech] < 1 && PlayerInfo[i][pAdmin] < 4)
  2555.         {
  2556.             Kick(i);
  2557.         }
  2558.     }
  2559.     return 1;
  2560. }
  2561.  
  2562. // Timer Name: SaveAccountsUpdate()
  2563. // TickRate: 5 Minutes.
  2564. task SaveAccountsUpdate[900000]()
  2565. {
  2566.     foreach(new i: Player)
  2567.     {
  2568.         if(gPlayerLogged{i}) {
  2569.             SetPVarInt(i, "AccountSaving", 1);
  2570.             OnPlayerStatsUpdate(i);
  2571.             break; // We only need to save one person at a time.
  2572.         }
  2573.     }
  2574. }
  2575.  
  2576. ptask PlayerUpdate[1000](i) {
  2577.  
  2578.     if(gPlayerLogged{i})
  2579.     {
  2580.         if(IsSpawned[i] == 0 && PlayerInfo[i][pAdmin] < 1337)
  2581.         {
  2582.             SpawnKick[i]++;
  2583.             if(SpawnKick[i] >= 120)
  2584.             {
  2585.                 IsSpawned[i] = 1;
  2586.                 SpawnKick[i] = 0;
  2587.                 new string[128];
  2588.                 SendClientMessageEx(playerid, COLOR_WHITE, "SERVER: You have been kicked for being AFK.");
  2589.                 format(string, sizeof(string), " %s(%d) (ID: %d) (IP: %s) has been kicked for not being spawned over 2 minutes.", GetPlayerNameEx(i), GetPlayerSQLId(i), i, GetPlayerIpEx(i));
  2590.                 Log("logs/spawnafk.log", string);
  2591.                 SetTimerEx("KickEx", 1000, 0, "i", i);
  2592.             }
  2593.         }
  2594.         if(IsSpawned[i] > 0 && SpawnKick[i] > 0)
  2595.         {
  2596.             SpawnKick[i] = 0;
  2597.         }
  2598.         if(GetPlayerPing(i) > MAX_PING)
  2599.         {
  2600.             if(playerTabbed[i] == 0)
  2601.             {
  2602.                 if(GetPVarInt(i, "BeingKicked") != 1)
  2603.                 {
  2604.                     new
  2605.                         string[89 + MAX_PLAYER_NAME], ping;
  2606.  
  2607.                     ping = GetPlayerPing(i);
  2608.                     if(ping != 65535) // Invalid Ping
  2609.                     {
  2610.                         format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has just been kicked for %d ping (maximum: "#MAX_PING").", GetPlayerNameEx(i), ping);
  2611.                         ABroadCast(COLOR_YELLOW, string, 2);
  2612.                         SendClientMessageEx(playerid, COLOR_WHITE, "You have been kicked because your ping is higher than the maximum.");
  2613.                         SetPVarInt(i, "BeingKicked", 1);
  2614.                         SetTimerEx("KickEx", 1000, 0, "i", i);
  2615.                     }
  2616.                 }
  2617.             }
  2618.         }
  2619.         if(rBigEarT[i] > 0) {
  2620.             rBigEarT[i]--;
  2621.             if(rBigEarT[i] == 0) {
  2622.                 DeletePVar(i, "BigEar");
  2623.                 DeletePVar(i, "BigEarPlayer");
  2624.                 SendClientMessageEx(playerid, COLOR_WHITE, "Big Ears has been turned off.");
  2625.             }
  2626.         }
  2627.         if(PlayerInfo[i][pTriageTime] != 0)
  2628.         {
  2629.             PlayerInfo[i][pTriageTime]--;
  2630.         }
  2631.         if(PlayerInfo[i][pTicketTime] != 0)
  2632.         {
  2633.             PlayerInfo[i][pTicketTime]--;
  2634.         }
  2635.         if(GetPVarInt(i, "InRangeBackup") > 0)
  2636.         {
  2637.             SetPVarInt(i, "InRangeBackup", GetPVarInt(i, "InRangeBackup")-1);
  2638.         }
  2639.         if(GetPVarType(i, "IsTackled"))
  2640.         {
  2641.             new copcount, string[128];
  2642.             foreach(new j: Player)
  2643.             {
  2644.                 if(ProxDetectorS(4.0, i, j) && IsACop(j) && j != i)
  2645.                 {
  2646.                     copcount++;
  2647.                 }
  2648.             }
  2649.             if(copcount == 0 || !ProxDetectorS(5.0, i, GetPVarInt(i, "IsTackled")))
  2650.             {
  2651.                 SendClientMessageEx(playerid, COLOR_GREEN, "You're able to escape due to the cops leaving you unrestrained.");
  2652.                 ClearTackle(i);
  2653.             }
  2654.             if(GetPVarInt(i, "TackleCooldown") > 0)
  2655.             {
  2656.                 if(IsPlayerConnected(GetPVarInt(i, "IsTackled")) && GetPVarInt(GetPVarInt(i, "IsTackled"), "Tackling") == i)
  2657.                 {
  2658.                     format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~%d", GetPVarInt(i, "TackleCooldown"));
  2659.                     GameTextForPlayer(i, string, 1100, 3);
  2660.                     SetPVarInt(i, "TackleCooldown", GetPVarInt(i, "TackleCooldown")-1);
  2661.                     if(GetPVarInt(i, "TackledResisting") == 2 && copcount <= 2 && GetPVarInt(i, "TackleCooldown") < 12) // resisting
  2662.                     {
  2663.                         new escapechance = random(100);
  2664.                         switch(escapechance)
  2665.                         {
  2666.                             case 35,40,22,72,11..16, 62..64:
  2667.                             {
  2668.                                 GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~ESCAPE!", 10000, 3);
  2669.                                 SendClientMessageEx(playerid, COLOR_GREEN, "You're able to push the officer off you and escape.");
  2670.                                 format(string, sizeof(string), "** %s pushes %s aside and is able to escape.", GetPlayerNameEx(i), GetPlayerNameEx(GetPVarInt(i, "IsTackled")));
  2671.                                 ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  2672.                                 TogglePlayerControllable(GetPVarInt(i, "IsTackled"), 0);
  2673.                                 ApplyAnimation(GetPVarInt(i, "IsTackled"), "SWEET", "Sweet_injuredloop", 4.0, 1, 1, 1, 1, 0, 1);
  2674.                                 SetTimerEx("CopGetUp", 2500, 0, "i", GetPVarInt(i, "IsTackled"));
  2675.                                 ClearTackle(i);
  2676.                             }
  2677.                         }
  2678.                     }
  2679.                     else if(GetPVarInt(i, "TackledResisting") == 2 && copcount <= 3 && GetPVarInt(i, "TackleCooldown") < 12) // resisting
  2680.                     {
  2681.                         new escapechance = random(100);
  2682.                         switch(escapechance)
  2683.                         {
  2684.                             case 35,40,22,62:
  2685.                             {
  2686.                                 GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~ESCAPE!", 10000, 3);
  2687.                                 SendClientMessageEx(playerid, COLOR_GREEN, "You're able to push the officer off you and escape.");
  2688.                                 format(string, sizeof(string), "** %s pushes %s aside and is able to escape.", GetPlayerNameEx(i), GetPlayerNameEx(GetPVarInt(i, "IsTackled")));
  2689.                                 ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  2690.                                 TogglePlayerControllable(GetPVarInt(i, "IsTackled"), 0);
  2691.                                 ApplyAnimation(GetPVarInt(i, "IsTackled"), "SWEET", "Sweet_injuredloop", 4.0, 1, 1, 1, 1, 0, 1);
  2692.                                 SetTimerEx("CopGetUp", 2500, 0, "i", GetPVarInt(i, "IsTackled"));
  2693.                                 ClearTackle(i);
  2694.                             }
  2695.                         }
  2696.                     }
  2697.                 }
  2698.             }
  2699.             else
  2700.             {
  2701.                 if(ProxDetectorS(5.0, i, GetPVarInt(i, "IsTackled")))
  2702.                 {
  2703.                     CopGetUp(GetPVarInt(i, "IsTackled"));
  2704.                 }
  2705.                 SetPVarInt(GetPVarInt(i, "IsTackled"), "CopTackleCooldown", 30);
  2706.                 ShowPlayerDialogEx(i, -1, DIALOG_STYLE_LIST, "Close", "Close", "Close", "Close");
  2707.                 ClearTackle(i);
  2708.             }
  2709.         }
  2710.         if(GetPVarInt(i, "CopTackleCooldown") > 0)
  2711.         {
  2712.             SetPVarInt(i, "CopTackleCooldown", GetPVarInt(i, "CopTackleCooldown")-1);
  2713.         }
  2714.         if(GetPVarInt(i, "CantBeTackledCount") > 0)
  2715.         {
  2716.             SetPVarInt(i, "CantBeTackledCount", GetPVarInt(i, "CantBeTackledCount")-1);
  2717.         }
  2718.         if(PlayerInfo[i][pCash] != GetPlayerMoney(i))
  2719.         {
  2720.             ResetPlayerMoney(i);
  2721.             GivePlayerMoney(i, PlayerInfo[i][pCash]);
  2722.         }
  2723.         if(PlayerInfo[i][pGPS] > 0 && GetPVarType(i, "gpsonoff"))
  2724.         {
  2725.             new zone[28];
  2726.             GetPlayer3DZone(i, zone, MAX_ZONE_NAME);
  2727.             PlayerTextDrawSetString(i, GPS[i], zone);
  2728.         }
  2729.         if(GetPVarType(i, "Injured")) SetPlayerArmedWeapon(i, 0);
  2730.         if(GetPVarType(i, "IsFrozen")) TogglePlayerControllable(i, 0);
  2731.         if(PlayerCuffed[i] > 1) {
  2732.             SetHealth(i, 1000);
  2733.             SetArmour(i, GetPVarFloat(i, "cuffarmor"));
  2734.         }
  2735.         if(IsPlayerInAnyVehicle(i) && TruckUsed[i] != INVALID_VEHICLE_ID)
  2736.         {
  2737.             if(TruckUsed[i] == GetPlayerVehicleID(i) && GetPVarInt(i, "Gas_TrailerID") != 0)
  2738.             {
  2739.                 if((0 <= TruckDeliveringTo[TruckUsed[i]] < MAX_BUSINESSES) && Businesses[TruckDeliveringTo[TruckUsed[i]]][bType] == BUSINESS_TYPE_GASSTATION)
  2740.                 {
  2741.                     if(GetVehicleTrailer(GetPlayerVehicleID(i)) != GetPVarInt(i, "Gas_TrailerID"))
  2742.                     {
  2743.                         SetPVarInt(i, "GasWarnings", GetPVarInt(i, "GasWarnings") + 1);
  2744.                         if(GetPVarInt(i, "GasWarnings") > 10)
  2745.                         {
  2746.                             CancelTruckDelivery(i);
  2747.                             DeletePVar(i, "GasWarnings");
  2748.                             SendClientMessageEx(playerid, COLOR_REALRED, "You have failed your delivery as you lost your load!");
  2749.                         }
  2750.                     }
  2751.                 } else {
  2752.                     CancelTruckDelivery(i);
  2753.                     SendClientMessageEx(playerid, COLOR_REALRED, "There was an issue with the delivery unknown bussiness specified.");
  2754.                 }
  2755.             }
  2756.         }
  2757.     }
  2758. }
  2759.  
  2760. // Timer Name: EMSUpdate()
  2761. // TickRate: 5 secs.
  2762. ptask EMSUpdate[5000](i) {
  2763.    
  2764.     if(GetPlayerVirtualWorld(i) < 6000) TextDrawHideForPlayer(i, g_tHouseLights);
  2765.     if(GetPVarType(i, "Injured"))
  2766.     {
  2767.         #if defined zombiemode
  2768.         if(zombieevent == 1 && GetPVarType(i, "pZombieBit"))
  2769.         {
  2770.             KillEMSQueue(i);
  2771.             ClearAnimationsEx(i);
  2772.             MakeZombie(i);
  2773.         }
  2774.         #endif
  2775.         if(GetPVarInt(i, "EMSAttempt") != 0)
  2776.         {
  2777.  
  2778.             new Float:health;
  2779.             GetHealth(i,health);
  2780.             if(PlayerInfo[i][mCooldown][4])
  2781.             {
  2782.                 if(!GetPVarType(i, "_energybar")) SetPVarInt(i, "_energybar", 60);
  2783.                 if(GetPVarType(i, "_energybar") && GetPVarInt(i, "_energybar")) SetPVarInt(i, "_energybar", GetPVarInt(i, "_energybar")-1);
  2784.                 else SetHealth(i, health-1);
  2785.             }
  2786.             else SetHealth(i, health-1);
  2787.             if(GetPVarInt(i, "EMSAttempt") == -1)
  2788.             {
  2789.                 // if(GetPlayerAnimationIndex(i) != 746) ClearAnimationsEx(i), PlayDeathAnimation(i);
  2790.                 if(!GetPVarType(i, "StreamPrep") && !IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")) && !GetPVarInt(i, "OnStretcher"))
  2791.                 {
  2792.                     SendClientMessageEx(playerid, COLOR_WHITE, "You fell unconscious, you were immediately sent to the hospital.");
  2793.                     KillEMSQueue(i);
  2794.                     SpawnPlayer(i);
  2795.                 }
  2796.                 GameTextForPlayer(i, "~r~Injured~n~~w~/accept death or /service ems", 5000, 3);
  2797.             }
  2798.             if(GetPVarInt(i, "EMSAttempt") == 1)
  2799.             {
  2800.                 // if(GetPlayerAnimationIndex(i) != 746) ClearAnimationsEx(i), PlayDeathAnimation(i);
  2801.                 if(!GetPVarType(i, "StreamPrep") && !IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")) && !GetPVarInt(i, "OnStretcher"))
  2802.                 {
  2803.                     SendClientMessageEx(playerid, COLOR_WHITE, "You fell unconscious, you were immediately sent to the hospital.");
  2804.                     KillEMSQueue(i);
  2805.                     SpawnPlayer(i);
  2806.                 }
  2807.                 GameTextForPlayer(i, "~r~Injured~n~~w~Waiting for EMS to Arrive...", 5000, 3);
  2808.             }
  2809.             if(GetPVarInt(i, "EMSAttempt") == 2)
  2810.             {
  2811.                 if(!GetPVarType(i, "StreamPrep") && !IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")) && !GetPVarInt(i, "OnStretcher"))
  2812.                 {
  2813.                     SetPVarInt(i, "EMSWarns", GetPVarInt(i, "EMSWarns")+1);
  2814.                     if(GetPVarInt(i, "EMSWarns") == 2)
  2815.                     {
  2816.                         SendClientMessageEx(playerid, COLOR_WHITE, "You fell unconscious, you were immediately sent to the hospital.");
  2817.                         KillEMSQueue(i);
  2818.                         SpawnPlayer(i);
  2819.                         DeletePVar(i, "EMSWarns");
  2820.                     }
  2821.                 }
  2822.                 GameTextForPlayer(i, "~g~Rescued~n~~w~Awaiting Treatment...", 5000, 3);
  2823.             }
  2824.             if(GetPVarInt(i, "EMSAttempt") == 3)
  2825.             {
  2826.                 if(IsPlayerInAnyVehicle(i))
  2827.                 {
  2828.                     new ambmodel = GetPlayerVehicleID(i);
  2829.                     if(IsAnAmbulance(ambmodel))
  2830.                     {
  2831.                         GameTextForPlayer(i, "~g~Rescued~n~~w~Waiting for EMS to take to Hospital...", 5000, 3);
  2832.                     }
  2833.                     else
  2834.                     {
  2835.                         SendClientMessageEx(playerid, COLOR_WHITE, "You fell unconscious due to no life support, you were immediately sent to the hospital.");
  2836.                         KillEMSQueue(i);
  2837.                         SpawnPlayer(i);
  2838.                     }
  2839.                 }
  2840.                 else
  2841.                 {
  2842.                     SetPVarInt(i, "EMSWarnst", GetPVarInt(i, "EMSWarnst")+1);
  2843.                     if(GetPVarInt(i, "EMSWarnst") == 2)
  2844.                     {
  2845.                         SendClientMessageEx(playerid, COLOR_WHITE, "You fell out of the vehicle, you were immediately sent to the hospital.");
  2846.                         KillEMSQueue(i);
  2847.                         SpawnPlayer(i);
  2848.                         DeletePVar(i, "EMSWarnst");
  2849.                     }
  2850.                 }
  2851.             }
  2852.  
  2853.             GetHealth(i, health);
  2854.             if(health <= 5)
  2855.             {
  2856.                 SendClientMessageEx(playerid, COLOR_WHITE, "You fell unconscious, you were immediately sent to the hospital.");
  2857.                 KillEMSQueue(i);
  2858.                 SpawnPlayer(i);
  2859.             }
  2860.         }
  2861.     }
  2862. }
  2863.  
  2864. // Timer Name: PlayerMicroBeat()
  2865. // TickRate: 500ms
  2866. ptask PlayerMicroBeat[500](i) {
  2867.  
  2868.     static
  2869.         Float: fExpHealth,
  2870.         Float: fCurrentSpeed,
  2871.         Float: fVehicleHealth,
  2872.         iVehicle,
  2873.         //szSpeed[42],
  2874.         arrVehParams[7];
  2875.  
  2876.     if(_vhudVisible[i] == 1 && !IsPlayerInAnyVehicle(i))
  2877.     {
  2878.         HideVehicleHUDForPlayer(i);
  2879.     }
  2880.  
  2881.     switch(GetPlayerState(i))
  2882.     {
  2883.         case PLAYER_STATE_DRIVER:
  2884.         {
  2885.             iVehicle = GetPlayerVehicleID(i);
  2886.             GetVehicleHealth(iVehicle, fVehicleHealth);
  2887.             fCurrentSpeed = player_get_speed(i);
  2888.  
  2889.             if(arr_Towing[i] != INVALID_VEHICLE_ID) {
  2890.                 if(GetVehicleModel(arr_Towing[i]) && IsVehicleStreamedIn(arr_Towing[i], i)) AttachTrailerToVehicle(arr_Towing[i], iVehicle);
  2891.                 else arr_Towing[i] = INVALID_VEHICLE_ID;
  2892.             }
  2893.  
  2894.             if(fCurrentSpeed >= 40 && 60 <= fCurrentSpeed)
  2895.             {
  2896.                 if(PlayerInfo[i][pAdmin] <= 1 && !IsABoat(iVehicle)) switch(Seatbelt[i]) {
  2897.                     case 0: if((fVehSpeed[i] - fCurrentSpeed > 40.0) && (fVehHealth[i] - fExpHealth > 0)) GetHealth(i, fExpHealth), SetHealth(i, fExpHealth - (fVehSpeed[i] - fCurrentSpeed) / 3.0);
  2898.                     default: if((fVehSpeed[i] - fCurrentSpeed > 40.0) && (fVehHealth[i] - fExpHealth > 0)) GetHealth(i, fExpHealth), SetHealth(i, fExpHealth - ((fVehSpeed[i] - fCurrentSpeed) / 6.0));
  2899.                 }
  2900.             }
  2901.             else
  2902.             {
  2903.                 if(PlayerInfo[i][pAdmin] <= 1 && !IsABoat(iVehicle)) switch(Seatbelt[i]) {
  2904.                     case 0: if((fVehSpeed[i] - fCurrentSpeed > 50.0) && (fVehHealth[i] - fExpHealth > 0)) GetHealth(i, fExpHealth), SetHealth(i, fExpHealth - (fVehSpeed[i] - fCurrentSpeed) / 3.0);
  2905.                     default: if((fVehSpeed[i] - fCurrentSpeed > 50.0) && (fVehHealth[i] - fExpHealth > 0)) GetHealth(i, fExpHealth), SetHealth(i, fExpHealth - ((fVehSpeed[i] - fCurrentSpeed) / 6.0));
  2906.                 }
  2907.             }
  2908.  
  2909.             fVehSpeed[i] = fCurrentSpeed;
  2910.             fVehHealth[i] = fVehicleHealth;
  2911.  
  2912.             if(fVehicleHealth < 350.0)
  2913.             {
  2914.                 SetVehicleHealth(iVehicle, 251.0);
  2915.                 GetVehicleParamsEx(iVehicle, arrVehParams[0], arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
  2916.                 if(arrVehParams[0] == VEHICLE_PARAMS_ON)
  2917.                 {
  2918.                     SetVehicleParamsEx(iVehicle,VEHICLE_PARAMS_OFF, arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
  2919.                     /*if(!PlayerInfo[i][pShopNotice])
  2920.                     {
  2921.                         PlayerTextDrawSetString(i, MicroNotice[i], ShopMsg[8]);
  2922.                         PlayerTextDrawShow(i, MicroNotice[i]);
  2923.                         SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", i, _:MicroNotice[i]);
  2924.                     }*/
  2925.                 }
  2926.                 GameTextForPlayer(i, "~r~Totalled!", 2500, 3);
  2927.                 arr_Engine{iVehicle} = 0;
  2928.             }
  2929.             else if(PlayerInfo[i][pSpeedo] != 0) {
  2930.                 UpdateVehicleHUDForPlayer(i, floatround(VehicleFuel[iVehicle]), floatround(fCurrentSpeed));
  2931.             }
  2932.         }
  2933.         case PLAYER_STATE_PASSENGER:
  2934.         {
  2935.             iVehicle = GetPlayerVehicleID(i);
  2936.             GetVehicleHealth(iVehicle,fExpHealth);
  2937.             fCurrentSpeed = player_get_speed(i);
  2938.             if(PlayerInfo[i][pSpeedo] != 0) {
  2939.                 UpdateVehicleHUDForPlayer(i, floatround(VehicleFuel[iVehicle]), floatround(fCurrentSpeed));
  2940.             }
  2941.             if(fCurrentSpeed >= 40 && 60 <= fCurrentSpeed)
  2942.             {
  2943.                 if(PlayerInfo[i][pAdmin] <= 1 && !IsABoat(iVehicle)) switch(Seatbelt[i]) {
  2944.                     case 0: if((fVehSpeed[i] - fCurrentSpeed > 40.0) && (fVehHealth[i] - fExpHealth > 0)) GetHealth(i, fExpHealth), SetHealth(i, fExpHealth - (fVehSpeed[i] - fCurrentSpeed) / 1.6);
  2945.                     default: if((fVehSpeed[i] - fCurrentSpeed > 40.0) && (fVehHealth[i] - fExpHealth > 0)) GetHealth(i, fExpHealth), SetHealth(i, fExpHealth - ((fVehSpeed[i] - fCurrentSpeed) / 3.2));
  2946.                 }
  2947.             }
  2948.             else
  2949.             {
  2950.                 if(PlayerInfo[i][pAdmin] <= 1 && !IsABoat(iVehicle)) switch(Seatbelt[i]) {
  2951.                     case 0: if((fVehSpeed[i] - fCurrentSpeed > 50.0) && (fVehHealth[i] - fExpHealth > 0)) GetHealth(i, fExpHealth), SetHealth(i, fExpHealth - (fVehSpeed[i] - fCurrentSpeed) / 0.8);
  2952.                     default: if((fVehSpeed[i] - fCurrentSpeed > 50.0) && (fVehHealth[i] - fExpHealth > 0)) GetHealth(i, fExpHealth), SetHealth(i, fExpHealth - ((fVehSpeed[i] - fCurrentSpeed) / 1.6));
  2953.                 }
  2954.             }
  2955.  
  2956.             fVehSpeed[i] = fCurrentSpeed;
  2957.             fVehHealth[i] = fExpHealth;
  2958.         }
  2959.     }
  2960.     if(GetPVarType(i, "pDTest")) DrivingSchoolSpeedMeter(i, player_get_speed(i));
  2961. }
  2962.  
  2963. // Task Name: fpsCounterUpdate
  2964. ptask fpsCounterUpdate[500](i)
  2965. {
  2966.     if(Bit_State(arrPlayerBits[i], bitFPS)) {
  2967.  
  2968.         format(szMiscArray, sizeof(szMiscArray), "%d", pFPS[i]);
  2969.         PlayerTextDrawSetString(i, pFPSCounter[i], szMiscArray);
  2970.     }
  2971.     return 1;
  2972. }
  2973.  
  2974. // Timer Name: ShopItemQueue()
  2975. // TickRate: 60 seconds
  2976. ptask ShopItemQueue[60000](i)
  2977. {
  2978.     szMiscArray[0] = 0;
  2979.     mysql_format(MainPipeline, szMiscArray, sizeof(szMiscArray), "SELECT * FROM `shop_orders` WHERE `user_id` = %d AND `status` = 0", GetPlayerSQLId(i));
  2980.     mysql_tquery(MainPipeline, szMiscArray, "ExecuteShopQueue", "ii", i, 0);
  2981.  
  2982.     if(ShopToggle == 1)
  2983.     {
  2984.         mysql_format(MainPipeline, szMiscArray, sizeof(szMiscArray), "SELECT * FROM `order_delivery_status` WHERE `player_id` = %d AND `status` = 0", GetPlayerSQLId(i));
  2985.         mysql_tquery(ShopPipeline, szMiscArray, "ExecuteShopQueue", "ii", i, 1);
  2986.     }
  2987. }
  2988.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement