timers.pwn 112 KB

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