functions.pwn 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. //--------------------------------[FUNCTIONS.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. /* ---------------- FUNCTIONS ----------------- */
  32. #if defined zombiemode
  33. Float:GetPointDistanceToPoint(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2)
  34. {
  35. new Float:x, Float:y, Float:z;
  36. x = x1-x2;
  37. y = y1-y2;
  38. z = z1-z2;
  39. return floatsqroot(x*x+y*y+z*z);
  40. }
  41. #endif
  42. Format_PlayerName(playerid) {
  43. szMiscArray[0] = 0;
  44. new iPos, name[MAX_PLAYER_NAME];
  45. GetPlayerName(playerid, szMiscArray, MAX_PLAYER_NAME);
  46. for(new i; i < MAX_PLAYER_NAME; i++) szMiscArray[i] = tolower(szMiscArray[i]);
  47. szMiscArray[0] = toupper(szMiscArray[0]);
  48. format(name, sizeof(name), "Formatting_%d", playerid);
  49. SetPlayerName(playerid, name);
  50. while((iPos = strfind(szMiscArray, "_", false, iPos)) != -1) iPos++, szMiscArray[iPos] = toupper(szMiscArray[iPos]);
  51. SetPlayerName(playerid, szMiscArray);
  52. printf("[PlayerName] Formatted %s to the correct RP-format standards.", szMiscArray);
  53. }
  54. CheckPointCheck(iTargetID) {
  55. if(GetPVarType(iTargetID, "hFind") > 0 || GetPVarType(iTargetID, "TrackCar") > 0 || GetPVarType(iTargetID, "DV_TrackCar") > 0 || GetPVarType(iTargetID, "Packages") > 0 || TaxiAccepted[iTargetID] != INVALID_PLAYER_ID || EMSAccepted[iTargetID] != INVALID_PLAYER_ID || BusAccepted[iTargetID] != INVALID_PLAYER_ID || gPlayerCheckpointStatus[iTargetID] != CHECKPOINT_NONE || MedicAccepted[iTargetID] != INVALID_PLAYER_ID || MechanicCallTime[iTargetID] >= 1) {
  56. return 1;
  57. }
  58. if(GetPVarType(iTargetID, "TrackVehicleBurglary") > 0 || GetPVarType(iTargetID, "DeliveringVehicleTime") > 0 || GetPVarType(iTargetID, "pDTest") > 0 || GetPVarType(iTargetID, "pGarbageRun") > 0 || GetPVarType(iTargetID, "pSellingFish") > 0 || GetPVarType(iTargetID, "pDrugRun") || PlayerInfo[iTargetID][pTut] >= 0)
  59. return 1;
  60. return 0;
  61. }
  62. IsNumeric(szInput[]) {
  63. new
  64. iChar,
  65. i = 0;
  66. while ((iChar = szInput[i++])) if (!('0' <= iChar <= '9')) return 0;
  67. return 1;
  68. }
  69. ReturnUserFromIP(szIP[]) {
  70. foreach(new i : Player) {
  71. if(strcmp(szIP, GetPlayerIpEx(i), true) == 0) return i;
  72. }
  73. return INVALID_PLAYER_ID;
  74. }
  75. ReturnUser(text[]) {
  76. new
  77. strPos,
  78. returnID = 0,
  79. bool: isnum = true;
  80. if(!strlen(text)) return INVALID_PLAYER_ID;
  81. while(text[strPos]) {
  82. if(isnum) {
  83. if ('0' <= text[strPos] <= '9') returnID = (returnID * 10) + (text[strPos] - '0');
  84. else isnum = false;
  85. }
  86. strPos++;
  87. }
  88. if (isnum) {
  89. if(IsPlayerConnected(returnID)) return returnID;
  90. }
  91. else {
  92. new
  93. sz_playerName[MAX_PLAYER_NAME];
  94. foreach(new i: Player)
  95. {
  96. GetPlayerName(i, sz_playerName, MAX_PLAYER_NAME);
  97. if(!strcmp(sz_playerName, text, true, strPos)) return i;
  98. }
  99. }
  100. return INVALID_PLAYER_ID;
  101. }
  102. MainMenuUpdateForPlayer(playerid)
  103. {
  104. new string[156];
  105. if(InsideMainMenu{playerid} == 1 || InsideTut{playerid} == 1)
  106. {
  107. format(string, sizeof(string), "~y~MOTD~w~: %s", GlobalMOTD);
  108. TextDrawSetString(MainMenuTxtdraw[9], string);
  109. }
  110. }
  111. /*
  112. Float:GetPointDistanceToPoint(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2)
  113. {
  114. new Float:x, Float:y, Float:z;
  115. x = x1-x2;
  116. y = y1-y2;
  117. z = z1-z2;
  118. return floatsqroot(x*x+y*y+z*z);
  119. }
  120. Float:GetPointDistanceToPointEx(Float:x1,Float:y1,Float:x2,Float:y2)
  121. {
  122. new Float:x, Float:y;
  123. x = x1-x2;
  124. y = y1-y2;
  125. return floatsqroot(x*x+y*y);
  126. } */
  127. RemovePlayerWeapon(playerid, weaponid)
  128. {
  129. ResetPlayerWeapons(playerid);
  130. PlayerInfo[playerid][pGuns][GetWeaponSlot(weaponid)] = 0;
  131. SetPlayerWeaponsEx(playerid);
  132. return 1;
  133. }
  134. IsPlayerInRangeOfVehicle(playerid, vehicleid, Float: radius) {
  135. new
  136. Float:Floats[3];
  137. GetVehiclePos(vehicleid, Floats[0], Floats[1], Floats[2]);
  138. return IsPlayerInRangeOfPoint(playerid, radius, Floats[0], Floats[1], Floats[2]);
  139. }
  140. SetPlayerPosObjectOffset(objectid, playerid, Float:offset_x, Float:offset_y, Float:offset_z)
  141. {
  142. new Float:object_px,
  143. Float:object_py,
  144. Float:object_pz,
  145. Float:object_rx,
  146. Float:object_ry,
  147. Float:object_rz;
  148. GetDynamicObjectPos(objectid, object_px, object_py, object_pz);
  149. GetDynamicObjectRot(objectid, object_rx, object_ry, object_rz);
  150. printf("%f, %f, %f, %f, %f, %f", object_px, object_py, object_pz, object_rx, object_ry, object_rz);
  151. new Float:cos_x = floatcos(object_rx, degrees),
  152. Float:cos_y = floatcos(object_ry, degrees),
  153. Float:cos_z = floatcos(object_rz, degrees),
  154. Float:sin_x = floatsin(object_rx, degrees),
  155. Float:sin_y = floatsin(object_ry, degrees),
  156. Float:sin_z = floatsin(object_rz, degrees);
  157. new Float:x, Float:y, Float:z;
  158. x = object_px + offset_x * cos_y * cos_z - offset_x * sin_x * sin_y * sin_z - offset_y * cos_x * sin_z + offset_z * sin_y * cos_z + offset_z * sin_x * cos_y * sin_z;
  159. y = object_py + offset_x * cos_y * sin_z + offset_x * sin_x * sin_y * cos_z + offset_y * cos_x * cos_z + offset_z * sin_y * sin_z - offset_z * sin_x * cos_y * cos_z;
  160. z = object_pz - offset_x * cos_x * sin_y + offset_y * sin_x + offset_z * cos_x * cos_y;
  161. SetPlayerPos(playerid, x, y, z);
  162. }
  163. GlobalPlaySound(soundid, Float:x, Float:y, Float:z) {
  164. foreach(new i : Player) {
  165. if(IsPlayerInRangeOfPoint(i, 25.0, x, y, z)) {
  166. PlayerPlaySound(i, soundid, x, y, z);
  167. }
  168. }
  169. }
  170. GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  171. {
  172. new Float:a;
  173. GetPlayerPos(playerid, x, y, a);
  174. GetPlayerFacingAngle(playerid, a);
  175. if (GetPlayerVehicleID(playerid))
  176. {
  177. GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  178. }
  179. x += (distance * floatsin(-a, degrees));
  180. y += (distance * floatcos(-a, degrees));
  181. }
  182. GetXYBehindPlayer(playerid, &Float:x, &Float:y, Float:distance)
  183. {
  184. new Float:a;
  185. GetPlayerPos(playerid, x, y, a);
  186. GetPlayerFacingAngle(playerid, a);
  187. if (GetPlayerVehicleID(playerid))
  188. {
  189. GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  190. }
  191. x += (distance * floatsin(-a+180, degrees));
  192. y += (distance * floatcos(-a+180, degrees));
  193. }
  194. /*GetXYInFrontOfVehicle(playerid, &Float:x, &Float:y, Float:distance)
  195. {
  196. new Float:a;
  197. GetVehiclePos(playerid, x, y, a);
  198. GetVehicleZAngle(playerid, a);
  199. x += (distance * floatsin(-a, degrees));
  200. y += (distance * floatcos(-a, degrees));
  201. }*/
  202. IsInRangeOfPoint(Float: fPosX, Float: fPosY, Float: fPosZ, Float: fPosX2, Float: fPosY2, Float: fPosZ2, Float: fDist) {
  203. fPosX -= fPosX2;
  204. fPosY -= fPosY2;
  205. fPosZ -= fPosZ2;
  206. return ((fPosX * fPosX) + (fPosY * fPosY) + (fPosZ * fPosZ)) < (fDist * fDist);
  207. }
  208. /*PreloadAnimLib(playerid, animlib[])
  209. {
  210. ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0,1);
  211. }*/
  212. IsValidName(szPlayerName[]) {
  213. new
  214. iLength,
  215. tmpName[MAX_PLAYER_NAME],
  216. invalids;
  217. mysql_escape_string(szPlayerName, tmpName);
  218. if(strcmp(szPlayerName, tmpName, false) != 0)
  219. {
  220. return 0;
  221. }
  222. iLength = strlen(szPlayerName);
  223. if(strfind(szPlayerName, "_", false) == -1 || szPlayerName[iLength - 1] == '_' || szPlayerName[0] == '_') return 0;
  224. else if(szPlayerName[0] == '.' || szPlayerName[0] == '_' || strfind(szPlayerName, "_says", true) != -1 || strfind(szPlayerName, "_shouts", true) != -1 || strfind(szPlayerName, "_quietly", true) != -1) return 0;
  225. else if(strfind(szPlayerName, "_whispers", true) != -1 || strfind(szPlayerName, "_whisper", true) != -1) return 0;
  226. else for(new i; i < iLength; ++i) {
  227. if(!('a' <= szPlayerName[i] <= 'z' || 'A' <= szPlayerName[i] <= 'Z'
  228. || szPlayerName[i] == '_') && szPlayerName[i] != '.') return 0;
  229. if(szPlayerName[i] == 'I' && i == 0) continue;
  230. if(szPlayerName[i] == '_' && szPlayerName[i+1] == '.') invalids++;
  231. if(szPlayerName[i] == 'I' && szPlayerName[i-1] != '_') invalids++;
  232. if(invalids > 0) return 0;
  233. }
  234. return 1;
  235. }
  236. GetPlayerPriority(Player)
  237. {
  238. if(PlayerInfo[Player][pDonateRank] >= 4 || PlayerInfo[Player][pRewardHours] > 150) return 2;
  239. else if(PlayerInfo[Player][pAdmin] >= 1 || PlayerInfo[Player][pHelper] >= 2) return 3;
  240. else return 4;
  241. }
  242. IsPlayerInRangeOfDynamicObject(iPlayerID, iObjectID, Float: fRadius) {
  243. new
  244. Float: fPos[3];
  245. GetDynamicObjectPos(iObjectID, fPos[0], fPos[1], fPos[2]);
  246. return IsPlayerInRangeOfPoint(iPlayerID, fRadius, fPos[0], fPos[1], fPos[2]);
  247. }
  248. Array_Count(arrCount[], iMax = sizeof arrCount) {
  249. new
  250. iCount,
  251. iPos;
  252. while(iPos < iMax) if(arrCount[iPos++]) ++iCount;
  253. return iCount;
  254. }
  255. String_Count(arrCount[][], iMax = sizeof arrCount) {
  256. new
  257. iCount,
  258. iPos;
  259. while(iPos < iMax) if(arrCount[iPos++][0]) ++iCount;
  260. return iCount;
  261. }
  262. /* ---------------- PUBLIC FUNCTIONS ----------------- */
  263. forward HideReportText(playerid);
  264. public HideReportText(playerid)
  265. {
  266. TextDrawHideForPlayer(playerid, PriorityReport[playerid]);
  267. return 1;
  268. }
  269. forward killPlayer(playerid);
  270. public killPlayer(playerid)
  271. {
  272. new query[128];
  273. if(GetPVarInt(playerid, "commitSuicide") == 1)
  274. {
  275. mysql_format(MainPipeline, query, sizeof(query), "INSERT INTO `kills` (`id`, `killerid`, `killedid`, `date`, `weapon`) VALUES (NULL, %d, %d, NOW(), '/kill')", GetPlayerSQLId(playerid), GetPlayerSQLId(playerid));
  276. mysql_tquery(MainPipeline, query, "OnQueryFinish", "i", SENDDATA_THREAD);
  277. SetPVarInt(playerid, "commitSuicide", 0);
  278. SetHealth(playerid, 0);
  279. }
  280. else
  281. return SendClientMessageEx(playerid, COLOR_RED, "You have taken damage during the 10 seconds, therefore you couldn't commit suicide.");
  282. return 1;
  283. }
  284. forward DisableVehicleAlarm(vehicleid);
  285. public DisableVehicleAlarm(vehicleid)
  286. {
  287. new engine,lights,alarm,doors,bonnet,boot,objective;
  288. GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
  289. SetVehicleParamsEx(vehicleid,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
  290. return 1;
  291. }
  292. forward ReleasePlayer(playerid);
  293. public ReleasePlayer(playerid)
  294. {
  295. DeletePVar(playerid, "IsFrozen");
  296. if(PlayerCuffed[playerid] == 0)
  297. {
  298. TogglePlayerControllable(playerid,1);
  299. }
  300. }
  301. forward ControlCam(playerid);
  302. public ControlCam(playerid)
  303. {
  304. new Float:X, Float:Y, Float:Z;
  305. GetDynamicObjectPos(Carrier[0], X, Y, Z);
  306. SetPlayerCameraPos(playerid, X-200, Y, Z+40);
  307. SetPlayerCameraLookAt(playerid, X, Y, Z);
  308. }
  309. forward IdiotSound(playerid);
  310. public IdiotSound(playerid)
  311. {
  312. PlayAudioStreamForPlayerEx(playerid, "http://www.ng-gaming.net/users/farva/you-are-an-idiot.mp3");
  313. ShowPlayerDialogEx(playerid,DIALOG_NOTHING,DIALOG_STYLE_MSGBOX,"BUSTED!","A 15 percent CLEO tax has been assessed to your account along with a 3 hour prison - future use could result in a ban","Exit","");
  314. }
  315. forward SetCamBack(playerid);
  316. public SetCamBack(playerid)
  317. {
  318. if(IsPlayerConnected(playerid))
  319. {
  320. new Float:plocx,Float:plocy,Float:plocz;
  321. GetPlayerPos(playerid, plocx, plocy, plocz);
  322. SetPlayerPos(playerid, -1863.15, -21.6598, 1060.15); // Warp the player
  323. SetPlayerInterior(playerid,14);
  324. }
  325. }
  326. forward HttpCallback_ShopIDCheck(index, response_code, data[]);
  327. public HttpCallback_ShopIDCheck(index, response_code, data[])
  328. {
  329. new string[128], shopstring[512], shoptechs, confirmed = strval(data);
  330. PlayerInfo[index][pOrderConfirmed] = confirmed;
  331. if(response_code == 200)
  332. {
  333. foreach(new i: Player)
  334. {
  335. if(PlayerInfo[i][pShopTech] > 0)
  336. {
  337. shoptechs++;
  338. }
  339. }
  340. if(shoptechs > 0)
  341. {
  342. if(confirmed)
  343. {
  344. format(shopstring, sizeof(shopstring), "{FFFFFF}You are now waiting to receive shop order ID: %d (Confirmed)\n\nA shop tech will be with you as soon as possible.\n\nIf you have more than one order then please let the shop tech know once they are with you.\n\nShop Techs Online: %d\n\nNOTE: The shop order remains pending even if you go offline and log back in.", PlayerInfo[index][pOrder], shoptechs);
  345. ShowPlayerDialogEx(index, DIALOG_SHOPSENT, DIALOG_STYLE_MSGBOX, "{3399FF}Shop Order", shopstring, "Close", "");
  346. format(string, sizeof(string), "Shop order ID %d (Confirmed) from %s (ID: %d) is now pending.", PlayerInfo[index][pOrder], GetPlayerNameEx(index), index);
  347. ShopTechBroadCast(COLOR_SHOP, string);
  348. }
  349. else
  350. {
  351. format(shopstring, sizeof(shopstring), "{FFFFFF}You are now waiting to receive shop order ID: %d (Invalid)\n\nA shop tech will be with you as soon as possible.\n\nIf you have more than one order then please let the shop tech know once they are with you.\n\nShop Techs Online: %d\n\nNOTE: The shop order remains pending even if you go offline and log back in.", PlayerInfo[index][pOrder], shoptechs);
  352. ShowPlayerDialogEx(index, DIALOG_SHOPSENT, DIALOG_STYLE_MSGBOX, "{3399FF}Shop Order", shopstring, "Close", "");
  353. format(string, sizeof(string), "Shop order ID %d (Invalid) from %s (ID: %d) is now pending.", PlayerInfo[index][pOrder], GetPlayerNameEx(index), index);
  354. ShopTechBroadCast(COLOR_SHOP, string);
  355. }
  356. }
  357. else
  358. {
  359. if(confirmed)
  360. {
  361. format(shopstring, sizeof(shopstring), "{FFFFFF}You are now waiting to receive shop order ID: %d (Confirmed)\n\nA shop tech will be with you as soon as possible.\n\nIf you have more than one order then please let the shop tech know once they are with you.\n\nThere are currently no shop techs online, you can resume normal gameplay and a shop tech will be with you when they log on.\n\nNOTE: The shop order remains pending even if you go offline and log back in.", PlayerInfo[index][pOrder]);
  362. ShowPlayerDialogEx(index, DIALOG_SHOPSENT, DIALOG_STYLE_MSGBOX, "{3399FF}Shop Order", shopstring, "Close", "");
  363. }
  364. else
  365. {
  366. format(shopstring, sizeof(shopstring), "{FFFFFF}You are now waiting to receive shop order ID: %d (Invalid)\n\nA shop tech will be with you as soon as possible.\n\nIf you have more than one order then please let the shop tech know once they are with you.\n\nThere are currently no shop techs online, you can resume normal gameplay and a shop tech will be with you when they log on.\n\nNOTE: The shop order remains pending even if you go offline and log back in.", PlayerInfo[index][pOrder]);
  367. ShowPlayerDialogEx(index, DIALOG_SHOPSENT, DIALOG_STYLE_MSGBOX, "{3399FF}Shop Order", shopstring, "Close", "");
  368. }
  369. }
  370. new playerip[32];
  371. GetPlayerIp(index, playerip, sizeof(playerip));
  372. format(string, sizeof(string), "Shop order ID %d from %s(%d)(IP: %s) is now pending.", PlayerInfo[index][pOrder], GetPlayerNameEx(index), GetPlayerSQLId(index), playerip);
  373. Log("logs/shoporders.log", string);
  374. }
  375. else
  376. {
  377. PlayerInfo[index][pOrder] = 0;
  378. PlayerInfo[index][pOrderConfirmed] = 0;
  379. ShowPlayerDialogEx(index, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "{3399FF}Shop Order - Server Connection Error", "{FFFFFF}We are unable to process your order at this time.\n\nPlease try again later.", "Close", "");
  380. }
  381. }
  382. forward TurnOffFlash(playerid);
  383. public TurnOffFlash(playerid)
  384. {
  385. PlayerTextDrawHide(playerid, _vhudFlash[playerid]);
  386. return 1;
  387. }
  388. forward ClearDrugs(playerid);
  389. public ClearDrugs(playerid)
  390. {
  391. UsedWeed[playerid] = 0;
  392. UsedCrack[playerid] = 0;
  393. return 1;
  394. }
  395. forward KickEx(playerid);
  396. public KickEx(playerid)
  397. {
  398. Kick(playerid);
  399. }
  400. forward SetVehicleEngine(vehicleid, playerid);
  401. public SetVehicleEngine(vehicleid, playerid)
  402. {
  403. new string[128];
  404. new engine,lights,alarm,doors,bonnet,boot,objective;
  405. GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
  406. if(engine == VEHICLE_PARAMS_ON)
  407. {
  408. SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
  409. SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine stopped successfully.");
  410. arr_Engine{vehicleid} = 0;
  411. }
  412. else if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
  413. {
  414. new
  415. Float: f_vHealth;
  416. GetVehicleHealth(vehicleid, f_vHealth);
  417. if (GetPVarInt(playerid, "Refueling")) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while refueling.");
  418. if(f_vHealth < 350.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - it's totalled!");
  419. if(IsRefuelableVehicle(vehicleid) && !IsVIPcar(vehicleid) && !IsAdminSpawnedVehicle(vehicleid) && VehicleFuel[vehicleid] <= 0.0)
  420. {
  421. /*if(!PlayerInfo[playerid][pShopNotice])
  422. {
  423. PlayerTextDrawSetString(playerid, MicroNotice[playerid], ShopMsg[7]);
  424. PlayerTextDrawShow(playerid, MicroNotice[playerid]);
  425. SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", playerid, _:MicroNotice[playerid]);
  426. }*/
  427. return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - there's no fuel in the tank!");
  428. }
  429. SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
  430. if(DynVeh[vehicleid] != -1 && DynVehicleInfo[DynVeh[vehicleid]][gv_iType] == 1 && IsAPlane(vehicleid)) { SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine started successfully (/announcetakeoff to turn the engine off)."); }
  431. else SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine started successfully (press ~k~~CONVERSATION_YES~ to turn the engine off).");
  432. arr_Engine{vehicleid} = 1;
  433. if(GetChased[playerid] != INVALID_PLAYER_ID && VehicleBomb{vehicleid} == 1)
  434. {
  435. if(PlayerInfo[playerid][pHeadValue] >= 1)
  436. {
  437. if (IsAHitman(playerid))
  438. {
  439. new Float:boomx, Float:boomy, Float:boomz;
  440. GetPlayerPos(playerid,boomx, boomy, boomz);
  441. CreateExplosion(boomx, boomy , boomz, 7, 1);
  442. VehicleBomb{vehicleid} = 0;
  443. PlacedVehicleBomb[GetChased[playerid]] = INVALID_VEHICLE_ID;
  444. new takemoney = PlayerInfo[playerid][pHeadValue];//(PlayerInfo[playerid][pHeadValue] / 4) * 2;
  445. GivePlayerCash(GetChased[playerid], floatround(takemoney * 0.9));
  446. GivePlayerCash(playerid, -takemoney);
  447. format(string,sizeof(string),"Hitman %s has fulfilled the contract on %s and collected $%d.",GetPlayerNameEx(GetChased[playerid]),GetPlayerNameEx(playerid),takemoney);
  448. foreach(new i: Player) if(IsAHitman(i)) SendClientMessage(i, COLOR_YELLOW, string);
  449. format(string,sizeof(string),"You have been critically injured by a hitman and lost $%d!",takemoney);
  450. ResetPlayerWeaponsEx(playerid);
  451. // SpawnPlayer(playerid);
  452. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  453. PlayerInfo[playerid][pHeadValue] = 0;
  454. PlayerInfo[GetChased[playerid]][pCHits] += 1;
  455. SetHealth(playerid, 0.0);
  456. // KillEMSQueue(playerid);
  457. GoChase[GetChased[playerid]] = INVALID_PLAYER_ID;
  458. PlayerInfo[GetChased[playerid]][pC4Used] = 0;
  459. PlayerInfo[GetChased[playerid]][pC4] = 0;
  460. GotHit[playerid] = 0;
  461. GetChased[playerid] = INVALID_PLAYER_ID;
  462. new iHitPercent = floatround(takemoney * 0.10);
  463. iHMASafe_Val += iHitPercent;
  464. format(szMiscArray, sizeof szMiscArray, "[hit] %s (%d) has killed %s (%d) [car bomb] for $%s ($%s deposited to safe).", GetPlayerNameEx(GetChased[playerid]), GetPlayerSQLId(GetChased[playerid]), GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), number_format(takemoney), number_format(iHitPercent));
  465. Log("logs/hitman.log", szMiscArray);
  466. return 1;
  467. }
  468. }
  469. }
  470. }
  471. return 1;
  472. }
  473. forward SurfingFix(playerid, Float:x, Float:y, Float:z);
  474. public SurfingFix(playerid, Float:x, Float:y, Float:z)
  475. {
  476. SetPlayerPos(playerid, x, y, z);
  477. return 1;
  478. }
  479. forward firstaid5(playerid);
  480. public firstaid5(playerid)
  481. {
  482. if(GetPVarInt(playerid, "usingfirstaid") == 1)
  483. {
  484. new Float:health;
  485. GetHealth(playerid, health);
  486. if(health < 100.0)
  487. {
  488. if((health+5.0) <= 100.0)
  489. {
  490. SetHealth(playerid, health+5.0);
  491. }
  492. }
  493. }
  494. }
  495. forward firstaidexpire(playerid);
  496. public firstaidexpire(playerid)
  497. {
  498. SendClientMessageEx(playerid, COLOR_GRAD1, "Your first aid kit no longer takes effect.");
  499. KillTimer(GetPVarInt(playerid, "firstaid5"));
  500. SetPVarInt(playerid, "usingfirstaid", 0);
  501. foreach(new i: Player)
  502. {
  503. if(PlayerInfo[i][pAdmin] >= 2 && GetPVarType(i, "_dCheck") && GetPVarInt(i, "_dCheck") == playerid)
  504. {
  505. SendClientMessageEx(i, COLOR_ORANGE, "Note{ffffff}: First Aid effect has expired on the person you are damage checking.");
  506. }
  507. }
  508. }
  509. forward rccam(playerid);
  510. public rccam(playerid)
  511. {
  512. DestroyVehicle(GetPVarInt(playerid, "rcveh"));
  513. SetPlayerPos(playerid, GetPVarFloat(playerid, "rcX"), GetPVarFloat(playerid, "rcY"), GetPVarFloat(playerid, "rcZ"));
  514. SendClientMessageEx(playerid, COLOR_GRAD1, "Your RC Cam has ran out of batteries!");
  515. SetPVarInt(playerid, "rccam", 0);
  516. }
  517. forward cameraexpire(playerid);
  518. public cameraexpire(playerid)
  519. {
  520. SetPVarInt(playerid, "cameraactive", 0);
  521. SetCameraBehindPlayer(playerid);
  522. if(GetPVarInt(playerid, "camerasc") == 1)
  523. {
  524. SetPlayerPos(playerid, GetPVarFloat(playerid, "cameraX2"), GetPVarFloat(playerid, "cameraY2"), GetPVarFloat(playerid, "cameraZ2"));
  525. SetPlayerVirtualWorld(playerid, GetPVarInt(playerid, "cameravw2"));
  526. SetPlayerInterior(playerid, GetPVarInt(playerid, "cameraint2"));
  527. }
  528. TogglePlayerControllable(playerid,1);
  529. DestroyDynamic3DTextLabel(Camera3D[playerid]);
  530. SendClientMessageEx(playerid, COLOR_GRAD1, "Your camera ran out of batteries!");
  531. }
  532. forward split(const strsrc[], strdest[][], delimiter);
  533. public split(const strsrc[], strdest[][], delimiter)
  534. {
  535. new i, li;
  536. new aNum;
  537. new len;
  538. while(i <= strlen(strsrc)){
  539. if(strsrc[i]==delimiter || i==strlen(strsrc)){
  540. len = strmid(strdest[aNum], strsrc, li, i, 128);
  541. strdest[aNum][len] = 0;
  542. li = i+1;
  543. aNum++;
  544. }
  545. i++;
  546. }
  547. return 1;
  548. }
  549. forward KickNonRP(playerid);
  550. public KickNonRP(playerid)
  551. {
  552. new name[MAX_PLAYER_NAME];
  553. GetPVarString(playerid, "KickNonRP", name, sizeof(name));
  554. if(strcmp(GetPlayerNameEx(playerid), name) == 0)
  555. {
  556. SendClientMessage(playerid, COLOR_WHITE, "You have been kicked for failing to connect with a role play name (i.e. John_Smith).");
  557. SetTimerEx("KickEx", 1000, 0, "i", playerid);
  558. }
  559. }
  560. timer RotateWheel[1000 * 3]()
  561. {
  562. UpdateWheelTarget();
  563. new Float:fModifyWheelZPos = 0.0;
  564. if(gWheelTransAlternate) fModifyWheelZPos = 0.05;
  565. MoveObject( gFerrisWheel, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2]+fModifyWheelZPos,
  566. 0.01, 0.0, gCurrentTargetYAngle, -270.0 );
  567. }
  568. forward OtherTimerEx(playerid, type);
  569. public OtherTimerEx(playerid, type)
  570. {
  571. switch(type) {
  572. case TYPE_TPMATRUNTIMER:
  573. {
  574. if(GetPVarInt(playerid, "tpMatRunTimer") > 0)
  575. {
  576. SetPVarInt(playerid, "tpMatRunTimer", GetPVarInt(playerid, "tpMatRunTimer")-1);
  577. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPMATRUNTIMER);
  578. }
  579. }
  580. case TYPE_TPDRUGRUNTIMER:
  581. {
  582. if(GetPVarInt(playerid, "tpDrugRunTimer") > 0)
  583. {
  584. SetPVarInt(playerid, "tpDrugRunTimer", GetPVarInt(playerid, "tpDrugRunTimer")-1);
  585. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPDRUGRUNTIMER);
  586. }
  587. }
  588. case TYPE_TPTRUCKRUNTIMER:
  589. {
  590. if(GetPVarInt(playerid, "tpTruckRunTimer") > 0)
  591. {
  592. SetPVarInt(playerid, "tpTruckRunTimer", GetPVarInt(playerid, "tpTruckRunTimer")-1);
  593. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPTRUCKRUNTIMER);
  594. }
  595. }
  596. case TYPE_ARMSTIMER:
  597. {
  598. if(GetPVarInt(playerid, "ArmsTimer") > 0)
  599. {
  600. SetPVarInt(playerid, "ArmsTimer", GetPVarInt(playerid, "ArmsTimer")-1);
  601. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_ARMSTIMER);
  602. }
  603. }
  604. case TYPE_GUARDTIMER:
  605. {
  606. if(GetPVarInt(playerid, "GuardTimer") > 0)
  607. {
  608. SetPVarInt(playerid, "GuardTimer", GetPVarInt(playerid, "GuardTimer")-1);
  609. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GUARDTIMER);
  610. }
  611. }
  612. case TYPE_GIVEWEAPONTIMER:
  613. {
  614. if(GetPVarInt(playerid, "GiveWeaponTimer") > 0)
  615. {
  616. SetPVarInt(playerid, "GiveWeaponTimer", GetPVarInt(playerid, "GiveWeaponTimer")-1);
  617. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER);
  618. }
  619. }
  620. case TYPE_SHOPORDERTIMER:
  621. {
  622. if(GetPVarInt(playerid, "ShopOrderTimer") > 0)
  623. {
  624. SetPVarInt(playerid, "ShopOrderTimer", GetPVarInt(playerid, "ShopOrderTimer")-1);
  625. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_SHOPORDERTIMER);
  626. }
  627. }
  628. case TYPE_SELLMATSTIMER:
  629. {
  630. if(GetPVarInt(playerid, "SellMatsTimer") > 0)
  631. {
  632. SetPVarInt(playerid, "SellMatsTimer", GetPVarInt(playerid, "SellMatsTimer")-1);
  633. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_SELLMATSTIMER);
  634. }
  635. }
  636. case TYPE_HOSPITALTIMER:
  637. {
  638. if(GetPVarInt(playerid, "HospitalTimer") > 0)
  639. {
  640. new Float:curhealth;
  641. GetHealth(playerid, curhealth);
  642. SetPVarInt(playerid, "HospitalTimer", GetPVarInt(playerid, "HospitalTimer")-1);
  643. SetHealth(playerid, curhealth+1);
  644. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_HOSPITALTIMER);
  645. if(GetPVarInt(playerid, "HospitalTimer") == 0)
  646. {
  647. //HospitalSpawn(playerid);
  648. }
  649. }
  650. }
  651. case TYPE_FLOODPROTECTION:
  652. {
  653. if( CommandSpamUnmute[playerid] >= 1)
  654. {
  655. CommandSpamUnmute[playerid]--;
  656. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_FLOODPROTECTION);
  657. }
  658. if( TextSpamUnmute[playerid] >= 1)
  659. {
  660. TextSpamUnmute[playerid]--;
  661. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_FLOODPROTECTION);
  662. }
  663. }
  664. case TYPE_HEALTIMER:
  665. {
  666. if( GetPVarInt(playerid, "TriageTimer") >= 1)
  667. {
  668. SetPVarInt(playerid, "TriageTimer", GetPVarInt(playerid, "TriageTimer")-1);
  669. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_HEALTIMER);
  670. }
  671. }
  672. case TYPE_TPPIZZARUNTIMER:
  673. {
  674. if(GetPVarInt(playerid, "tpPizzaTimer") > 0 && GetPVarInt(playerid, "Pizza"))
  675. {
  676. SetPVarInt(playerid, "tpPizzaTimer", GetPVarInt(playerid, "tpPizzaTimer")-1);
  677. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPPIZZARUNTIMER);
  678. }
  679. }
  680. case TYPE_PIZZATIMER:
  681. {
  682. if(GetPVarType(playerid, "pizzaTimer") && GetPVarInt(playerid, "pizzaTimer") == 0)
  683. {
  684. SendClientMessageEx(playerid, COLOR_WHITE, "You failed to deliver the pizza to the house before it got cold!");
  685. DeletePVar(playerid, "Pizza");
  686. DeletePVar(playerid, "pizzaTimer");
  687. DisablePlayerCheckpoint(playerid);
  688. }
  689. else if (GetPVarInt(playerid, "Pizza") == 0)
  690. {
  691. DeletePVar(playerid, "Pizza");
  692. DeletePVar(playerid, "pizzaTimer");
  693. DisablePlayerCheckpoint(playerid);
  694. }
  695. else if(GetPVarInt(playerid, "pizzaTimer") > 0 && GetPVarInt(playerid, "Pizza") > 0) {
  696. new houseid = GetPVarInt(playerid, "Pizza");
  697. SetPlayerCheckpoint(playerid, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ], 5); // Temporary fix.
  698. SetPVarInt(playerid, "pizzaTimer", GetPVarInt(playerid, "pizzaTimer")-1);
  699. new string[128];
  700. format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~%d seconds left", GetPVarInt(playerid, "pizzaTimer"));
  701. GameTextForPlayer(playerid, string, 1100, 3);
  702. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_PIZZATIMER);
  703. }
  704. }
  705. case TYPE_CRATETIMER:
  706. {
  707. if(GetPVarInt(playerid, "tpForkliftTimer") > 0)
  708. {
  709. if(IsPlayerInVehicle(playerid, GetPVarInt(playerid, "tpForkliftID")))
  710. {
  711. new Float: pX = GetPVarFloat(playerid, "tpForkliftX"), Float: pY = GetPVarFloat(playerid, "tpForkliftY"), Float: pZ = GetPVarFloat(playerid, "tpForkliftZ");
  712. if(GetPlayerDistanceFromPoint(playerid, pX, pY, pZ) > 500)
  713. {
  714. if(GetPVarInt(playerid, "tpJustEntered") == 0)
  715. {
  716. new string[128];
  717. format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s may be TP hacking with a crate/forklift.", GetPlayerNameEx(playerid));
  718. ABroadCast(COLOR_YELLOW, string, 2);
  719. SetPVarInt(playerid, "tpForkliftTimer", GetPVarInt(playerid, "tpForkliftTimer")+15);
  720. }
  721. else
  722. {
  723. DeletePVar(playerid, "tpJustEntered");
  724. }
  725. }
  726. GetPlayerPos(playerid, pX, pY, pZ);
  727. SetPVarFloat(playerid, "tpForkliftX", pX);
  728. SetPVarFloat(playerid, "tpForkliftY", pY);
  729. SetPVarFloat(playerid, "tpForkliftZ", pZ);
  730. SetPVarInt(playerid, "tpForkliftTimer", GetPVarInt(playerid, "tpForkliftTimer")-1);
  731. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_CRATETIMER);
  732. if(GetPVarInt(playerid, "tpForkliftTimer") == 0)
  733. {
  734. DeletePVar(playerid, "tpForkliftTimer");
  735. DeletePVar(playerid, "tpForkliftID");
  736. DeletePVar(playerid, "tpForkliftX");
  737. DeletePVar(playerid, "tpForkliftY");
  738. DeletePVar(playerid, "tpForkliftZ");
  739. }
  740. }
  741. else
  742. {
  743. DeletePVar(playerid, "tpForkliftTimer");
  744. DeletePVar(playerid, "tpForkliftID");
  745. DeletePVar(playerid, "tpForkliftX");
  746. DeletePVar(playerid, "tpForkliftY");
  747. DeletePVar(playerid, "tpForkliftZ");
  748. }
  749. }
  750. }
  751. case TYPE_DELIVERVEHICLE:
  752. {
  753. if(GetPVarType(playerid, "tpDeliverVehTimer") > 0 && GetPVarType(playerid, "DeliveringVehicleTime") > 0)
  754. {
  755. new Float: pX = GetPVarFloat(playerid, "tpDeliverVehX"), Float: pY = GetPVarFloat(playerid, "tpDeliverVehY"), Float: pZ = GetPVarFloat(playerid, "tpDeliverVehZ");
  756. if(GetPlayerDistanceFromPoint(playerid, pX, pY, pZ) > 500)
  757. {
  758. if(GetPVarType(playerid, "tpJustEntered") == 0)
  759. {
  760. new string[128];
  761. format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s(%d) may be TP hacking while delivering a lock picked vehicle.", GetPlayerNameEx(playerid), playerid);
  762. ABroadCast(COLOR_YELLOW, string, 2);
  763. SetPVarInt(playerid, "tpDeliverVehTimer", GetPVarInt(playerid, "tpDeliverVehTimer")+15);
  764. }
  765. else
  766. {
  767. DeletePVar(playerid, "tpJustEntered");
  768. }
  769. }
  770. GetPlayerPos(playerid, pX, pY, pZ);
  771. SetPVarFloat(playerid, "tpDeliverVehX", pX);
  772. SetPVarFloat(playerid, "tpDeliverVehY", pY);
  773. SetPVarFloat(playerid, "tpDeliverVehZ", pZ);
  774. SetPVarInt(playerid, "tpDeliverVehTimer", GetPVarInt(playerid, "tpDeliverVehTimer")-1);
  775. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_DELIVERVEHICLE);
  776. if(GetPVarInt(playerid, "tpDeliverVehTimer") == 0)
  777. {
  778. DeletePVar(playerid, "tpDeliverVehTimer");
  779. DeletePVar(playerid, "tpDeliverVehX");
  780. DeletePVar(playerid, "tpDeliverVehY");
  781. DeletePVar(playerid, "tpDeliverVehZ");
  782. }
  783. }
  784. else
  785. {
  786. DeletePVar(playerid, "tpDeliverVehTimer");
  787. DeletePVar(playerid, "tpDeliverVehX");
  788. DeletePVar(playerid, "tpDeliverVehY");
  789. DeletePVar(playerid, "tpDeliverVehZ");
  790. }
  791. }
  792. }
  793. }
  794. forward Disconnect(playerid);
  795. public Disconnect(playerid)
  796. {
  797. new string[24];
  798. GetPlayerIp(playerid, unbanip[playerid], 16);
  799. format(string, sizeof(string),"banip %s", unbanip[playerid]);
  800. SendRconCommand(string);
  801. Kick(playerid);
  802. return 1;
  803. }
  804. forward GetColorCode(clr[]);
  805. public GetColorCode(clr[])
  806. {
  807. new color = -1;
  808. if (IsNumeric(clr)) {
  809. color = strval(clr);
  810. return color;
  811. }
  812. if(strcmp(clr, "black", true)==0) color=0;
  813. if(strcmp(clr, "white", true)==0) color=1;
  814. if(strcmp(clr, "blue", true)==0) color=2;
  815. if(strcmp(clr, "red", true)==0) color=3;
  816. if(strcmp(clr, "green", true)==0) color=16;
  817. if(strcmp(clr, "purple", true)==0) color=5;
  818. if(strcmp(clr, "yellow", true)==0) color=6;
  819. if(strcmp(clr, "lightblue", true)==0) color=7;
  820. if(strcmp(clr, "navy", true)==0) color=94;
  821. if(strcmp(clr, "beige", true)==0) color=102;
  822. if(strcmp(clr, "darkgreen", true)==0) color=51;
  823. if(strcmp(clr, "darkblue", true)==0) color=103;
  824. if(strcmp(clr, "darkgrey", true)==0) color=13;
  825. if(strcmp(clr, "gold", true)==0) color=99;
  826. if(strcmp(clr, "brown", true)==0 || strcmp(clr, "dennell", true)==0) color=55;
  827. if(strcmp(clr, "darkbrown", true)==0) color=84;
  828. if(strcmp(clr, "darkred", true)==0) color=74;
  829. if(strcmp(clr, "maroon", true)==0) color=115;
  830. if(strcmp(clr, "pink", true)==0) color=126;
  831. return color;
  832. }
  833. forward HelpTimer(playerid);
  834. public HelpTimer(playerid)
  835. {
  836. if(GetPVarInt(playerid, "HelpTime") > 0)
  837. {
  838. SetPVarInt(playerid, "HelpTime", GetPVarInt(playerid, "HelpTime")-1);
  839. if(GetPVarInt(playerid, "HelpTime") == 0)
  840. {
  841. SendClientMessageEx(playerid, COLOR_GREY, "Your help request has expired. Its recommended you seek help on the forums (www.ng-gaming.net/forums)");
  842. DeletePVar(playerid, "COMMUNITY_ADVISOR_REQUEST");
  843. return 1;
  844. }
  845. SetTimerEx("HelpTimer", 60000, 0, "d", playerid);
  846. }
  847. return 1;
  848. }
  849. forward DrinkCooldown(playerid);
  850. public DrinkCooldown(playerid)
  851. {
  852. SetPVarInt(playerid, "DrinkCooledDown", 1);
  853. return 1;
  854. }
  855. forward RadarCooldown(playerid);
  856. public RadarCooldown(playerid)
  857. {
  858. DeletePVar(playerid, "RadarTimeout");
  859. return 1;
  860. }
  861. public OnPlayerPickUpDynamicPickup(playerid, pickupid)
  862. {
  863. new vehicleid = GetPlayerVehicleID(playerid);
  864. for(new iGroup; iGroup < MAX_GROUPS; iGroup++)
  865. {
  866. for(new x = 0; x < MAX_SPIKES; ++x)
  867. {
  868. if(SpikeStrips[iGroup][x][sX] != 0 && pickupid == SpikeStrips[iGroup][x][sPickupID])
  869. {
  870. DestroyDynamicPickup(SpikeStrips[iGroup][x][sPickupID]);
  871. SpikeStrips[iGroup][x][sPickupID] = CreateDynamicPickup(19300, 14, SpikeStrips[iGroup][x][sX], SpikeStrips[iGroup][x][sY], SpikeStrips[iGroup][x][sZ]);
  872. if(GetVehicleDistanceFromPoint(vehicleid, SpikeStrips[iGroup][x][sX], SpikeStrips[iGroup][x][sY], SpikeStrips[iGroup][x][sZ]) <= 6.0)
  873. {
  874. new Float:pos[4];
  875. GetVehiclePos(vehicleid, pos[0], pos[1], pos[2]);
  876. GetVehicleZAngle(vehicleid, pos[3]);
  877. // TODO: This should be more specific to the vehicle
  878. // TODO: Bike tires should be checked differently
  879. if(GetDistanceBetweenPoints(pos[0], pos[1], pos[2], SpikeStrips[iGroup][x][sX], SpikeStrips[iGroup][x][sY], SpikeStrips[iGroup][x][sZ]) <= 4)
  880. {
  881. // Pop Front
  882. SetVehicleTireState(vehicleid, 0, 0, 0, 0);
  883. }
  884. }
  885. }
  886. }
  887. }
  888. if (GetPVarInt(playerid, "_BikeParkourStage") > 0)
  889. {
  890. new stage = GetPVarInt(playerid, "_BikeParkourStage");
  891. new slot = GetPVarInt(playerid, "_BikeParkourSlot");
  892. new bikePickup = GetPVarInt(playerid, "_BikeParkourPickup");
  893. new business = InBusiness(playerid);
  894. if (pickupid != bikePickup)
  895. {
  896. SendClientMessageEx(playerid, COLOR_GRAD2, "That isn't your pickup!");
  897. return 1;
  898. }
  899. if (stage > 1 && !IsPlayerInAnyVehicle(playerid))
  900. {
  901. SendClientMessageEx(playerid, COLOR_WHITE, "You must be on your bike to proceed!");
  902. return 1;
  903. }
  904. switch (GetPVarInt(playerid, "_BikeParkourStage"))
  905. {
  906. case 1:
  907. {
  908. DestroyDynamicPickup(bikePickup);
  909. new Float:pos[4];
  910. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  911. GetPlayerFacingAngle(playerid, pos[3]);
  912. new vehicleId = CreateVehicle(481, pos[0], pos[1], pos[2], pos[3], 0, 0, 0);
  913. SetVehicleVirtualWorld(vehicleId, GetPlayerVirtualWorld(playerid));
  914. LinkVehicleToInterior(vehicleId, GetPlayerInterior(playerid));
  915. Businesses[business][bGymBikeVehicles][slot] = vehicleId;
  916. SendClientMessageEx(playerid, COLOR_WHITE, "Follow the arrow pickups to complete the track.");
  917. //SendClientMessageEx(playerid, COLOR_WHITE, "Type /leaveparkour to quit the activity without completing it.");
  918. bikePickup = CreateDynamicPickup(1318, 14, 2823.5071, -2260.9243, 97.5347, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  919. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  920. SetPVarInt(playerid, "_BikeParkourStage", 2);
  921. }
  922. case 2:
  923. {
  924. DestroyDynamicPickup(bikePickup);
  925. bikePickup = CreateDynamicPickup(1318, 14, 2821.0806, -2254.6775, 98.6094, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  926. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  927. SetPVarInt(playerid, "_BikeParkourStage", 3);
  928. }
  929. case 3:
  930. {
  931. DestroyDynamicPickup(bikePickup);
  932. bikePickup = CreateDynamicPickup(1318, 14, 2817.6206, -2246.4187, 98.6221, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  933. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  934. SetPVarInt(playerid, "_BikeParkourStage", 4);
  935. }
  936. case 4:
  937. {
  938. DestroyDynamicPickup(bikePickup);
  939. bikePickup = CreateDynamicPickup(1318, 14, 2813.2246, -2235.4602, 98.6094, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  940. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  941. SetPVarInt(playerid, "_BikeParkourStage", 5);
  942. }
  943. case 5:
  944. {
  945. DestroyDynamicPickup(bikePickup);
  946. bikePickup = CreateDynamicPickup(1318, 14, 2817.3789, -2228.5271, 98.6919, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  947. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  948. SetPVarInt(playerid, "_BikeParkourStage", 6);
  949. }
  950. case 6:
  951. {
  952. DestroyDynamicPickup(bikePickup);
  953. bikePickup = CreateDynamicPickup(1318, 14, 2823.3210, -2232.0654, 98.6221, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  954. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  955. SetPVarInt(playerid, "_BikeParkourStage", 7);
  956. }
  957. case 7:
  958. {
  959. DestroyDynamicPickup(bikePickup);
  960. bikePickup = CreateDynamicPickup(1318, 14, 2828.3071, -2231.8882, 99.2544, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  961. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  962. SetPVarInt(playerid, "_BikeParkourStage", 8);
  963. }
  964. case 8:
  965. {
  966. DestroyDynamicPickup(bikePickup);
  967. bikePickup = CreateDynamicPickup(1318, 14, 2831.8652, -2235.8438, 99.8750, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  968. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  969. SetPVarInt(playerid, "_BikeParkourStage", 9);
  970. }
  971. case 9:
  972. {
  973. DestroyDynamicPickup(bikePickup);
  974. bikePickup = CreateDynamicPickup(1318, 14, 2832.3789, -2243.1646, 98.8604, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  975. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  976. SetPVarInt(playerid, "_BikeParkourStage", 10);
  977. }
  978. case 10:
  979. {
  980. DestroyDynamicPickup(bikePickup);
  981. bikePickup = CreateDynamicPickup(1318, 14, 2830.2227, -2247.3076, 98.6094, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  982. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  983. SetPVarInt(playerid, "_BikeParkourStage", 11);
  984. }
  985. case 11:
  986. {
  987. DestroyDynamicPickup(bikePickup);
  988. bikePickup = CreateDynamicPickup(1318, 14, 2830.8708, -2251.3501, 99.7329, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  989. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  990. SetPVarInt(playerid, "_BikeParkourStage", 12);
  991. }
  992. case 12:
  993. {
  994. DestroyDynamicPickup(bikePickup);
  995. bikePickup = CreateDynamicPickup(1318, 14, 2840.0076, -2252.7549, 99.7329, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  996. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  997. SetPVarInt(playerid, "_BikeParkourStage", 13);
  998. }
  999. case 13:
  1000. {
  1001. DestroyDynamicPickup(bikePickup);
  1002. bikePickup = CreateDynamicPickup(1318, 14, 2858.3438, -2252.1355, 99.2871, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1003. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1004. SetPVarInt(playerid, "_BikeParkourStage", 14);
  1005. }
  1006. case 14:
  1007. {
  1008. DestroyDynamicPickup(bikePickup);
  1009. bikePickup = CreateDynamicPickup(1318, 14, 2857.1311, -2239.4653, 99.2373, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1010. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1011. SetPVarInt(playerid, "_BikeParkourStage", 15);
  1012. }
  1013. case 15:
  1014. {
  1015. DestroyDynamicPickup(bikePickup);
  1016. bikePickup = CreateDynamicPickup(1318, 14, 2852.6345, -2239.1692, 98.6665, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1017. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1018. SetPVarInt(playerid, "_BikeParkourStage", 16);
  1019. }
  1020. case 16:
  1021. {
  1022. DestroyDynamicPickup(bikePickup);
  1023. bikePickup = CreateDynamicPickup(1318, 14, 2846.7661, -2226.1548, 98.8716, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1024. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1025. SetPVarInt(playerid, "_BikeParkourStage", 17);
  1026. }
  1027. case 17:
  1028. {
  1029. DestroyDynamicPickup(bikePickup);
  1030. bikePickup = CreateDynamicPickup(1318, 14, 2838.6113, -2228.2808, 98.7231, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1031. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1032. SetPVarInt(playerid, "_BikeParkourStage", 18);
  1033. }
  1034. case 18:
  1035. {
  1036. DestroyDynamicPickup(bikePickup);
  1037. bikePickup = CreateDynamicPickup(1318, 14, 2837.6887, -2219.9446, 100.5010, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1038. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1039. SetPVarInt(playerid, "_BikeParkourStage", 19);
  1040. }
  1041. case 19:
  1042. {
  1043. DestroyDynamicPickup(bikePickup);
  1044. bikePickup = CreateDynamicPickup(1318, 14, 2833.5979, -2215.8831, 100.4380, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1045. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1046. SetPVarInt(playerid, "_BikeParkourStage", 20);
  1047. }
  1048. case 20:
  1049. {
  1050. DestroyDynamicPickup(bikePickup);
  1051. bikePickup = CreateDynamicPickup(1318, 14, 2825.3645, -2220.9446, 100.4761, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1052. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1053. SetPVarInt(playerid, "_BikeParkourStage", 21);
  1054. }
  1055. case 21:
  1056. {
  1057. DestroyDynamicPickup(bikePickup);
  1058. bikePickup = CreateDynamicPickup(1318, 14, 2818.7837, -2223.2014, 98.6221, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1059. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1060. SetPVarInt(playerid, "_BikeParkourStage", 22);
  1061. }
  1062. case 22:
  1063. {
  1064. DestroyDynamicPickup(bikePickup);
  1065. bikePickup = CreateDynamicPickup(1318, 14, 2823.7703, -2224.3865, 98.9653, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1066. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1067. SetPVarInt(playerid, "_BikeParkourStage", 23);
  1068. }
  1069. case 23:
  1070. {
  1071. DestroyDynamicPickup(bikePickup);
  1072. bikePickup = CreateDynamicPickup(1318, 14, 2836.5769, -2232.2056, 96.0278, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  1073. SetPVarInt(playerid, "_BikeParkourPickup", bikePickup);
  1074. SetPVarInt(playerid, "_BikeParkourStage", 24);
  1075. }
  1076. case 24:
  1077. {
  1078. DestroyDynamicPickup(bikePickup);
  1079. new vehicle = Businesses[business][bGymBikeVehicles][slot];
  1080. DestroyVehicle(vehicle);
  1081. Businesses[business][bGymBikePlayers][slot] = INVALID_PLAYER_ID;
  1082. Businesses[business][bGymBikeVehicles][slot] = INVALID_VEHICLE_ID;
  1083. SendClientMessageEx(playerid, COLOR_WHITE, "Track finished.");
  1084. DeletePVar(playerid, "_BikeParkourStage");
  1085. DeletePVar(playerid, "_BikeParkourSlot");
  1086. DeletePVar(playerid, "_BikeParkourPickup");
  1087. if(PlayerInfo[playerid][mCooldown][4]) PlayerInfo[playerid][pFitness] += 23;
  1088. else PlayerInfo[playerid][pFitness] += 15;
  1089. if (PlayerInfo[playerid][pFitness] > 100)
  1090. PlayerInfo[playerid][pFitness] = 100;
  1091. }
  1092. }
  1093. }
  1094. return 1;
  1095. }
  1096. forward DisableCheckPoint(playerid);
  1097. public DisableCheckPoint(playerid)
  1098. {
  1099. return DisablePlayerCheckpoint(playerid);
  1100. }
  1101. forward AttachGasTrailer(trailerid,vehicleid);
  1102. public AttachGasTrailer(trailerid,vehicleid)
  1103. {
  1104. return AttachTrailerToVehicle(trailerid, vehicleid);
  1105. }
  1106. forward Float: GetDistanceToCar(playerid, veh);
  1107. public Float: GetDistanceToCar(playerid, veh) {
  1108. new
  1109. Float: fVehiclePos[3];
  1110. GetVehiclePos(veh, fVehiclePos[0], fVehiclePos[1], fVehiclePos[2]);
  1111. return GetPlayerDistanceFromPoint(playerid, fVehiclePos[0], fVehiclePos[1], fVehiclePos[2]);
  1112. }
  1113. forward Float:vehicle_get_speed(vehicleid);
  1114. public Float:vehicle_get_speed(vehicleid)
  1115. {
  1116. new
  1117. Float: fVelocity[3];
  1118. GetVehicleVelocity(vehicleid, fVelocity[0], fVelocity[1], fVelocity[2]);
  1119. return floatsqroot((fVelocity[0] * fVelocity[0]) + (fVelocity[1] * fVelocity[1]) + (fVelocity[2] * fVelocity[2])) * 100;
  1120. }
  1121. Float:GetDistanceBetweenPlayers(iPlayerOne, iPlayerTwo)
  1122. {
  1123. new
  1124. Float: fPlayerPos[3];
  1125. GetPlayerPos(iPlayerOne, fPlayerPos[0], fPlayerPos[1], fPlayerPos[2]);
  1126. return GetPlayerDistanceFromPoint(iPlayerTwo, fPlayerPos[0], fPlayerPos[1], fPlayerPos[2]);
  1127. }
  1128. // This needs to be tested! - Akatony
  1129. public Float:player_get_speed(playerid)
  1130. {
  1131. new
  1132. Float: fVelocity[3];
  1133. GetVehicleVelocity(GetPlayerVehicleID(playerid), fVelocity[0], fVelocity[1], fVelocity[2]);
  1134. return floatsqroot((fVelocity[0] * fVelocity[0]) + (fVelocity[1] * fVelocity[1]) + (fVelocity[2] * fVelocity[2])) * 100;
  1135. }
  1136. forward UpdateCarRadars();
  1137. public UpdateCarRadars()
  1138. {
  1139. foreach(new p : Player)
  1140. {
  1141. if (!IsPlayerInAnyVehicle(p) || CarRadars[p] == 0) continue;
  1142. new target = -1;
  1143. new Float:tempDist = 50.0;
  1144. if(CarRadars[p] == 1)
  1145. {
  1146. foreach(new t : Player)
  1147. {
  1148. if (!IsPlayerInAnyVehicle(t) || t == p || IsPlayerInVehicle(t, GetPlayerVehicleID(p))) continue;
  1149. new Float:distance = GetDistanceBetweenPlayers(p, t);
  1150. if (distance < tempDist)
  1151. {
  1152. target = t;
  1153. tempDist = distance;
  1154. }
  1155. }
  1156. if (target == -1)
  1157. {
  1158. // no target was found
  1159. PlayerTextDrawSetString(p, _crTextTarget[p], "Target Vehicle: ~r~N/A");
  1160. PlayerTextDrawSetString(p, _crTextSpeed[p], "Speed: ~r~N/A");
  1161. PlayerTextDrawSetString(p, _crTickets[p], "Tickets: ~r~N/A");
  1162. }
  1163. else
  1164. {
  1165. new targetVehicle = GetPlayerVehicleID(target), cveh;
  1166. if(GetVehicleModel(targetVehicle))
  1167. {
  1168. new Float: speed = player_get_speed(target);
  1169. new str[60];
  1170. format(str, sizeof(str), "Target Vehicle: ~r~%s (%i)", GetVehicleName(targetVehicle), targetVehicle);
  1171. PlayerTextDrawSetString(p, _crTextTarget[p], str);
  1172. format(str, sizeof(str), "Speed: ~r~%d MPH", floatround(speed, floatround_round));
  1173. PlayerTextDrawSetString(p, _crTextSpeed[p], str);
  1174. foreach(new i : Player)
  1175. {
  1176. new veh = GetPlayerVehicle(i, targetVehicle);
  1177. if (veh != -1 && PlayerVehicleInfo[i][veh][pvTicket] > 0)
  1178. {
  1179. format(str, sizeof(str), "Tickets: ~r~$%s", number_format(PlayerVehicleInfo[i][veh][pvTicket]));
  1180. PlayerTextDrawSetString(p, _crTickets[p], str);
  1181. if (gettime() >= (GetPVarInt(p, "_lastTicketWarning") + 10))
  1182. {
  1183. SetPVarInt(p, "_lastTicketWarning", gettime());
  1184. PlayerPlaySound(p, 4202, 0.0, 0.0, 0.0);
  1185. }
  1186. }
  1187. }
  1188. if((cveh = IsDynamicCrateVehicle(targetVehicle)) != -1) {
  1189. if(ValidGroup(CrateVehicle[cveh][cvGroupID]) && CrateVehicle[cveh][cvTickets] > 0) {
  1190. format(str, sizeof(str), "Tickets: ~r~$%s", number_format(CrateVehicle[cveh][cvTickets]));
  1191. PlayerTextDrawSetString(p, _crTickets[p], str);
  1192. if (gettime() >= (GetPVarInt(p, "_lastTicketWarning") + 10))
  1193. {
  1194. SetPVarInt(p, "_lastTicketWarning", gettime());
  1195. PlayerPlaySound(p, 4202, 0.0, 0.0, 0.0);
  1196. }
  1197. }
  1198. }
  1199. }
  1200. }
  1201. }
  1202. }
  1203. }
  1204. /* ---------------- STOCK FUNCTIONS ----------------- */
  1205. stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2) {
  1206. return floatsqroot(floatpower(x1 - x2, 2) + floatpower(y1 - y2, 2) + floatpower(z1 - z2, 2));
  1207. }
  1208. stock BubbleSort(a[], size)
  1209. {
  1210. new tmp=0, bool:swapped;
  1211. do
  1212. {
  1213. swapped = false;
  1214. for(new i=1; i < size; i++) {
  1215. if(a[i-1] > a[i]) {
  1216. tmp = a[i];
  1217. a[i] = a[i-1];
  1218. a[i-1] = tmp;
  1219. swapped = true;
  1220. }
  1221. }
  1222. } while(swapped);
  1223. }
  1224. stock ShowNoticeGUIFrame(playerid, frame)
  1225. {
  1226. HideNoticeGUIFrame(playerid);
  1227. TextDrawShowForPlayer(playerid, NoticeTxtdraw[0]);
  1228. TextDrawShowForPlayer(playerid, NoticeTxtdraw[1]);
  1229. switch(frame)
  1230. {
  1231. case 1: // Looking up account
  1232. {
  1233. TextDrawShowForPlayer(playerid, NoticeTxtdraw[2]);
  1234. }
  1235. case 2: // Fetching & Comparing Password
  1236. {
  1237. TextDrawShowForPlayer(playerid, NoticeTxtdraw[3]);
  1238. }
  1239. case 3: // Fetching & Loading Account
  1240. {
  1241. TextDrawShowForPlayer(playerid, NoticeTxtdraw[4]);
  1242. }
  1243. case 4: // Streaming Objects
  1244. {
  1245. TextDrawShowForPlayer(playerid, NoticeTxtdraw[5]);
  1246. }
  1247. case 5: // Login Queue
  1248. {
  1249. TextDrawShowForPlayer(playerid, NoticeTxtdraw[6]);
  1250. }
  1251. case 6: // General loading
  1252. {
  1253. TextDrawShowForPlayer(playerid, NoticeTxtdraw[7]);
  1254. }
  1255. }
  1256. }
  1257. stock HideNoticeGUIFrame(playerid)
  1258. {
  1259. for(new i = 0; i < 8; i++)
  1260. {
  1261. TextDrawHideForPlayer(playerid, NoticeTxtdraw[i]);
  1262. }
  1263. }
  1264. stock BadFloat(Float:x)
  1265. {
  1266. if(x >= 10.0 || x <= -10.0)
  1267. return true;
  1268. return false;
  1269. }
  1270. stock SendBugMessage(playerid, member, string[])
  1271. {
  1272. if(!(0 <= member < MAX_GROUPS))
  1273. return 0;
  1274. new iGroupID;
  1275. foreach(new i: Player)
  1276. {
  1277. iGroupID = PlayerInfo[i][pMember];
  1278. if(iGroupID == member && PlayerInfo[i][pRank] >= arrGroupData[iGroupID][g_iBugAccess] && gBug{i} == 1) {
  1279. if(playerid != i) ChatTrafficProcess(i, COLOR_LIGHTGREEN, string, 13);
  1280. }
  1281. }
  1282. return 1;
  1283. }
  1284. /*stock ReplacePH(oldph, newph)
  1285. {
  1286. #pragma unused oldph
  1287. #pragma unused newph
  1288. new File: file2 = fopen("tmpPHList.cfg", io_write);
  1289. new number;
  1290. new string[32];
  1291. new PHList[32];
  1292. format(string, sizeof(string), "%d\r\n", newph);
  1293. fwrite(file2, string);
  1294. fclose(file2);
  1295. file2 = fopen("tmpPHList.cfg", io_append);
  1296. if(fexist("PHList.cfg"))
  1297. {
  1298. new File: file = fopen("PHList.cfg", io_read);
  1299. while(fread(file, string))
  1300. {
  1301. strmid(PHList, string, 0, strlen(string)-1, 255);
  1302. number = strval(PHList);
  1303. if (number != oldph)
  1304. {
  1305. format(string, sizeof(string), "%d\r\n", number);
  1306. fwrite(file2, string);
  1307. }
  1308. }
  1309. fclose(file);
  1310. fclose(file2);
  1311. file2 = fopen("PHList.cfg", io_write);
  1312. file = fopen("tmpPHList.cfg", io_read);
  1313. while(fread(file, string))
  1314. {
  1315. strmid(PHList, string, 0, strlen(string)-1, 255);
  1316. number = strval(PHList);
  1317. if (number != oldph)
  1318. {
  1319. format(string, sizeof(string), "%d\r\n", number);
  1320. fwrite(file2, string);
  1321. }
  1322. }
  1323. fclose(file);
  1324. fclose(file2);
  1325. fremove("tmpPHList.cfg");
  1326. }
  1327. return 1;
  1328. }*/
  1329. stock IsValidIP(ip[])
  1330. {
  1331. new a;
  1332. for (new i = 0; i < strlen(ip); i++)
  1333. {
  1334. if (ip[i] == '.')
  1335. {
  1336. a++;
  1337. }
  1338. }
  1339. if (a != 3)
  1340. {
  1341. return 1;
  1342. }
  1343. return 0;
  1344. }
  1345. stock GetPlayersName(playerid)
  1346. {
  1347. new name[MAX_PLAYER_NAME];
  1348. GetPlayerName(playerid, name, sizeof(name));
  1349. return name;
  1350. }
  1351. stock IsValidSkin(skinid)
  1352. {
  1353. if (skinid < 0 || skinid > 299)
  1354. return 0;
  1355. switch (skinid)
  1356. {
  1357. case 71, 265, 266, 267, 269, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288: return 0;
  1358. }
  1359. return 1;
  1360. }
  1361. stock IsFemaleSpawnSkin(skinid)
  1362. {
  1363. switch (skinid)
  1364. {
  1365. case
  1366. 9, 11, 12, 13, 31, 38, 39, 40, 41, 53, 54,
  1367. 55, 56, 65, 76, 77, 89, 91, 93, 129, 130,
  1368. 131, 141, 148, 150, 151, 157, 169, 172, 190,
  1369. 191, 192, 193, 194, 195, 196, 197, 198, 199,
  1370. 211, 214, 215, 216, 218, 219, 224, 225, 226,
  1371. 231, 232, 233, 263, 298: return 1;
  1372. }
  1373. return 0;
  1374. }
  1375. stock IsFemaleSkin(skinid)
  1376. {
  1377. switch (skinid)
  1378. {
  1379. case
  1380. 9, 11, 12, 13, 31, 38, 39, 40, 41, 53, 54, 55,
  1381. 56, 63, 64, 65, 75, 76, 77, 85, 87, 88, 89, 90,
  1382. 91, 92, 93, 129, 130, 131, 138, 139, 140, 141,
  1383. 145, 148, 150, 151, 152, 157, 169, 172, 178, 190,
  1384. 191, 192, 193, 194, 195, 196, 197, 198, 199, 201,
  1385. 205, 207, 211, 214, 215, 216, 218, 219, 224, 225,
  1386. 226, 231, 232, 233, 237, 238, 243, 244, 245, 246,
  1387. 251, 256, 257, 263, 298: return 1;
  1388. }
  1389. return 0;
  1390. }
  1391. stock PlayerFacePlayer( playerid, targetplayerid )
  1392. {
  1393. new Float: Angle;
  1394. GetPlayerFacingAngle( playerid, Angle );
  1395. SetPlayerFacingAngle( targetplayerid, Angle+180 );
  1396. return true;
  1397. }
  1398. stock GivePlayerEventWeapons( playerid )
  1399. {
  1400. if( GetPVarInt( playerid, "EventToken" ) == 1 )
  1401. {
  1402. GivePlayerValidWeapon( playerid, EventKernel[ EventWeapons ][ 0 ] );
  1403. GivePlayerValidWeapon( playerid, EventKernel[ EventWeapons ][ 1 ] );
  1404. GivePlayerValidWeapon( playerid, EventKernel[ EventWeapons ][ 2 ] );
  1405. GivePlayerValidWeapon( playerid, EventKernel[ EventWeapons ][ 3 ] );
  1406. GivePlayerValidWeapon( playerid, EventKernel[ EventWeapons ][ 4 ] );
  1407. }
  1408. return 1;
  1409. }
  1410. stock crc32(string[])
  1411. {
  1412. new crc_table[256] = {
  1413. 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535,
  1414. 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD,
  1415. 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D,
  1416. 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
  1417. 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4,
  1418. 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
  1419. 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC,
  1420. 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
  1421. 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB,
  1422. 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F,
  1423. 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB,
  1424. 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
  1425. 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA,
  1426. 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE,
  1427. 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A,
  1428. 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
  1429. 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409,
  1430. 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
  1431. 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739,
  1432. 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
  1433. 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268,
  1434. 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0,
  1435. 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8,
  1436. 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
  1437. 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF,
  1438. 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703,
  1439. 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7,
  1440. 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
  1441. 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE,
  1442. 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
  1443. 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6,
  1444. 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
  1445. 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D,
  1446. 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5,
  1447. 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605,
  1448. 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
  1449. 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
  1450. };
  1451. new crc = -1;
  1452. for(new i = 0; i < strlen(string); i++)
  1453. {
  1454. crc = ( crc >>> 8 ) ^ crc_table[(crc ^ string[i]) & 0xFF];
  1455. }
  1456. return crc ^ -1;
  1457. }
  1458. stock GetPlayerSQLId(playerid)
  1459. {
  1460. if(gPlayerLogged{playerid})
  1461. {
  1462. return PlayerInfo[playerid][pId];
  1463. }
  1464. return -1;
  1465. }
  1466. stock GetPlayerNameExt(playerid)
  1467. {
  1468. new name[MAX_PLAYER_NAME];
  1469. GetPlayerName(playerid, name, sizeof(name));
  1470. return name;
  1471. }
  1472. stock GetWeaponNameEx(weaponid)
  1473. {
  1474. new name[MAX_PLAYER_NAME];
  1475. GetWeaponName(weaponid, name, sizeof(name));
  1476. return name;
  1477. }
  1478. stock GetPlayerNameEx(playerid) {
  1479. new
  1480. szName[MAX_PLAYER_NAME],
  1481. iPos;
  1482. GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
  1483. while ((iPos = strfind(szName, "_", false, iPos)) != -1) szName[iPos] = ' ';
  1484. return szName;
  1485. }
  1486. stock StripUnderscore(string[]) // Doesn't remove underscore from original string any more
  1487. {
  1488. new iPos, newstring[128];
  1489. format(newstring, sizeof(newstring), "%s", string);
  1490. while ((iPos = strfind(newstring, "_", false, iPos)) != -1) newstring[iPos] = ' ';
  1491. return newstring;
  1492. }
  1493. stock GetPlayerIpEx(playerid)
  1494. {
  1495. new ip[16];
  1496. GetPlayerIp(playerid, ip, sizeof(ip));
  1497. return ip;
  1498. }
  1499. stock StripNewLine(string[])
  1500. {
  1501. new len = strlen(string);
  1502. if (string[0]==0) return ;
  1503. if ((string[len - 1] == '\n') || (string[len - 1] == '\r'))
  1504. {
  1505. string[len - 1] = 0;
  1506. if (string[0]==0) return ;
  1507. if ((string[len - 2] == '\n') || (string[len - 2] == '\r')) string[len - 2] = 0;
  1508. }
  1509. }
  1510. stock StripColorEmbedding(string[])
  1511. {
  1512. new i, tmp[7];
  1513. while (i < strlen(string) - 7)
  1514. {
  1515. if (string[i] == '{' && string[i + 7] == '}')
  1516. {
  1517. strmid(tmp, string, i + 1, i + 7);
  1518. if (ishex(tmp))
  1519. {
  1520. strdel(string, i, i + 8);
  1521. i = 0;
  1522. continue;
  1523. }
  1524. }
  1525. i++;
  1526. }
  1527. }
  1528. stock strtoupper(string[])
  1529. {
  1530. new retStr[128], i, j;
  1531. while ((j = string[i])) retStr[i++] = chrtoupper(j);
  1532. retStr[i] = '\0';
  1533. return retStr;
  1534. }
  1535. stock wordwrap(string[], width, seperator[] = "\n", dest[], size = sizeof(dest))
  1536. {
  1537. if (dest[0])
  1538. {
  1539. dest[0] = '\0';
  1540. }
  1541. new
  1542. length,
  1543. multiple,
  1544. processed,
  1545. tmp[192];
  1546. strmid(tmp, string, 0, width);
  1547. length = strlen(string);
  1548. if (width > length || !width)
  1549. {
  1550. memcpy(dest, string, _, size * 4, size);
  1551. return 0;
  1552. }
  1553. for (new i = 1; i < length; i ++)
  1554. {
  1555. if (tmp[0] == ' ')
  1556. {
  1557. strdel(tmp, 0, 1);
  1558. }
  1559. multiple = !(i % width);
  1560. if (multiple)
  1561. {
  1562. strcat(dest, tmp, size);
  1563. strcat(dest, seperator, size);
  1564. strmid(tmp, string, i, width + i);
  1565. if (strlen(tmp) < width)
  1566. {
  1567. strmid(tmp, string, (width * processed) + width, length);
  1568. if (tmp[0] == ' ')
  1569. {
  1570. strdel(tmp, 0, 1);
  1571. }
  1572. strcat(dest, tmp, size);
  1573. break;
  1574. }
  1575. processed++;
  1576. continue;
  1577. }
  1578. else if (i == length - 1)
  1579. {
  1580. strmid(tmp, string, (width * processed), length);
  1581. strcat(dest, tmp, size);
  1582. break;
  1583. }
  1584. }
  1585. return 1;
  1586. }
  1587. stock fcreate(filename[])
  1588. {
  1589. if (fexist(filename)) return false;
  1590. new File:fhnd;
  1591. fhnd=fopen(filename,io_write);
  1592. if (fhnd) {
  1593. fclose(fhnd);
  1594. return true;
  1595. }
  1596. return false;
  1597. }
  1598. stock IsAtBar(playerid)
  1599. {
  1600. if(IsPlayerConnected(playerid))
  1601. {
  1602. if(IsPlayerInRangeOfPoint(playerid,3.0,495.7801,-76.0305,998.7578) || IsPlayerInRangeOfPoint(playerid,3.0,499.9654,-20.2515,1000.6797) || IsPlayerInRangeOfPoint(playerid,9.0,1497.5735,-1811.6150,825.3397))
  1603. {//In grove street bar (with girlfriend), and in Havanna
  1604. return 1;
  1605. }
  1606. else if(IsPlayerInRangeOfPoint(playerid,4.0,1215.9480,-13.3519,1000.9219) || IsPlayerInRangeOfPoint(playerid,10.0,-2658.9749,1407.4136,906.2734) || IsPlayerInRangeOfPoint(playerid,10.0,2155.3367,-97.3984,3.8308))
  1607. {//PIG Pen
  1608. return 1;
  1609. }
  1610. else if(IsPlayerInRangeOfPoint(playerid,10.0,1131.3655,-1641.2759,18.6054) || IsPlayerInRangeOfPoint(playerid,10.0,-2676.4509,1540.6925,900.8359))
  1611. {//Families 8 & SaC
  1612. return 1;
  1613. }
  1614. else if(IsPlayerInRangeOfPoint(playerid,5.0,2492.5532,-1698.2817,1715.5508) || IsPlayerInRangeOfPoint(playerid,5.0,2462.8247,-1649.5435,1732.0295) || IsPlayerInRangeOfPoint(playerid,5.0,2498.9863,-1666.6274,1738.3696))
  1615. {
  1616. //Custom House
  1617. return 1;
  1618. }
  1619. else if(IsPlayerInRangeOfPoint(playerid,5.0,878.6188,1431.0234,-82.3449) || IsPlayerInRangeOfPoint(playerid,5.0,918.7236,1421.3997,-81.1839))
  1620. {
  1621. //VIP
  1622. return 1;
  1623. }
  1624. else if(IsPlayerInRangeOfPoint(playerid,10.0,2574.3931,-1682.1548,1030.0206))
  1625. {
  1626. //The Cove
  1627. return 1;
  1628. }
  1629. else if(IsPlayerInRangeOfPoint(playerid,10.0,1266.14,-1073.00,1082.92))
  1630. {
  1631. //The Cove
  1632. return 1;
  1633. }
  1634. else if(IsPlayerInRangeOfPoint(playerid,10.0,1886.993652, -734.707275, 3380.847656))
  1635. {
  1636. //Syndicate HQ Bar
  1637. return 1;
  1638. }
  1639. else if(IsPlayerInRangeOfPoint(playerid,10.0,300.4993, 203.9201, 1104.3500))
  1640. {
  1641. //SHIELD HQ Bar
  1642. return 1;
  1643. }
  1644. else if(IsPlayerInRangeOfPoint(playerid,10.0,252.205978, -54.826644, 1.577644))
  1645. {
  1646. //Red County Liquor Store
  1647. return 1;
  1648. }
  1649. else if(IsPlayerInRangeOfPoint(playerid,10.0,453.2437,-105.4000,999.5500) || IsPlayerInRangeOfPoint(playerid,10.0,1255.69, -791.76, 1085.38) ||
  1650. IsPlayerInRangeOfPoint(playerid,10.0,2561.94, -1296.44, 1062.04) || IsPlayerInRangeOfPoint(playerid,10.0,1139.72, -3.96, 1000.67) ||
  1651. IsPlayerInRangeOfPoint(playerid,10.0,1139.72, -3.96, 1000.67) || IsPlayerInRangeOfPoint(playerid, 10.0, 880.06, 1430.86, -82.34) ||
  1652. IsPlayerInRangeOfPoint(playerid,10.0,499.96, -20.66, 1000.68) || IsPlayerInRangeOfPoint(playerid,10.0,3282, -635, 8424))
  1653. {
  1654. //Bars
  1655. return 1;
  1656. }
  1657. }
  1658. return 0;
  1659. }
  1660. stock Group_NumToDialogHex(iValue)
  1661. {
  1662. new szValue[7];
  1663. format(szValue, sizeof(szValue), "%x", iValue);
  1664. new i, padlength = 6 - strlen(szValue);
  1665. while (i++ != padlength) {
  1666. strins(szValue, "0", 0, 7);
  1667. }
  1668. return szValue;
  1669. }
  1670. stock FIXES_valstr(dest[], value, bool:pack = false)
  1671. {
  1672. // format can't handle cellmin properly
  1673. static const cellmin_value[] = !"-2147483648";
  1674. if (value == cellmin)
  1675. pack && strpack(dest, cellmin_value, 12) || strunpack(dest, cellmin_value, 12);
  1676. else
  1677. format(dest, 12, "%d", value) && pack && strpack(dest, dest, 12);
  1678. }
  1679. stock GetClosestPlayer(p1)
  1680. {
  1681. new Float:dis,Float:dis2,player;
  1682. player = -1;
  1683. dis = 99999.99;
  1684. foreach(new x: Player)
  1685. {
  1686. if(x != p1)
  1687. {
  1688. dis2 = GetDistanceBetweenPlayers(x,p1);
  1689. if(dis2 < dis && dis2 != -1.00)
  1690. {
  1691. dis = dis2;
  1692. player = x;
  1693. }
  1694. }
  1695. }
  1696. return player;
  1697. }
  1698. stock Float: FormatFloat(Float:number) {
  1699. if(number != number) return 0.0;
  1700. else return number;
  1701. }
  1702. stock OnPlayerStatsUpdate(playerid) {
  1703. if(gPlayerLogged{playerid}) {
  1704. if(!GetPVarType(playerid, "TempName") && !GetPVarInt(playerid, "EventToken") && !GetPVarType(playerid, "IsInArena")) {
  1705. new Float: Pos[4], Float: Health[2];
  1706. GetHealth(playerid, Health[0]);
  1707. GetArmour(playerid, Health[1]);
  1708. PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
  1709. PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
  1710. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  1711. GetPlayerFacingAngle(playerid, Pos[3]);
  1712. PlayerInfo[playerid][pHealth] = FormatFloat(Health[0]);
  1713. PlayerInfo[playerid][pArmor] = FormatFloat(Health[1]);
  1714. if(IsPlayerInRangeOfPoint(playerid, 1200, -1083.90002441,4289.70019531,7.59999990) && PlayerInfo[playerid][pMember] == INVALID_GROUP_ID)
  1715. {
  1716. PlayerInfo[playerid][pInt] = 0;
  1717. PlayerInfo[playerid][pVW] = 0;
  1718. GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]);
  1719. PlayerInfo[playerid][pPos_x] = 1529.6;
  1720. PlayerInfo[playerid][pPos_y] = -1691.2;
  1721. PlayerInfo[playerid][pPos_z] = 13.3;
  1722. }
  1723. else if(GetPVarInt(playerid, "ShopTP") == 1 && GetPVarFloat(playerid, "tmpX") != 0)
  1724. {
  1725. PlayerInfo[playerid][pPos_x] = GetPVarFloat(playerid, "tmpX");
  1726. PlayerInfo[playerid][pPos_y] = GetPVarFloat(playerid, "tmpY");
  1727. PlayerInfo[playerid][pPos_z] = GetPVarFloat(playerid, "tmpZ");
  1728. PlayerInfo[playerid][pInt] = GetPVarInt(playerid, "tmpInt");
  1729. PlayerInfo[playerid][pVW] = GetPVarInt(playerid, "tmpVW");
  1730. }
  1731. else
  1732. {
  1733. PlayerInfo[playerid][pPos_x] = FormatFloat(Pos[0]);
  1734. PlayerInfo[playerid][pPos_y] = FormatFloat(Pos[1]);
  1735. PlayerInfo[playerid][pPos_z] = FormatFloat(Pos[2]);
  1736. PlayerInfo[playerid][pPos_r] = FormatFloat(Pos[3]);
  1737. }
  1738. }
  1739. else {
  1740. if(GetPVarInt(playerid, "IsInArena") >= 0) {
  1741. PlayerInfo[playerid][pInt] = GetPVarInt(playerid, "pbOldInt");
  1742. PlayerInfo[playerid][pVW] = GetPVarInt(playerid, "pbOldVW");
  1743. PlayerInfo[playerid][pPos_x] = GetPVarFloat(playerid, "pbOldX");
  1744. PlayerInfo[playerid][pPos_y] = GetPVarFloat(playerid, "pbOldY");
  1745. PlayerInfo[playerid][pPos_z] = GetPVarFloat(playerid, "pbOldZ");
  1746. }
  1747. }
  1748. g_mysql_SaveAccount(playerid);
  1749. }
  1750. return 1;
  1751. }
  1752. stock splits(const strsrc[], strdest[][], delimiter)
  1753. {
  1754. new i, li;
  1755. new aNum;
  1756. new len;
  1757. while(i <= strlen(strsrc)){
  1758. if(strsrc[i]==delimiter || i==strlen(strsrc)){
  1759. len = strmid(strdest[aNum], strsrc, li, i, 128);
  1760. strdest[aNum][len] = 0;
  1761. li = i+1;
  1762. aNum++;
  1763. }
  1764. i++;
  1765. }
  1766. return 1;
  1767. }
  1768. stock AddSpecialToken(playerid)
  1769. {
  1770. new
  1771. sz_FileStr[10 + MAX_PLAYER_NAME],
  1772. sz_playerName[MAX_PLAYER_NAME],
  1773. File: fPointer;
  1774. GetPlayerName(playerid, sz_playerName, MAX_PLAYER_NAME);
  1775. format(sz_FileStr, sizeof(sz_FileStr), "stokens/%s", sz_playerName);
  1776. if(fexist(sz_FileStr)) {
  1777. fPointer = fopen(sz_FileStr, io_read);
  1778. fread(fPointer, sz_playerName), fclose(fPointer);
  1779. new
  1780. i_tokenVal = strval(sz_playerName);
  1781. format(sz_playerName, sizeof(sz_playerName), "%i", i_tokenVal + 1);
  1782. fPointer = fopen(sz_FileStr, io_write);
  1783. if(fPointer)
  1784. {
  1785. fwrite(fPointer, sz_playerName);
  1786. fclose(fPointer);
  1787. }
  1788. }
  1789. else {
  1790. fPointer = fopen(sz_FileStr, io_write);
  1791. if(fPointer)
  1792. {
  1793. fwrite(fPointer, "1");
  1794. fclose(fPointer);
  1795. }
  1796. }
  1797. return 1;
  1798. }
  1799. stock SeeSpecialTokens(playerid, hoursneeded)
  1800. {
  1801. if(PlayerInfo[playerid][pAdmin] >= 2) return 0; // Admins cant win
  1802. if(hoursneeded <= 0) return 1;
  1803. new
  1804. szName[MAX_PLAYER_NAME],
  1805. szFileStr[10 + MAX_PLAYER_NAME];
  1806. GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
  1807. format(szFileStr, sizeof(szFileStr), "stokens/%s", szName);
  1808. if(fexist(szFileStr)) {
  1809. new
  1810. File: iFile = fopen(szFileStr, io_read);
  1811. fread(iFile, szFileStr);
  1812. fclose(iFile);
  1813. if(strval(szFileStr) >= hoursneeded) return 1;
  1814. }
  1815. return 0;
  1816. }
  1817. stock ResetPlayerCash(playerid)
  1818. {
  1819. PlayerInfo[playerid][pCash] = 0;
  1820. ResetPlayerMoney(playerid);
  1821. return 1;
  1822. }
  1823. stock SendTeamBeepMessage(color, string[])
  1824. {
  1825. foreach(new i: Player)
  1826. {
  1827. if(IsACop(i))
  1828. {
  1829. SendClientMessageEx(i, color, string);
  1830. RingTone[i] = 20;
  1831. }
  1832. }
  1833. }
  1834. stock number_format(number)
  1835. {
  1836. new i, string[15];
  1837. FIXES_valstr(string, number);
  1838. if(strfind(string, "-") != -1) i = strlen(string) - 4;
  1839. else i = strlen(string) - 3;
  1840. while (i >= 1)
  1841. {
  1842. if(strfind(string, "-") != -1) strins(string, ",", i + 1);
  1843. else strins(string, ",", i);
  1844. i -= 3;
  1845. }
  1846. return string;
  1847. }
  1848. stock abs(value)
  1849. {
  1850. return ((value < 0 ) ? (-value) : (value));
  1851. }
  1852. stock str_replace(sSearch[], sReplace[], const sSubject[], &iCount = 0)
  1853. {
  1854. new
  1855. iLengthTarget = strlen(sSearch),
  1856. iLengthReplace = strlen(sReplace),
  1857. iLengthSource = strlen(sSubject),
  1858. iItterations = (iLengthSource - iLengthTarget) + 1;
  1859. new
  1860. sTemp[128],
  1861. sReturn[128];
  1862. strcat(sReturn, sSubject, 256);
  1863. iCount = 0;
  1864. for(new iIndex; iIndex < iItterations; ++iIndex)
  1865. {
  1866. strmid(sTemp, sReturn, iIndex, (iIndex + iLengthTarget), (iLengthTarget + 1));
  1867. if(!strcmp(sTemp, sSearch, false))
  1868. {
  1869. strdel(sReturn, iIndex, (iIndex + iLengthTarget));
  1870. strins(sReturn, sReplace, iIndex, iLengthReplace);
  1871. iIndex += iLengthTarget;
  1872. iCount++;
  1873. }
  1874. }
  1875. return sReturn;
  1876. }
  1877. stock SaveAllAccountsUpdate()
  1878. {
  1879. foreach(new i: Player)
  1880. {
  1881. if(gPlayerLogged{i}) {
  1882. GetPlayerIp(i, PlayerInfo[i][pIP], 16);
  1883. SetPVarInt(i, "AccountSaving", 1);
  1884. OnPlayerStatsUpdate(i);
  1885. break; // We only need to save one person at a time.
  1886. }
  1887. }
  1888. }
  1889. stock SetPlayerToTeamColor(playerid)
  1890. {
  1891. if(IsPlayerConnected(playerid))
  1892. {
  1893. if(PlayerInfo[playerid][pWantedLevel] > 0) {
  1894. SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWantedLevel]);
  1895. }
  1896. #if defined zombiemode
  1897. if(GetPVarType(playerid, "pZombieBit"))
  1898. {
  1899. SetPlayerColor(playerid, 0xFFCC0000);
  1900. return 1;
  1901. }
  1902. if(GetPVarType(playerid, "pIsZombie"))
  1903. {
  1904. SetPlayerColor(playerid, 0x0BC43600);
  1905. return 1;
  1906. }
  1907. if(GetPVarType(playerid, "pEventZombie"))
  1908. {
  1909. SetPlayerColor(playerid, 0x0BC43600);
  1910. return 1;
  1911. }
  1912. #endif
  1913. if(GetPVarType(playerid, "IsInArena"))
  1914. {
  1915. new arenaid = GetPVarInt(playerid, "IsInArena");
  1916. if(PaintBallArena[arenaid][pbGameType] == 2 || PaintBallArena[arenaid][pbGameType] == 3 || PaintBallArena[arenaid][pbGameType] == 5) switch(PlayerInfo[playerid][pPaintTeam]) {
  1917. case 1: SetPlayerColor(playerid, PAINTBALL_TEAM_RED);
  1918. case 2: SetPlayerColor(playerid, PAINTBALL_TEAM_BLUE);
  1919. }
  1920. }
  1921. else if(PlayerInfo[playerid][pJailTime] > 0) {
  1922. if(strfind(PlayerInfo[playerid][pPrisonReason], "[IC]", true) != -1 || strfind(PlayerInfo[playerid][pPrisonReason], "[ISOLATE]", true) != -1) {
  1923. SetPlayerColor(playerid,TEAM_ORANGE_COLOR);
  1924. }
  1925. else if(strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) {
  1926. SetPlayerColor(playerid,TEAM_APRISON_COLOR);
  1927. }
  1928. }
  1929. else if(PlayerInfo[playerid][pBeingSentenced] != 0)
  1930. {
  1931. SetPlayerColor(playerid, SHITTY_JUDICIALSHITHOTCH);
  1932. }
  1933. else if((PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pJob3] == 17 || PlayerInfo[playerid][pTaxiLicense] == 1) && TransportDuty[playerid] != 0) {
  1934. SetPlayerColor(playerid,TEAM_TAXI_COLOR);
  1935. }
  1936. else if(0 <= PlayerInfo[playerid][pMember] < MAX_GROUPS && PlayerInfo[playerid][pDuty]) {
  1937. if(GetPVarType(playerid, "MedBadge")) {
  1938. DeletePVar(playerid, "MedBadge");
  1939. if(arrGroupData[PlayerInfo[playerid][pMember]][g_iAllegiance] == 1) {
  1940. SetPlayerColor(playerid, 0xFF828200);
  1941. }
  1942. else SetPlayerColor(playerid, 0x9569BF00);
  1943. }
  1944. else SetPlayerColor(playerid, arrGroupData[PlayerInfo[playerid][pMember]][g_hDutyColour] * 256);
  1945. }
  1946. else if(GetPVarType(playerid, "HitmanBadgeColour") && IsAHitman(playerid))
  1947. {
  1948. SetPlayerColor(playerid, GetPVarInt(playerid, "HitmanBadgeColour"));
  1949. }
  1950. else {
  1951. SetPlayerColor(playerid,TEAM_HIT_COLOR);
  1952. }
  1953. }
  1954. return 1;
  1955. }
  1956. stock strfindcount(substring[], string[], bool:ignorecase = false, startpos = 0)
  1957. {
  1958. new ncount, start = strfind(string, substring, ignorecase, startpos);
  1959. while(start >- 1)
  1960. {
  1961. start = strfind(string, substring, ignorecase, start + strlen(substring));
  1962. ncount++;
  1963. }
  1964. return ncount;
  1965. }
  1966. stock IsInvalidSkin(skin) {
  1967. if(!(0 <= skin <= 311)) return 1;
  1968. return 0;
  1969. }
  1970. stock IsKeyJustDown(key, newkeys, oldkeys)
  1971. {
  1972. if((newkeys & key) && !(oldkeys & key)) return 1;
  1973. return 0;
  1974. }
  1975. stock UpdateWheelTarget()
  1976. {
  1977. gCurrentTargetYAngle += 36.0; // There are 10 carts, so 360 / 10
  1978. if(gCurrentTargetYAngle >= 360.0) {
  1979. gCurrentTargetYAngle = 0.0;
  1980. }
  1981. if(gWheelTransAlternate) gWheelTransAlternate = 0;
  1982. else gWheelTransAlternate = 1;
  1983. }
  1984. stock Random(min, max)
  1985. {
  1986. new a = random(max - min) + min;
  1987. return a;
  1988. }
  1989. forward ResetVariables();
  1990. public ResetVariables()
  1991. {
  1992. for(new i = 1; i < MAX_VEHICLES; i++) {
  1993. DynVeh[i] = -1;
  1994. TruckDeliveringTo[i] = INVALID_BUSINESS_ID;
  1995. }
  1996. if(Jackpot < 0) Jackpot = 0;
  1997. if(TaxValue < 0) TaxValue = 0;
  1998. for(new i = 0; i < MAX_VEHICLES; ++i) {
  1999. VehicleFuel[i] = 100.0;
  2000. }
  2001. for(new i = 0; i < sizeof(CreatedCars); ++i) {
  2002. CreatedCars[i] = INVALID_VEHICLE_ID;
  2003. }
  2004. EventKernel[EventRequest] = INVALID_PLAYER_ID;
  2005. EventKernel[EventCreator] = INVALID_PLAYER_ID;
  2006. for(new x; x < sizeof(EventKernel[EventStaff]); x++) {
  2007. EventKernel[EventStaff][x] = INVALID_PLAYER_ID;
  2008. }
  2009. print("Resetting default server variables..");
  2010. return 1;
  2011. }
  2012. forward ResetNews();
  2013. public ResetNews()
  2014. {
  2015. News[hTaken1] = 0; News[hTaken2] = 0; News[hTaken3] = 0; News[hTaken4] = 0; News[hTaken5] = 0; new string[32];
  2016. for(new i = 0; i < 6; i++)
  2017. {
  2018. format(string, sizeof(string), "News[hAdd%d]", i);
  2019. strcat(string, "Nothing");
  2020. format(string, sizeof(string), "News[hContact%d]", i);
  2021. strcat(string, "No-one");
  2022. }
  2023. print("Resetting news...");
  2024. return true;
  2025. }
  2026. /*
  2027. forward Float: GetPlayerSpeed(playerid);
  2028. public Float: GetPlayerSpeed(playerid)
  2029. {
  2030. new Float: fVelocity[3];
  2031. GetPlayerVelocity(playerid, fVelocity[0], fVelocity[1], fVelocity[2]);
  2032. return floatsqroot((fVelocity[0] * fVelocity[0]) + (fVelocity[1] * fVelocity[1]) + (fVelocity[2] * fVelocity[2])) * 100;
  2033. }
  2034. */
  2035. forward HidePlayerTextDraw(playerid, PlayerText:txd);
  2036. public HidePlayerTextDraw(playerid, PlayerText:txd) return PlayerTextDrawHide(playerid, txd);
  2037. forward DG_AutoReset();
  2038. public DG_AutoReset()
  2039. {
  2040. for(new i = 0; i < sizeof(dgVar); i++)
  2041. {
  2042. if(dgVar[dgItems:i][0] == 1 && dgVar[dgItems:i][1] == 0)
  2043. {
  2044. dgVar[dgItems:i][1] += dgAmount;
  2045. }
  2046. }
  2047. }
  2048. stock GetFirstName(playerid)
  2049. {
  2050. new name[MAX_PLAYER_NAME], underscore;
  2051. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  2052. underscore = strfind(name, "_");
  2053. strdel(name, underscore, MAX_PLAYER_NAME);
  2054. return name;
  2055. }
  2056. stock GetLastName(playerid)
  2057. {
  2058. new name[MAX_PLAYER_NAME], underscore;
  2059. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  2060. underscore = strfind(name, "_");
  2061. strdel(name, 0, underscore+1);
  2062. return name;
  2063. }
  2064. /*ShowPlayerHolsterDialog(playerid)
  2065. {
  2066. new szString[128];
  2067. for(new i = 0; i < 12; i++)
  2068. {
  2069. if(PlayerInfo[playerid][pGuns][i] == 0 && i == 0)
  2070. {
  2071. format(szString, sizeof(szString), "%s\n", ReturnWeaponName(PlayerInfo[playerid][pGuns][i]));
  2072. }
  2073. else if(PlayerInfo[playerid][pGuns][i] != 0 && i > 0)
  2074. {
  2075. format(szString, sizeof(szString), "%s%s\n", szString, ReturnWeaponName(PlayerInfo[playerid][pGuns][i]));
  2076. }
  2077. else
  2078. {
  2079. format(szString, sizeof(szString), "%sN/A\n", szString);
  2080. }
  2081. }
  2082. return ShowPlayerDialogEx(playerid, DIALOG_HOLSTER, DIALOG_STYLE_LIST, "Holster Menu", szString, "Select", "Cancel");
  2083. }*/
  2084. stock randomString(strDest[], strLen = 10)
  2085. {
  2086. while(strLen--) strDest[strLen] = random(2) ? (random(26) + (random(2) ? 'a' : 'A')) : (random(10) + '0');
  2087. }
  2088. /*
  2089. CanGetVIPWeapon(playerid)
  2090. {
  2091. switch(PlayerInfo[playerid][pDonateRank])
  2092. {
  2093. case 1: return 1;
  2094. case 2: return 1;
  2095. case 3: if(PlayerInfo[playerid][pVIPGuncount] < 4) return 1;
  2096. case 4: if(PlayerInfo[playerid][pVIPGuncount] < 8) return 1;
  2097. }
  2098. return 0;
  2099. }*/
  2100. SpawnPlayerInPrisonCell(playerid, cellid)
  2101. {
  2102. switch(cellid)
  2103. {
  2104. case 0: {
  2105. SetPlayerPos(playerid, 566.7456,1444.0634,6000.4571);
  2106. Player_StreamPrep(playerid, 566.7456,1444.0634,6000.4571, FREEZE_TIME + 4000);
  2107. }
  2108. case 1: {
  2109. SetPlayerPos(playerid, 563.0581,1444.1854,6000.4571);
  2110. Player_StreamPrep(playerid, 563.0581,1444.1854,6000.4571, FREEZE_TIME + 4000);
  2111. }
  2112. case 2: {
  2113. SetPlayerPos(playerid, 559.4159,1443.9288,6000.4571);
  2114. Player_StreamPrep(playerid, 559.4159,1443.9288,6000.4571, FREEZE_TIME + 4000);
  2115. }
  2116. case 3: {
  2117. SetPlayerPos(playerid, 555.6315,1444.2306,6000.4571);
  2118. Player_StreamPrep(playerid, 555.6315,1444.2306,6000.4571, FREEZE_TIME + 4000);
  2119. }
  2120. case 4: {
  2121. SetPlayerPos(playerid, 552.0065,1444.1968,6000.4571);
  2122. Player_StreamPrep(playerid, 552.0065,1444.1968,6000.4571, FREEZE_TIME + 4000);
  2123. }
  2124. case 5: {
  2125. SetPlayerPos(playerid, 548.0844,1444.0985,6000.4571);
  2126. Player_StreamPrep(playerid, 548.0844,1444.0985,6000.4571, FREEZE_TIME + 4000);
  2127. }
  2128. case 6: {
  2129. SetPlayerPos(playerid, 544.6454,1444.1449,6000.4571);
  2130. Player_StreamPrep(playerid, 544.6454,1444.1449,6000.4571, FREEZE_TIME + 4000);
  2131. }
  2132. case 7: {
  2133. SetPlayerPos(playerid, 540.5981,1447.5231,6000.4571);
  2134. Player_StreamPrep(playerid, 540.5981,1447.5231,6000.4571, FREEZE_TIME + 4000);
  2135. }
  2136. case 8: {
  2137. SetPlayerPos(playerid, 540.4813,1450.9047,6000.4571);
  2138. Player_StreamPrep(playerid, 540.4813,1450.9047,6000.4571, FREEZE_TIME + 4000);
  2139. }
  2140. case 9: {
  2141. SetPlayerPos(playerid, 540.4357,1454.4258,6000.4571);
  2142. Player_StreamPrep(playerid, 540.4357,1454.4258,6000.4571, FREEZE_TIME + 4000);
  2143. }
  2144. case 10: {
  2145. SetPlayerPos(playerid, 540.7283,1458.2170,6000.4571);
  2146. Player_StreamPrep(playerid, 540.7283,1458.2170,6000.4571, FREEZE_TIME + 4000);
  2147. }
  2148. case 11: {
  2149. SetPlayerPos(playerid, 544.1293,1464.5228,6000.4571);
  2150. Player_StreamPrep(playerid, 544.1293,1464.5228,6000.4571, FREEZE_TIME + 4000);
  2151. }
  2152. case 12: {
  2153. SetPlayerPos(playerid, 547.7798,1464.7081,6000.4571);
  2154. Player_StreamPrep(playerid, 547.7798,1464.7081,6000.4571, FREEZE_TIME + 4000);
  2155. }
  2156. case 13: {
  2157. SetPlayerPos(playerid, 551.2144,1464.6027,6000.4571);
  2158. Player_StreamPrep(playerid, 551.2144,1464.6027,6000.4571, FREEZE_TIME + 4000);
  2159. }
  2160. case 14: {
  2161. SetPlayerPos(playerid, 557.2998,1464.8198,6000.4571);
  2162. Player_StreamPrep(playerid, 557.2998,1464.8198,6000.4571, FREEZE_TIME + 4000);
  2163. }
  2164. // end of first floor
  2165. case 15: {
  2166. SetPlayerPos(playerid, 566.3901,1443.7551,6004.4946);
  2167. Player_StreamPrep(playerid, 566.3901,1443.7551,6004.4946, FREEZE_TIME + 4000);
  2168. }
  2169. case 16: {
  2170. SetPlayerPos(playerid, 562.5015,1443.7295,6004.4946);
  2171. Player_StreamPrep(playerid, 562.5015,1443.7295,6004.4946, FREEZE_TIME + 4000);
  2172. }
  2173. case 17: {
  2174. SetPlayerPos(playerid, 2559.0636,1444.0476,6004.4946);
  2175. Player_StreamPrep(playerid, 2559.0636,1444.0476,6004.4946, FREEZE_TIME + 4000);
  2176. }
  2177. case 18: {
  2178. SetPlayerPos(playerid, 555.3583,1444.0355,6004.4946);
  2179. Player_StreamPrep(playerid, 555.3583,1444.0355,6004.4946, FREEZE_TIME + 4000);
  2180. }
  2181. case 19: {
  2182. SetPlayerPos(playerid, 551.9474,1443.7928,6004.4946);
  2183. Player_StreamPrep(playerid, 551.9474,1443.7928,6004.4946, FREEZE_TIME + 4000);
  2184. }
  2185. case 20: {
  2186. SetPlayerPos(playerid, 548.2891,1444.0117,6004.4946);
  2187. Player_StreamPrep(playerid, 548.2891,1444.0117,6004.4946, FREEZE_TIME + 4000);
  2188. }
  2189. case 21: {
  2190. SetPlayerPos(playerid, 544.8405,1444.0632,6004.4946);
  2191. Player_StreamPrep(playerid, 544.8405,1444.0632,6004.4946, FREEZE_TIME + 4000);
  2192. }
  2193. case 22: {
  2194. SetPlayerPos(playerid, 540.6741,1447.4341,6004.4946);
  2195. Player_StreamPrep(playerid, 540.6741,1447.4341,6004.4946, FREEZE_TIME + 4000);
  2196. }
  2197. case 23: {
  2198. SetPlayerPos(playerid, 540.6885,1451.2081,6004.4946);
  2199. Player_StreamPrep(playerid, 540.6885,1451.2081,6004.4946, FREEZE_TIME + 4000);
  2200. }
  2201. case 24: {
  2202. SetPlayerPos(playerid, 540.7267,1454.9779,6004.4946);
  2203. Player_StreamPrep(playerid, 540.7267,1454.9779,6004.4946, FREEZE_TIME + 4000);
  2204. }
  2205. case 25: {
  2206. SetPlayerPos(playerid, 540.4955,1458.8861,6004.4946);
  2207. Player_StreamPrep(playerid, 540.4955,1458.8861,6004.4946, FREEZE_TIME + 4000);
  2208. }
  2209. case 26: {
  2210. SetPlayerPos(playerid, 543.8416,1464.8979,6004.4946);
  2211. Player_StreamPrep(playerid, 543.8416,1464.8979,6004.4946, FREEZE_TIME + 4000);
  2212. }
  2213. case 27: {
  2214. SetPlayerPos(playerid, 547.9120,1464.5593,6004.4946);
  2215. Player_StreamPrep(playerid, 547.9120,1464.5593,6004.4946, FREEZE_TIME + 4000);
  2216. }
  2217. case 28: {
  2218. SetPlayerPos(playerid, 551.5958,1464.7749,6004.4946);
  2219. Player_StreamPrep(playerid, 551.5958,1464.7749,6004.4946, FREEZE_TIME + 4000);
  2220. }
  2221. case 29: {
  2222. SetPlayerPos(playerid, 557.6133,1464.9932,6004.4946);
  2223. Player_StreamPrep(playerid, 557.6133,1464.9932,6004.4946, FREEZE_TIME + 4000);
  2224. }
  2225. // end of second floor
  2226. }
  2227. return 1;
  2228. }
  2229. /*
  2230. stock WindowStatusForChat(sendid, receiveid)
  2231. {
  2232. new SendWindow[4], ReceiveWindow[4];
  2233. if(GetPlayerVehicleID(sendid) && GetPlayerVehicleID(receiveid))
  2234. {
  2235. GetVehicleParamsCarWindows(GetPlayerVehicleID(sendid), SendWindow[0], SendWindow[1], SendWindow[2], SendWindow[3]);
  2236. GetVehicleParamsCarWindows(GetPlayerVehicleID(receiveid), ReceiveWindow[0], ReceiveWindow[1], ReceiveWindow[2], ReceiveWindow[3]);
  2237. if(GetPlayerVehicleID(sendid) == GetPlayerVehicleID(receiveid)) return 1;
  2238. else if(NoWindows(GetPlayerVehicleID(sendid)) && NoWindows(GetPlayerVehicleID(receiveid))) return 1;
  2239. else if(NoWindows(GetPlayerVehicleID(receiveid)) && SendWindow[GetPlayerVehicleSeat(sendid)] == 0) return 1;
  2240. else if(NoWindows(GetPlayerVehicleID(sendid)) && ReceiveWindow[GetPlayerVehicleSeat(receiveid)] == 0) return 1;
  2241. else if(SendWindow[GetPlayerVehicleSeat(sendid)] == 0 && ReceiveWindow[GetPlayerVehicleSeat(receiveid)] == 0) return 1;
  2242. else return 0;
  2243. }
  2244. else if(GetPlayerVehicleID(sendid) && !GetPlayerVehicleID(receiveid))
  2245. {
  2246. GetVehicleParamsCarWindows(GetPlayerVehicleID(sendid), SendWindow[0], SendWindow[1], SendWindow[2], SendWindow[3]);
  2247. if(NoWindows(GetPlayerVehicleID(sendid))) return 1;
  2248. else if(SendWindow[GetPlayerVehicleSeat(sendid)] == 0) return 1;
  2249. else return 0;
  2250. }
  2251. else if(!GetPlayerVehicleID(sendid) && GetPlayerVehicleID(receiveid))
  2252. {
  2253. GetVehicleParamsCarWindows(GetPlayerVehicleID(receiveid), ReceiveWindow[0], ReceiveWindow[1], ReceiveWindow[2], ReceiveWindow[3]);
  2254. if(NoWindows(GetPlayerVehicleID(receiveid))) return 1;
  2255. else if(ReceiveWindow[GetPlayerVehicleSeat(receiveid)] == 0) return 1;
  2256. else return 0;
  2257. }
  2258. return 1;
  2259. }*/
  2260. stock PlayerBusy(target) {
  2261. if(GetPVarType(target, "PlayerCuffed") ||
  2262. GetPVarInt(target, "pBagged") >= 1 ||
  2263. GetPVarType(target, "Injured") ||
  2264. GetPVarType(target, "IsFrozen") ||
  2265. PlayerInfo[target][pHospital] > 0 ||
  2266. GetPVarType(target, "IsInArena") ||
  2267. GetPVarInt(target, "EventToken") != 0)
  2268. return 1;
  2269. else return 0;
  2270. }
  2271. stock TakePlayerMoney(playerid, amount) {
  2272. if(GetPlayerCash(playerid) > amount) {
  2273. GivePlayerCash(playerid, -amount);
  2274. return 1;
  2275. }
  2276. if(PlayerInfo[playerid][pAccount] > amount) {
  2277. PlayerInfo[playerid][pAccount] -= amount;
  2278. return 1;
  2279. }
  2280. return 0;
  2281. }