hitman.pwn 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Contract Group Type
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. #include <YSI\y_hooks>
  34. // The new proposed Hitman Agency system. Approved by Rizi & Chapman on 07/08/16.
  35. // Relevant Documentation: https://docs.google.com/document/d/1rJzSK7MiNKJQOVSdhtc6RXgUr_X5ixkMYaG6nDvgTFc/
  36. #define COLOR_HMARADIO 0x008BE8FF
  37. #define COLOR_HMAOOC 0x00FFFFFF
  38. //new Float:fHMASafe_Loc[3];
  39. //new iHMASafe_Val = 0;
  40. //new File:HMAFile, iFileLoaded = 0;
  41. /****** Stocks & Functions ******/
  42. hook OnGameModeInit()
  43. {
  44. if(!fexist("hma.cfg"))
  45. {
  46. new File:NewFile = fopen("hma.cfg", io_write);
  47. fwrite(NewFile, "1415.727905\r\n");
  48. fwrite(NewFile, "-1299.371093\r\n");
  49. fwrite(NewFile, "15.054657\r\n");
  50. fwrite(NewFile, "0\r\n");
  51. fwrite(NewFile, "New Agency!\r");
  52. fclose(NewFile);
  53. }
  54. HMAFile = fopen("hma.cfg", io_readwrite);
  55. new szTemp[128];
  56. for(new i = 0; i < 3; i++)
  57. {
  58. // Load position of safe.
  59. fread(HMAFile, szTemp, sizeof szTemp);
  60. fHMASafe_Loc[i] = floatstr(szTemp);
  61. }
  62. // Load safe value.
  63. fread(HMAFile, szTemp, sizeof szTemp);
  64. iHMASafe_Val = strval(szTemp);
  65. // Load MOTD
  66. fread(HMAFile, HMAMOTD, sizeof HMAMOTD);
  67. iFileLoaded = 1;
  68. }
  69. hook OnGameModeExit()
  70. {
  71. fclose(HMAFile);
  72. }
  73. stock GetPlayerIDEx(playername[]) // Uncomment this
  74. {
  75. for(new i = 0; i <= MAX_PLAYERS; i++)
  76. {
  77. if(IsPlayerConnected(i))
  78. {
  79. new szName[MAX_PLAYER_NAME];
  80. GetPlayerName(i, szName, sizeof szName);
  81. if(strcmp(szName, playername, true, strlen(szName)) == 0)
  82. {
  83. return i;
  84. }
  85. }
  86. }
  87. return INVALID_PLAYER_ID;
  88. }
  89. forward PickUpC4(playerid);
  90. public PickUpC4(playerid)
  91. {
  92. DestroyDynamicObject(PlayerInfo[playerid][pC4]);
  93. PlayerInfo[playerid][pC4] = 0;
  94. return 1;
  95. }
  96. stock IsAHitman(playerid)
  97. {
  98. if(PlayerInfo[playerid][pHitman] > -1) return 1;
  99. return 0;
  100. }
  101. stock IsAHitmanLeader(playerid)
  102. {
  103. if(PlayerInfo[playerid][pHitmanLeader] == 1) return 1;
  104. return 0;
  105. }
  106. stock IsBlacklisted(playerid)
  107. {
  108. if(PlayerInfo[playerid][pHitmanBlacklisted] > 0) return 1;
  109. return 0;
  110. }
  111. stock GetHitmanRank(playerid)
  112. {
  113. new szRank[25];
  114. switch(PlayerInfo[playerid][pHitman])
  115. {
  116. case 0: format(szRank, sizeof szRank, "Freelancer");
  117. case 1: format(szRank, sizeof szRank, "Agent");
  118. case 2: format(szRank, sizeof szRank, "Marksman");
  119. case 3: format(szRank, sizeof szRank, "Operative");
  120. case 4: format(szRank, sizeof szRank, "Specialist");
  121. case 5: format(szRank, sizeof szRank, "Vice Director");
  122. case 6: format(szRank, sizeof szRank, "Director");
  123. default: format(szRank, sizeof szRank, "null"); // Player is not a valid hitman.
  124. }
  125. return szRank;
  126. }
  127. stock SaveHitmanSafe()
  128. {
  129. if(HMAFile)
  130. {
  131. // For some reason it was appending the file instead of overwriting. Temporary fix.
  132. fclose(HMAFile);
  133. fremove("hma.cfg");
  134. HMAFile = fopen("hma.cfg", io_readwrite);
  135. format(szMiscArray, sizeof szMiscArray, "%f\r\n%f\r\n%f\r\n%d\r\n%s", fHMASafe_Loc[0], fHMASafe_Loc[1], fHMASafe_Loc[2], iHMASafe_Val, HMAMOTD);
  136. fwrite(HMAFile, szMiscArray);
  137. }
  138. else
  139. {
  140. Log("logs/hitman.log", "Error saving hitman safe (file not open).");
  141. }
  142. }
  143. /****** Commands ******/
  144. CMD:toghma(playerid, params[])
  145. {
  146. if(!IsAHitman(playerid)) return 0;
  147. //if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /toghma [ic or ooc]");
  148. if(GetPVarInt(playerid, "DisableHMAChat"))
  149. {
  150. DeletePVar(playerid, "DisableHMAChat");
  151. SendClientMessageEx(playerid, COLOR_WHITE, "You have enabled the Hitman Agency chats.");
  152. }
  153. else
  154. {
  155. SetPVarInt(playerid, "DisableHMAChat", 1);
  156. SendClientMessageEx(playerid, COLOR_WHITE, "You have disabled the Hitman Agency chats.");
  157. }
  158. return 1;
  159. }
  160. CMD:hr(playerid, params[])
  161. {
  162. if(!IsAHitman(playerid)) return 0;
  163. else if(GetPVarInt(playerid, "DisableHMAChat")) return SendClientMessageEx(playerid, COLOR_WHITE, "Your Hitman Agency chats are disabled. Please re-enable it using /toghma.");
  164. else if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /hr [text]");
  165. foreach(new i: Player) if(IsAHitman(i) && !GetPVarInt(playerid, "DisableHMAChat")) SendClientMessageEx(i, COLOR_HMARADIO, "** [IC] %s %s: %s **", GetHitmanRank(playerid), GetPlayerNameEx(playerid), params);
  166. return 1;
  167. }
  168. CMD:hg(playerid, params[])
  169. {
  170. if(!IsAHitman(playerid)) return 0;
  171. else if(GetPVarInt(playerid, "DisableHMAChat")) return SendClientMessageEx(playerid, COLOR_WHITE, "Your Hitman Agency chats are disabled. Please re-enable it using /toghma.");
  172. else if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /hg [text]");
  173. format(szMiscArray, sizeof szMiscArray, "** [OOC] %s (%d) %s: %s **", GetHitmanRank(playerid), PlayerInfo[playerid][pHitman], GetPlayerNameEx(playerid), params);
  174. foreach(new i: Player) if(IsAHitman(i) && !GetPVarInt(playerid, "DisableHMAChat")) SendClientMessageEx(i, COLOR_HMAOOC, szMiscArray);
  175. return 1;
  176. }
  177. CMD:plantcarbomb(playerid, params[]) {
  178. return cmd_pcb(playerid, params);
  179. }
  180. CMD:pcb(playerid, params[])
  181. {
  182. if (IsAHitman(playerid))
  183. {
  184. if(PlayerInfo[playerid][pC4] == 0)
  185. {
  186. if(PlayerInfo[playerid][pBombs] != 0)
  187. {
  188. new carid = GetPlayerVehicleID(playerid);
  189. new closestcar = GetClosestCar(playerid, carid);
  190. if(IsPlayerInRangeOfVehicle(playerid, closestcar, 4.0))
  191. {
  192. if(VehicleBomb{closestcar} == 1)
  193. {
  194. SendClientMessageEx(playerid, COLOR_GRAD2, "There is already a C4 on the vehicle engine!");
  195. return 1;
  196. }
  197. VehicleBomb{closestcar} = 1;
  198. PlacedVehicleBomb[playerid] = closestcar;
  199. ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
  200. ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
  201. SendClientMessageEx(playerid, COLOR_GREEN, "You have placed C4 on the vehicle engine, /pickupbomb to remove it.");
  202. PlayerInfo[playerid][pC4] = 1;
  203. PlayerInfo[playerid][pBombs]--;
  204. PlayerInfo[playerid][pC4Used] = 2;
  205. }
  206. else
  207. {
  208. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not close enough to any vehicle!");
  209. return 1;
  210. }
  211. }
  212. else
  213. {
  214. SendClientMessageEx(playerid, COLOR_GRAD2, "You do not have C4!");
  215. return 1;
  216. }
  217. }
  218. else
  219. {
  220. SendClientMessageEx(playerid, COLOR_GRAD2, " You can only deploy 1 C4 at a time.");
  221. return 1;
  222. }
  223. }
  224. else
  225. {
  226. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not a member of the Hitman Agency");
  227. }
  228. return 1;
  229. }
  230. CMD:gotohmasafe(playerid, params[])
  231. {
  232. if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionModerator] != 0 && PlayerInfo[playerid][pAdmin] >= 4)
  233. {
  234. if(!iFileLoaded) return SendClientMessage(playerid, COLOR_GREY, "There was an error loading the Hitman Agency safe. A server restart is needed.");
  235. SetPlayerPos(playerid, fHMASafe_Loc[0], fHMASafe_Loc[1], fHMASafe_Loc[2]);
  236. SendClientMessage(playerid, COLOR_GRAD2, " You have been teleported to the Hitman Agency's safe.");
  237. }
  238. else return 0;
  239. return 1;
  240. }
  241. CMD:edithmasafepos(playerid, params[])
  242. {
  243. if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionModerator] != 0 && PlayerInfo[playerid][pAdmin] >= 4)
  244. {
  245. if(!iFileLoaded) return SendClientMessage(playerid, COLOR_GREY, "There was an error loading the Hitman Agency safe. A server restart is needed.");
  246. new Float:fPos[3];
  247. GetPlayerPos(playerid, fPos[0], fPos[1], fPos[2]);
  248. for(new i = 0; i < 3; i++) fHMASafe_Loc[i] = fPos[i];
  249. SaveHitmanSafe();
  250. SendClientMessage(playerid, COLOR_GRAD2, " Hitman agency safe position edited successfully.");
  251. format(szMiscArray, sizeof szMiscArray, "Administrator %s has edited the safe position to X: %f, Y: %f, Z: %f.", GetPlayerNameEx(playerid), fHMASafe_Loc[0], fHMASafe_Loc[1], fHMASafe_Loc[2]);
  252. new file[256], month, day, year;
  253. getdate(year,month,day);
  254. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  255. Log(file, szMiscArray);
  256. }
  257. else return SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
  258. return 1;
  259. }
  260. CMD:hmasafedeposit(playerid, params[])
  261. {
  262. if(IsAHitmanLeader(playerid))
  263. {
  264. if(!iFileLoaded) return SendClientMessage(playerid, COLOR_GREY, "There was an error loading the Hitman Agency safe. A server restart is needed.");
  265. if(!IsPlayerInRangeOfPoint(playerid, 5.0, fHMASafe_Loc[0], fHMASafe_Loc[1], fHMASafe_Loc[2])) return SendClientMessage(playerid, COLOR_GRAD2, "You are not in range of the Agency's safe.");
  266. new iVal;
  267. if(sscanf(params, "d", iVal)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /hmasafedeposit [amount]");
  268. if(iVal < 1 || iVal > 99999999) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid amount specified. Valid amounts are between $1 and $99,999,999.");
  269. if(iVal > GetPlayerCash(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have that much money.");
  270. iHMASafe_Val += iVal;
  271. GivePlayerCash(playerid, -iVal);
  272. SaveHitmanSafe();
  273. format(szMiscArray, sizeof szMiscArray, "$%s has been deposited into the Agency's safe. Current balance: $%s.", number_format(iVal), number_format(iHMASafe_Val));
  274. SendClientMessage(playerid, COLOR_GRAD2, szMiscArray);
  275. format(szMiscArray, sizeof szMiscArray, "[SAFE DEPOSIT] %s %s | $%s deposited (total balance: $%s)", GetHitmanRank(playerid), GetPlayerNameEx(playerid), number_format(iVal), number_format(iHMASafe_Val));
  276. new file[256], month, day, year;
  277. getdate(year,month,day);
  278. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  279. Log(file, szMiscArray);
  280. }
  281. else return 0;
  282. return 1;
  283. }
  284. CMD:hmasafewithdraw(playerid, params[])
  285. {
  286. if(IsAHitmanLeader(playerid))
  287. {
  288. if(!iFileLoaded) return SendClientMessage(playerid, COLOR_GREY, "There was an error loading the Hitman Agency safe. A server restart is needed.");
  289. if(!IsPlayerInRangeOfPoint(playerid, 5.0, fHMASafe_Loc[0], fHMASafe_Loc[1], fHMASafe_Loc[2])) return SendClientMessage(playerid, COLOR_GRAD2, "You are not in range of the Agency's safe.");
  290. new iVal;
  291. if(sscanf(params, "d", iVal)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /hmasafewithdraw [amount]");
  292. if(iVal < 1 || iVal > 99999999) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid amount specified. Valid amounts are between $1 and $99,999,999.");
  293. if(iHMASafe_Val < iVal) return SendClientMessage(playerid, COLOR_GRAD2, "The Agency's safe does not have that much money.");
  294. iHMASafe_Val -= iVal;
  295. GivePlayerCash(playerid, iVal);
  296. SaveHitmanSafe();
  297. format(szMiscArray, sizeof szMiscArray, "$%s has been withdrawn from the Agency's safe. Current balance: $%s.", number_format(iVal), number_format(iHMASafe_Val));
  298. SendClientMessage(playerid, COLOR_GRAD2, szMiscArray);
  299. format(szMiscArray, sizeof szMiscArray, "[SAFE WITHDRAW] %s %s | $%s withdrawn (total balance: $%s)", GetHitmanRank(playerid), GetPlayerNameEx(playerid), number_format(iVal), number_format(iHMASafe_Val));
  300. new file[256], month, day, year;
  301. getdate(year,month,day);
  302. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  303. Log(file, szMiscArray);
  304. }
  305. else return 0;
  306. return 1;
  307. }
  308. CMD:hmasafe(playerid, params[])
  309. {
  310. if(IsAHitmanLeader(playerid))
  311. {
  312. if(!iFileLoaded) return SendClientMessage(playerid, COLOR_GREY, "There was an error loading the Hitman Agency safe. A server restart is needed.");
  313. if(!IsPlayerInRangeOfPoint(playerid, 5.0, fHMASafe_Loc[0], fHMASafe_Loc[1], fHMASafe_Loc[2])) return SendClientMessage(playerid, COLOR_GRAD2, "You are not in range of the Agency's safe.");
  314. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  315. format(szMiscArray, sizeof szMiscArray, "Hitman Agency - Safe Balance: $%s", number_format(iHMASafe_Val));
  316. SendClientMessage(playerid, COLOR_GRAD3, szMiscArray);
  317. SendClientMessage(playerid, COLOR_GRAD2, "/hmasafewithdraw, /hmasafedeposit");
  318. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  319. }
  320. else return 0;
  321. return 1;
  322. }
  323. CMD:sethmamotd(playerid, params[])
  324. {
  325. if(!IsAHitmanLeader(playerid)) return 0;
  326. if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /sethmamotd [motd]");
  327. format(HMAMOTD, sizeof HMAMOTD, params);
  328. format(szMiscArray, sizeof szMiscArray, "Agency MOTD changed! The new MOTD is: {FFFFFF}%s", HMAMOTD);
  329. foreach(new i: Player) if(IsAHitman(i)) SendClientMessage(i, COLOR_GRAD1, szMiscArray);
  330. SaveHitmanSafe();
  331. return 1;
  332. }
  333. CMD:givehit(playerid, params[])
  334. {
  335. if(IsAHitmanLeader(playerid))
  336. {
  337. new string[128], giveplayerid, targetid;
  338. if(sscanf(params, "uu", giveplayerid, targetid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /givehit [player] [targetid]");
  339. if(IsPlayerConnected(giveplayerid))
  340. {
  341. if(GoChase[giveplayerid] != INVALID_PLAYER_ID)
  342. {
  343. SendClientMessageEx(playerid, COLOR_GREY, " That Hitman is already busy with a Contract!");
  344. return 1;
  345. }
  346. if(GotHit[targetid] == 1)
  347. {
  348. SendClientMessageEx(playerid, COLOR_GREY, " Another hitman has already assigned this target!");
  349. return 1;
  350. }
  351. if(IsPlayerConnected(targetid))
  352. {
  353. if(PlayerInfo[targetid][pHeadValue] == 0)
  354. {
  355. SendClientMessageEx(playerid, COLOR_GREY, " That target doesn't have a contract on them!");
  356. return 1;
  357. }
  358. format(string, sizeof(string), "* You offered %s a contract to kill %s.", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(targetid));
  359. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  360. format(string, sizeof(string), "* Hitman %s has offered you a contract to kill %s (type /accept contract), to accept it.", GetPlayerNameEx(playerid), GetPlayerNameEx(targetid));
  361. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  362. HitOffer[giveplayerid] = playerid;
  363. HitToGet[giveplayerid] = targetid;
  364. return 1;
  365. }
  366. else
  367. {
  368. SendClientMessageEx(playerid, COLOR_GREY, " The contracted person is offline, use /contracts!");
  369. return 1;
  370. }
  371. }
  372. else
  373. {
  374. SendClientMessageEx(playerid, COLOR_GREY, " That Hitman is not Online!");
  375. return 1;
  376. }
  377. }
  378. else return 0;
  379. }
  380. CMD:ranks(playerid, params[])
  381. {
  382. if ((!IsAHitman(playerid)) && PlayerInfo[playerid][pAdmin] < 4) return SendClientMessageEx(playerid, COLOR_GREY, "You are not a Member of the Hitman Agency!");
  383. SendClientMessageEx(playerid, COLOR_WHITE, "|__________________ Hitman Agency Online Members __________________|");
  384. new string[128];
  385. foreach(new i: Player)
  386. {
  387. if((IsAHitman(i)))
  388. {
  389. if( GoChase[playerid] == INVALID_PLAYER_ID )
  390. {
  391. format(string, sizeof(string), "* Name: %s | Rank: %s (%d) | Completed Hits: %d | Failed Hits: %d", GetPlayerNameEx(i), GetHitmanRank(i), PlayerInfo[i][pHitman], PlayerInfo[i][pCHits], PlayerInfo[i][pFHits]);
  392. SendClientMessageEx(playerid, COLOR_GREY, string);
  393. }
  394. else
  395. {
  396. format(string, sizeof(string), "* Name: %s | Rank: %s (%d) | Completed Hits: %d | Failed Hits: %d | Chasing: %s", GetPlayerNameEx(i), GetHitmanRank(i), PlayerInfo[i][pHitman], PlayerInfo[i][pCHits], PlayerInfo[i][pFHits], GetPlayerNameEx(GoChase[i]));
  397. SendClientMessageEx(playerid, COLOR_GREY, string);
  398. }
  399. }
  400. }
  401. return 1;
  402. }
  403. CMD:profile(playerid, params[])
  404. {
  405. if(IsAHitman(playerid))
  406. {
  407. new string[600], giveplayerid, employer[GROUP_MAX_NAME_LEN], rank[GROUP_MAX_RANK_LEN], division[GROUP_MAX_DIV_LEN];
  408. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /profile [player]");
  409. if(IsPlayerConnected(giveplayerid))
  410. {
  411. new str2[256];
  412. if(0 <= PlayerInfo[giveplayerid][pMember] < MAX_GROUPS)
  413. {
  414. GetPlayerGroupInfo(giveplayerid, rank, division, employer);
  415. format(str2, sizeof(str2), "%s{FF6347} | Division: {BFC0C2}%s\n{FF6347}Rank: {BFC0C2}%s (%d)\n", employer, division, rank, PlayerInfo[giveplayerid][pRank]);
  416. }
  417. else str2 = "None";
  418. format(string, sizeof(string),
  419. "{FF6347}Name: {BFC0C2}%s\n\
  420. {FF6347}Date of Birth: {BFC0C2}%s\n\
  421. {FF6347}Phone Number: {BFC0C2}%d\n\n\
  422. {FF6347}Organization: {BFC0C2}%s\n\
  423. {FF6347}Bounty: {BFC0C2}$%d\n\
  424. {FF6347}Bounty Reason: {BFC0C2}%s", GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pBirthDate], PlayerInfo[giveplayerid][pPnumber], str2, PlayerInfo[giveplayerid][pHeadValue], PlayerInfo[giveplayerid][pContractDetail]);
  425. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Target Profile", string, "OK", "");
  426. }
  427. }
  428. return 1;
  429. }
  430. CMD:viewblacklist(playerid, params[])
  431. {
  432. if(IsAHitmanLeader(playerid))
  433. {
  434. SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
  435. SendClientMessage(playerid, COLOR_GRAD1, "Hitman Agency Blacklist:");
  436. mysql_tquery(MainPipeline, "SELECT `Username`, `BlacklistReason` FROM `accounts` WHERE `HitmanBlacklisted`=1", "ShowBlacklistedPlayers", "d", playerid);
  437. }
  438. else return 0;
  439. return 1;
  440. }
  441. CMD:givehitmanrank(playerid, params[])
  442. {
  443. if(IsAHitmanLeader(playerid))
  444. {
  445. new iTarget, iRank;
  446. if(sscanf(params, "ud", iTarget, iRank)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /givehitmanrank [playerid] [rank 0-6]");
  447. new szRank[25];
  448. switch(iRank)
  449. {
  450. case 0: format(szRank, sizeof szRank, "Freelancer");
  451. case 1: format(szRank, sizeof szRank, "Agent");
  452. case 2: format(szRank, sizeof szRank, "Marksman");
  453. case 3: format(szRank, sizeof szRank, "Operative");
  454. case 4: format(szRank, sizeof szRank, "Specialist");
  455. case 5: format(szRank, sizeof szRank, "Vice Director");
  456. case 6: format(szRank, sizeof szRank, "Director");
  457. }
  458. if(!IsPlayerConnected(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
  459. if(!IsAHitman(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not a hitman.");
  460. if(iRank < 0 || iRank > 6) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid rank specified. Valid ranks are between 0 and 6.");
  461. if(PlayerInfo[iTarget][pHitman] > PlayerInfo[playerid][pHitman]) return SendClientMessage(playerid, COLOR_GRAD2, "You cannot edit the rank of a higher ranking hitman.");
  462. if(iRank == PlayerInfo[playerid][pHitman]) return SendClientMessage(playerid, COLOR_GRAD2, "That player is already the specified rank.");
  463. new szChange[12];
  464. if(iRank > PlayerInfo[iTarget][pHitman]) format(szChange, sizeof szChange, "promoted");
  465. else if(iRank < PlayerInfo[iTarget][pHitman]) format(szChange, sizeof szChange, "demoted");
  466. format(szMiscArray, sizeof szMiscArray, "%s %s has %s %s to %s (%d) from %s (%d).", GetHitmanRank(playerid), GetPlayerNameEx(playerid), szChange, GetPlayerNameEx(iTarget), szRank, iRank, GetHitmanRank(iTarget), PlayerInfo[iTarget][pHitman]);
  467. new file[256], month, day, year;
  468. getdate(year,month,day);
  469. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  470. Log(file, szMiscArray);
  471. PlayerInfo[iTarget][pHitman] = iRank;
  472. format(szMiscArray, sizeof szMiscArray, "* (hitman) You have %s %s to the rank of %s (%d).", szChange, GetPlayerNameEx(iTarget), szRank, iRank);
  473. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  474. if(iRank >= 5 && PlayerInfo[iTarget][pHitmanLeader] == 0) SendClientMessage(playerid, COLOR_LIGHTBLUE, "* The rank you have given is a leadership rank. Please contact an administrator to have it issued if necessary.");
  475. format(szMiscArray, sizeof szMiscArray, "* (hitman) %s %s has %s you to the rank of %s (%d).", GetHitmanRank(playerid), GetPlayerNameEx(playerid), szChange, szRank, iRank);
  476. SendClientMessage(iTarget, COLOR_LIGHTBLUE, szMiscArray);
  477. }
  478. else return 0;
  479. return 1;
  480. }
  481. CMD:quithma(playerid, params[])
  482. {
  483. if(!IsAHitman(playerid)) return 0;
  484. PlayerInfo[playerid][pHitman] = -1;
  485. PlayerInfo[playerid][pHitmanLeader] = 0;
  486. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have quit the Hitman Agency. Your knife has been removed.");
  487. if(PlayerInfo[playerid][pGuns][1] == 4) RemovePlayerWeapon(playerid, 4);
  488. return 1;
  489. }
  490. CMD:makehitman(playerid, params[])
  491. {
  492. if(IsAHitmanLeader(playerid))
  493. {
  494. new iTarget;
  495. if(sscanf(params, "u", iTarget)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makehitman [playerid]");
  496. if(!IsPlayerConnected(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
  497. if(IsAHitman(iTarget) || IsAHitmanLeader(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is already a hitman. To revoke it, use /removehitman.");
  498. if(IsBlacklisted(iTarget))
  499. {
  500. SendClientMessage(playerid, COLOR_GRAD2, "That player cannot be invited to the Hitman Agency as they are blacklisted.");
  501. format(szMiscArray, sizeof szMiscArray, "Reason:{FFFFFF} %s", PlayerInfo[iTarget][pBlacklistReason]);
  502. SendClientMessage(playerid, COLOR_GRAD2, szMiscArray);
  503. return 1;
  504. }
  505. PlayerInfo[iTarget][pHitman] = 0;
  506. PlayerInfo[iTarget][pHitmanLeader] = 0;
  507. format(szMiscArray, sizeof szMiscArray, "* You have made %s a hitman.", GetPlayerNameEx(iTarget));
  508. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  509. format(szMiscArray, sizeof szMiscArray, "* %s %s has made you a hitman. Use /hmahelp to see your new commands.", GetHitmanRank(playerid), GetPlayerNameEx(playerid));
  510. SendClientMessage(iTarget, COLOR_LIGHTBLUE, szMiscArray);
  511. format(szMiscArray, sizeof szMiscArray, "%s %s has made %s a hitman.", GetHitmanRank(playerid), GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget));
  512. new file[256], month, day, year;
  513. getdate(year,month,day);
  514. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  515. Log(file, szMiscArray);
  516. }
  517. else if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionModerator] != 0 && PlayerInfo[playerid][pAdmin] >= 4) // They're either a HA+ or a Senior Admin w/ FMod.
  518. {
  519. new iTarget;
  520. if(sscanf(params, "u", iTarget)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makehitman [playerid]");
  521. if(!IsPlayerConnected(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
  522. if(IsAHitman(iTarget) || IsAHitmanLeader(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is already a hitman. To revoke it, use /removehitman.");
  523. if(IsBlacklisted(iTarget))
  524. {
  525. SendClientMessage(playerid, COLOR_GRAD2, "That player cannot be invited to the Hitman Agency as they are blacklisted.");
  526. format(szMiscArray, sizeof szMiscArray, "Reason:{FFFFFF} %s", PlayerInfo[iTarget][pBlacklistReason]);
  527. SendClientMessage(playerid, COLOR_GRAD2, szMiscArray);
  528. return 1;
  529. }
  530. PlayerInfo[iTarget][pHitman] = 0;
  531. PlayerInfo[iTarget][pHitmanLeader] = 0;
  532. format(szMiscArray, sizeof szMiscArray, "* You have made %s a hitman.", GetPlayerNameEx(iTarget));
  533. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  534. format(szMiscArray, sizeof szMiscArray, "* Administrator %s has admin invited you to the Hitman Agency. Use /hmahelp to see your new commands.", GetPlayerNameEx(playerid));
  535. SendClientMessage(iTarget, COLOR_LIGHTBLUE, szMiscArray);
  536. format(szMiscArray, sizeof szMiscArray, "Administrator %s has admin invited %s to the Hitman Agency.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget));
  537. new file[256], month, day, year;
  538. getdate(year,month,day);
  539. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  540. Log(file, szMiscArray);
  541. }
  542. else return 0;
  543. return 1;
  544. }
  545. CMD:removehitman(playerid, params[])
  546. {
  547. if(IsAHitmanLeader(playerid))
  548. {
  549. new iTarget;
  550. if(sscanf(params, "u", iTarget)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /removehitman [playerid]");
  551. if(!IsPlayerConnected(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
  552. if(!IsAHitman(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not a hitman. If you wish to invite them, use /makehitman.");
  553. if(PlayerInfo[iTarget][pHitman] > PlayerInfo[playerid][pHitman]) return SendClientMessage(playerid, COLOR_GRAD2, "You cannot kick higher ranked hitmen.");
  554. PlayerInfo[iTarget][pHitman] = -1;
  555. PlayerInfo[iTarget][pHitmanLeader] = 0;
  556. format(szMiscArray, sizeof szMiscArray, "* You have kicked %s from the Hitman Agency.", GetPlayerNameEx(iTarget));
  557. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  558. format(szMiscArray, sizeof szMiscArray, "* %s %s has kicked you from the Hitman Agency. Your knife has been removed.", GetHitmanRank(playerid), GetPlayerNameEx(playerid));
  559. SendClientMessage(iTarget, COLOR_LIGHTBLUE, szMiscArray);
  560. if(PlayerInfo[iTarget][pGuns][1] == 4) RemovePlayerWeapon(iTarget, 4);
  561. format(szMiscArray, sizeof szMiscArray, "%s %s has kicked %s from the Hitman Agency.", GetHitmanRank(playerid), GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget));
  562. new file[256], month, day, year;
  563. getdate(year,month,day);
  564. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  565. Log(file, szMiscArray);
  566. }
  567. else if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionModerator] != 0 && PlayerInfo[playerid][pAdmin] >= 4)
  568. {
  569. new iTarget;
  570. if(sscanf(params, "u", iTarget)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /removehitman [playerid]");
  571. if(!IsPlayerConnected(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
  572. if(!IsAHitman(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not a hitman. If you wish to invite them, use /makehitman.");
  573. PlayerInfo[iTarget][pHitman] = -1;
  574. PlayerInfo[iTarget][pHitmanLeader] = 0;
  575. format(szMiscArray, sizeof szMiscArray, "* You have kicked %s from the Hitman Agency.", GetPlayerNameEx(iTarget));
  576. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  577. format(szMiscArray, sizeof szMiscArray, "* Administrator %s has kicked you from the Hitman Agency. Your knife has been removed.", GetPlayerNameEx(playerid));
  578. SendClientMessage(iTarget, COLOR_LIGHTBLUE, szMiscArray);
  579. if(PlayerInfo[iTarget][pGuns][1] == 4) RemovePlayerWeapon(iTarget, 4);
  580. format(szMiscArray, sizeof szMiscArray, "Administrator %s has kicked %s from the Hitman Agency.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget));
  581. new file[256], month, day, year;
  582. getdate(year,month,day);
  583. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  584. Log(file, szMiscArray);
  585. }
  586. else return 0;
  587. return 1;
  588. }
  589. CMD:makehitmanleader(playerid, params[])
  590. {
  591. if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionModerator] != 0 && PlayerInfo[playerid][pAdmin] >= 4)
  592. {
  593. new iTarget;
  594. if(sscanf(params, "u", iTarget)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makehitmanleader [playerid]");
  595. if(!IsPlayerConnected(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
  596. if(IsAHitmanLeader(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is already a hitman leader. To revoke it, use /removehitmanleader.");
  597. if(IsBlacklisted(iTarget))
  598. {
  599. SendClientMessage(playerid, COLOR_GRAD2, "That player cannot be made a Hitman Leader as they are blacklisted.");
  600. format(szMiscArray, sizeof szMiscArray, "Reason:{FFFFFF} %s", PlayerInfo[iTarget][pBlacklistReason]);
  601. SendClientMessage(playerid, COLOR_GRAD2, szMiscArray);
  602. return 1;
  603. }
  604. PlayerInfo[iTarget][pHitmanLeader] = 1;
  605. PlayerInfo[iTarget][pHitman] = 6;
  606. format(szMiscArray, sizeof szMiscArray, "* You have made %s a hitman leader.", GetPlayerNameEx(iTarget));
  607. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  608. format(szMiscArray, sizeof szMiscArray, "* Administrator %s has made you a hitman leader. Use /hmahelp to see your new commands.", GetPlayerNameEx(playerid));
  609. SendClientMessage(iTarget, COLOR_LIGHTBLUE, szMiscArray);
  610. format(szMiscArray, sizeof szMiscArray, "Administrator %s has made %s a hitman leader.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget));
  611. new file[256], month, day, year;
  612. getdate(year,month,day);
  613. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  614. Log(file, szMiscArray);
  615. }
  616. else return 0;
  617. return 1;
  618. }
  619. CMD:removehitmanleader(playerid, params[])
  620. {
  621. if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionModerator] != 0 && PlayerInfo[playerid][pAdmin] >= 4)
  622. {
  623. new iTarget;
  624. if(sscanf(params, "u", iTarget)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /removehitmanleader [playerid]");
  625. if(!IsPlayerConnected(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
  626. if(!IsAHitmanLeader(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not a hitman leader. If you wish to make them, use /makehitmanleader.");
  627. PlayerInfo[iTarget][pHitmanLeader] = 0;
  628. format(szMiscArray, sizeof szMiscArray, "* You have removed %s's hitman leadership.", GetPlayerNameEx(iTarget));
  629. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  630. format(szMiscArray, sizeof szMiscArray, "* Administrator %s has revoked your hitman leadership.", GetPlayerNameEx(playerid));
  631. SendClientMessage(iTarget, COLOR_LIGHTBLUE, szMiscArray);
  632. format(szMiscArray, sizeof szMiscArray, "Administrator %s has removed %s's hitman leadership.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget));
  633. new file[256], month, day, year;
  634. getdate(year,month,day);
  635. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  636. Log(file, szMiscArray);
  637. }
  638. else return 0;
  639. return 1;
  640. }
  641. CMD:hmahelp(playerid, params[])
  642. {
  643. if(IsAHitman(playerid))
  644. {
  645. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  646. SendClientMessageEx(playerid, COLOR_GRAD3, "*** Hitman Agency Commands *** /hr /hg /toghma /ranks /contracts /givemehit /order /profile");
  647. SendClientMessageEx(playerid, COLOR_GRAD3, "*** Hitman Agency Commands *** /hfind /setmylevel /tempnum /pb /pcb /pub /myc4 /quithma");
  648. if(IsAHitmanLeader(playerid))
  649. {
  650. SendClientMessageEx(playerid, COLOR_GRAD3, "*** Leadership Commands *** /makehitman /givehitmanrank /(o)removehitman /hmasafe");
  651. SendClientMessageEx(playerid, COLOR_GRAD3, "*** Leadership Commands *** /(o)blacklist /(o)unblacklist /viewblacklist");
  652. }
  653. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  654. }
  655. else if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionModerator] != 0 && PlayerInfo[playerid][pAdmin] >= 4)
  656. {
  657. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  658. SendClientMessageEx(playerid, COLOR_GRAD3, "*** Administrator Commands *** /makehitmanleader, /removehitmanleader, /oremovehitmanleader");
  659. SendClientMessageEx(playerid, COLOR_GRAD3, "*** Administrator Commands *** /gotohmasafe, /edithmasafepos");
  660. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  661. }
  662. else return 0;
  663. return 1;
  664. }
  665. CMD:blacklist(playerid, params[])
  666. {
  667. if(IsAHitmanLeader(playerid))
  668. {
  669. new iTarget, szReason[64];
  670. if(sscanf(params, "us[64]", iTarget, szReason))
  671. {
  672. SendClientMessage(playerid, COLOR_GREY, "USAGE: /blacklist [playerid] [reason]");
  673. SendClientMessage(playerid, COLOR_GREY, "NOTE: This will prevent them from joining the Agency.");
  674. return 1;
  675. }
  676. else
  677. {
  678. if(!IsPlayerConnected(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified. To offline blacklist a user, use /oblacklist.");
  679. if(IsBlacklisted(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is already blacklisted. If you wish to remove it, use /unblacklist.");
  680. if(IsAHitmanLeader(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "You cannot blacklist Hitman Leadership.");
  681. if(IsAHitman(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is in the Hitman Agency. Please use /removehitman first.");
  682. PlayerInfo[iTarget][pHitmanBlacklisted] = 1;
  683. format(PlayerInfo[iTarget][pBlacklistReason], 64, szReason);
  684. format(szMiscArray, sizeof szMiscArray, "* You have blacklisted %s from the Hitman Agency, reason: %s.", GetPlayerNameEx(iTarget), szReason);
  685. SendClientMessage(playerid, COLOR_GREY, szMiscArray);
  686. format(szMiscArray, sizeof szMiscArray, "%s %s has blacklisted %s, reason: %s.", GetHitmanRank(playerid), GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget), szReason);
  687. new file[256], month, day, year;
  688. getdate(year,month,day);
  689. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  690. Log(file, szMiscArray);
  691. g_mysql_SaveAccount(iTarget); // The reason accounts are saved is because the /viewblacklist uses a mysql query to fetch whichever players are blacklisted.
  692. }
  693. }
  694. else return 0;
  695. return 1;
  696. }
  697. CMD:unblacklist(playerid, params[])
  698. {
  699. if(IsAHitmanLeader(playerid))
  700. {
  701. new iTarget;
  702. if(sscanf(params, "u", iTarget))
  703. {
  704. SendClientMessage(playerid, COLOR_GREY, "USAGE: /unblacklist [playerid]");
  705. SendClientMessage(playerid, COLOR_GREY, "NOTE: This will allow the player to join the Hitman Agency again.");
  706. return 1;
  707. }
  708. else
  709. {
  710. if(!IsPlayerConnected(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified. To offline un-blacklist a user, use /ounblacklist.");
  711. if(!IsBlacklisted(iTarget)) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not blacklisted. If you wish to blacklist them, use /blacklist.");
  712. PlayerInfo[iTarget][pHitmanBlacklisted] = 0;
  713. format(PlayerInfo[iTarget][pBlacklistReason], 64, "");
  714. format(szMiscArray, sizeof szMiscArray, "* You have removed %s from the Hitman Agency blacklist.", GetPlayerNameEx(iTarget));
  715. SendClientMessage(playerid, COLOR_GREY, szMiscArray);
  716. format(szMiscArray, sizeof szMiscArray, "%s %s has unblacklisted %s.", GetHitmanRank(playerid), GetPlayerNameEx(playerid), GetPlayerNameEx(iTarget));
  717. new file[256], month, day, year;
  718. getdate(year,month,day);
  719. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  720. Log(file, szMiscArray);
  721. g_mysql_SaveAccount(iTarget); // The reason accounts are saved is because the /viewblacklist uses a mysql query to fetch whichever players are blacklisted.
  722. }
  723. }
  724. else return 0;
  725. return 1;
  726. }
  727. /*
  728. CMD:oblacklist(playerid, params[])
  729. {
  730. if(IsAHitmanLeader(playerid))
  731. {
  732. new szAccount[MAX_PLAYER_NAME], szReason[64];
  733. if(sscanf(params, "ss", szAccount, szReason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /oblacklist [account name] [reason]");
  734. if(IsPlayerConnected(GetPlayerIDEx(szAccount))) return SendClientMessage(playerid, COLOR_GRAD2, "That player is connected, please use /blacklist instead.");
  735. format(szMiscArray, sizeof szMiscArray, "SELECT * FROM `accounts` WHERE `Username`='%s'", g_mysql_ReturnEscaped(szAccount, MainPipeline));
  736. mysql_tquery(MainPipeline, szMiscArray, true, "OfflineBlacklistAccountFetch", "dss", playerid, szReason, szAccount);
  737. }
  738. else return 0;
  739. return 1;
  740. }
  741. CMD:ounblacklist(playerid, params[])
  742. {
  743. if(IsAHitmanLeader(playerid))
  744. {
  745. new szAccount[MAX_PLAYER_NAME];
  746. if(sscanf(params, "s", szAccount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ounblacklist [account name]");
  747. if(IsPlayerConnected(GetPlayerIDEx(szAccount))) return SendClientMessage(playerid, COLOR_GRAD2, "That player is connected, please use /unblacklist instead.");
  748. format(szMiscArray, sizeof szMiscArray, "SELECT * FROM `accounts` WHERE `Username`='%s'", g_mysql_ReturnEscaped(szAccount, MainPipeline));
  749. mysql_tquery(MainPipeline, szMiscArray, true, "OfflineUnBlacklistAccountFetch", "ds", playerid, szAccount);
  750. }
  751. else return 0;
  752. return 1;
  753. }
  754. CMD:oremovehitman(playerid, params[])
  755. {
  756. if(IsAHitmanLeader(playerid))
  757. {
  758. new szAccount[MAX_PLAYER_NAME];
  759. if(sscanf(params, "s", szAccount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /oremovehitman [account name]");
  760. if(IsPlayerConnected(GetPlayerIDEx(szAccount))) return SendClientMessage(playerid, COLOR_GRAD2, "That player is connected, please use /removehitman instead.");
  761. format(szMiscArray, sizeof szMiscArray, "SELECT * FROM `accounts` WHERE `Username`='%s'", g_mysql_ReturnEscaped(szAccount, MainPipeline));
  762. mysql_tquery(MainPipeline, szMiscArray, true, "OfflineRemoveHitman", "ds", playerid, szAccount);
  763. }
  764. else return 0;
  765. return 1;
  766. }
  767. CMD:oremovehitmanleader(playerid, params[])
  768. {
  769. if(PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pFactionModerator] != 0 && PlayerInfo[playerid][pAdmin] >= 4)
  770. {
  771. new szAccount[MAX_PLAYER_NAME];
  772. if(sscanf(params, "s", szAccount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /oremovehitmanleader [account name]");
  773. if(IsPlayerConnected(GetPlayerIDEx(szAccount))) return SendClientMessage(playerid, COLOR_GRAD2, "That player is connected, please use /removehitman instead.");
  774. format(szMiscArray, sizeof szMiscArray, "SELECT * FROM `accounts` WHERE `Username`='%s'", g_mysql_ReturnEscaped(szAccount, MainPipeline));
  775. mysql_tquery(MainPipeline, szMiscArray, true, "OfflineRemoveHitmanLeader", "ds", playerid, szAccount);
  776. }
  777. else return 0;
  778. return 1;
  779. }
  780. */
  781. /****** Query Related Functions ******/
  782. forward ShowBlacklistedPlayers(playerid);
  783. public ShowBlacklistedPlayers(playerid)
  784. {
  785. new rows;
  786. cache_get_row_count(rows);
  787. if(rows > 0)
  788. {
  789. new szName[MAX_PLAYER_NAME], szBlacklistReason[64];
  790. for(new row = 0; row < rows; row++)
  791. {
  792. cache_get_value_name(row, "Username", szName);
  793. for(new i = 0; i < MAX_PLAYER_NAME; i++) if(szName[i] == '_') szName[i] = ' ';
  794. cache_get_value_name(row, "BlacklistReason", szBlacklistReason);
  795. format(szMiscArray, sizeof szMiscArray, "{A9C4E4}Name: {FFFFFF}%s {A9C4E4}| Reason: {FFFFFF}%s", szName, szBlacklistReason);
  796. SendClientMessage(playerid, COLOR_WHITE, szMiscArray);
  797. }
  798. }
  799. else SendClientMessage(playerid, COLOR_GRAD3, "The blacklist is empty. To add a player, use /blacklist or /oblacklist.");
  800. SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
  801. return 1;
  802. }
  803. forward OfflineBlacklistAccountFetch(playerid, reason[], account[]);
  804. public OfflineBlacklistAccountFetch(playerid, reason[], account[])
  805. {
  806. new rows;
  807. cache_get_row_count(rows);
  808. if(rows > 0)
  809. {
  810. new iHitman, iHitmanLeader, iBlacklisted, szBlacklistReason[64];
  811. for(new row = 0; row < rows; row++)
  812. {
  813. cache_get_value_name_int(row, "Hitman", iHitman);
  814. cache_get_value_name_int(row, "HitmanLeader", iHitmanLeader);
  815. cache_get_value_name_int(row, "HitmanBlacklisted", iBlacklisted);
  816. cache_get_value_name(row, "BlacklistReason", szBlacklistReason);
  817. }
  818. if(iHitman == 1) return SendClientMessage(playerid, COLOR_GRAD2, "That player is in the Hitman Agency. Please use /oremovehitman first.");
  819. if(iHitmanLeader == 1) return SendClientMessage(playerid, COLOR_GRAD2, "You cannot blacklist Hitman Leadership.");
  820. if(iBlacklisted == 1) return SendClientMessage(playerid, COLOR_GRAD2, "That player is already blacklisted. If you wish to unblacklist them, use /ounblacklist.");
  821. mysql_format(MainPipeline, szMiscArray, sizeof szMiscArray, "UPDATE `accounts` SET `HitmanBlacklisted`=1, `BlacklistReason`='%e' WHERE `Username`='%s'", reason, account);
  822. mysql_tquery(MainPipeline, szMiscArray, "OfflineBlacklisted", "dss", playerid, reason, account);
  823. }
  824. else return SendClientMessage(playerid, COLOR_GRAD2, "That account does not exist.");
  825. return 1;
  826. }
  827. forward OfflineBlacklisted(playerid, reason[], account[]);
  828. public OfflineBlacklisted(playerid, reason[], account[])
  829. {
  830. format(szMiscArray, sizeof szMiscArray, "%s has been blacklisted successfully.", account);
  831. SendClientMessage(playerid, COLOR_WHITE, szMiscArray);
  832. format(szMiscArray, sizeof szMiscArray, "%s %s has offline-blacklisted %s, reason: %s.", GetHitmanRank(playerid), GetPlayerNameEx(playerid), account, reason);
  833. new file[256], month, day, year;
  834. getdate(year,month,day);
  835. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  836. Log(file, szMiscArray);
  837. return 1;
  838. }
  839. forward OfflineUnBlacklistAccountFetch(playerid, account[]);
  840. public OfflineUnBlacklistAccountFetch(playerid, account[])
  841. {
  842. new rows;
  843. cache_get_row_count(rows);
  844. if(rows > 0)
  845. {
  846. new iHitman, iHitmanLeader, iBlacklisted, szBlacklistReason[64];
  847. for(new row = 0; row < rows; row++)
  848. {
  849. cache_get_value_name_int(row, "Hitman", iHitman);
  850. cache_get_value_name_int(row, "HitmanLeader", iHitmanLeader);
  851. cache_get_value_name_int(row, "HitmanBlacklisted", iBlacklisted);
  852. cache_get_value_name(row, "BlacklistReason", szBlacklistReason);
  853. }
  854. if(iHitman == 1) return SendClientMessage(playerid, COLOR_GRAD2, "That player is in the Hitman Agency. Please use /oremovehitman first.");
  855. if(iHitmanLeader == 1) return SendClientMessage(playerid, COLOR_GRAD2, "You cannot blacklist Hitman Leadership.");
  856. if(iBlacklisted == 0) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not blacklisted. If you wish to blacklist them, use /oblacklist.");
  857. mysql_format(MainPipeline, szMiscArray, sizeof szMiscArray, "UPDATE `accounts` SET `HitmanBlacklisted`=0, `BlacklistReason`='' WHERE `Username`='%s'", account);
  858. mysql_tquery(MainPipeline, szMiscArray, "OfflineUnBlacklisted", "ds", playerid, account);
  859. }
  860. else return SendClientMessage(playerid, COLOR_GRAD2, "That account does not exist.");
  861. return 1;
  862. }
  863. forward OfflineUnBlacklisted(playerid, account[]);
  864. public OfflineUnBlacklisted(playerid, account[])
  865. {
  866. format(szMiscArray, sizeof szMiscArray, "%s has been unblacklisted successfully.", account);
  867. SendClientMessage(playerid, COLOR_WHITE, szMiscArray);
  868. format(szMiscArray, sizeof szMiscArray, "%s %s has offline-unblacklisted %s.", GetHitmanRank(playerid), GetPlayerNameEx(playerid), account);
  869. new file[256], month, day, year;
  870. getdate(year,month,day);
  871. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  872. Log(file, szMiscArray);
  873. return 1;
  874. }
  875. forward OfflineRemoveHitman(playerid, account[]);
  876. public OfflineRemoveHitman(playerid, account[])
  877. {
  878. new rows;
  879. cache_get_row_count(rows);
  880. if(rows > 0)
  881. {
  882. new iHitman;
  883. for(new row = 0; row < rows; row++)
  884. {
  885. cache_get_value_name_int(row, "Hitman", iHitman);
  886. }
  887. if(iHitman == -1) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not a hitman.");
  888. mysql_format(MainPipeline, szMiscArray, sizeof szMiscArray, "UPDATE `accounts` SET `Hitman`=-1, `HitmanLeader`=0 WHERE `Username`='%s'", account);
  889. mysql_tquery(MainPipeline, szMiscArray, "OfflineHitmanRemoved", "ds", playerid, account);
  890. }
  891. else return SendClientMessage(playerid, COLOR_GRAD2, "That account does not exist.");
  892. return 1;
  893. }
  894. forward OfflineHitmanRemoved(playerid, account[]);
  895. public OfflineHitmanRemoved(playerid, account[])
  896. {
  897. format(szMiscArray, sizeof szMiscArray, "%s has been removed from the Hitman Agency successfully.", account);
  898. SendClientMessage(playerid, COLOR_WHITE, szMiscArray);
  899. format(szMiscArray, sizeof szMiscArray, "%s %s has offline-removed %s.", GetHitmanRank(playerid), GetPlayerNameEx(playerid), account);
  900. new file[256], month, day, year;
  901. getdate(year,month,day);
  902. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  903. Log(file, szMiscArray);
  904. return 1;
  905. }
  906. forward OfflineRemoveHitmanLeader(playerid, account[]);
  907. public OfflineRemoveHitmanLeader(playerid, account[])
  908. {
  909. new rows;
  910. cache_get_row_count(rows);
  911. if(rows > 0)
  912. {
  913. new iHitman, iHitmanLeader;
  914. for(new row = 0; row < rows; row++)
  915. {
  916. cache_get_value_name_int(row, "Hitman", iHitman);
  917. cache_get_value_name_int(row, "HitmanLeader", iHitmanLeader);
  918. }
  919. if(iHitman > PlayerInfo[playerid][pHitman]) return SendClientMessage(playerid, COLOR_GRAD2, "You cannot remove a higher ranking hitman's leadership.");
  920. if(iHitmanLeader == 0) return SendClientMessage(playerid, COLOR_GRAD2, "That player is not a hitman leader.");
  921. mysql_format(MainPipeline, szMiscArray, sizeof szMiscArray, "UPDATE `accounts` SET `HitmanLeader`=0 WHERE `Username`='%s'", account);
  922. mysql_tquery(MainPipeline, szMiscArray, "OfflineHitmanLeaderRemoved", "ds", playerid, account);
  923. }
  924. else return SendClientMessage(playerid, COLOR_GRAD2, "That account does not exist.");
  925. return 1;
  926. }
  927. forward OfflineHitmanLeaderRemoved(playerid, account[]);
  928. public OfflineHitmanLeaderRemoved(playerid, account[])
  929. {
  930. format(szMiscArray, sizeof szMiscArray, "%s's hitman leadership has been removed.", account);
  931. SendClientMessage(playerid, COLOR_WHITE, szMiscArray);
  932. format(szMiscArray, sizeof szMiscArray, "Administrator %s has offline-removed %s's hitman leadership.", GetHitmanRank(playerid), GetPlayerNameEx(playerid), account);
  933. new file[256], month, day, year;
  934. getdate(year,month,day);
  935. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  936. Log(file, szMiscArray);
  937. return 1;
  938. }
  939. /////////////////// ADDITIONAL
  940. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  941. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  942. szMiscArray[0] = 0;
  943. switch(dialogid)
  944. {
  945. case DIALOG_ORDER_HMA1:
  946. {
  947. if(response) {
  948. switch(listitem) {
  949. case 0: {
  950. if(GetPlayerCash(playerid) >= 2000) {
  951. SetHealth(playerid, 100);
  952. SetArmour(playerid, 100);
  953. GivePlayerCash(playerid, - 2000);
  954. }
  955. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  956. }
  957. case 1: {
  958. if(PlayerInfo[playerid][pHitman] < 4) { // use this to check their rank
  959. format(szMiscArray, sizeof(szMiscArray), "\nTear Gas\t\t $5,000\n\
  960. Knife\t\t\t $12,000\n\
  961. Baton\t\t\t $5,000\n\
  962. Spraycan\t\t $4,500\n\
  963. Colt.45\t\t\t $5,000\n\
  964. SD Pistol\t\t $7,500\n\
  965. Deagle\t\t\t $12,000\n\
  966. MP5\t\t\t $17,500\n\
  967. UZI\t\t\t $17,500\n\
  968. TEC9\t\t\t $17,500\n\
  969. Shotgun\t\t $11,000\n\
  970. SPAS12\t\t\t $90,000\n\
  971. AK47\t\t\t $35,000\n\
  972. M4\t\t\t $70,000\n\
  973. Rifle\t\t\t $10,000\n\
  974. Sniper\t\t\t $65,000"
  975. );
  976. }
  977. else {
  978. format(szMiscArray, sizeof(szMiscArray), "\nTear Gas\t\t $5,000\n\
  979. Knife\t\t\t $12,000\n\
  980. Baton\t\t\t $5,000\n\
  981. Spraycan\t\t $4,500\n\
  982. Colt.45\t\t\t $5,000\n\
  983. SD Pistol\t\t $7,500\n\
  984. Deagle\t\t\t $12,000\n\
  985. MP5\t\t\t $17,500\n\
  986. UZI\t\t\t $17,500\n\
  987. TEC9\t\t\t $17,500\n\
  988. Shotgun\t\t $11,000\n\
  989. SPAS12\t\t\t $90,000\n\
  990. AK47\t\t\t $35,000\n\
  991. M4\t\t\t $70,000\n\
  992. Rifle\t\t\t $10,000\n\
  993. Sniper\t\t\t $65,000\n\
  994. Chainsaw\t\t $20,000\n\
  995. C4\t\t\t $50,000"
  996. );
  997. }
  998. ShowPlayerDialogEx(playerid, DIALOG_ORDER_HMAWPS, DIALOG_STYLE_LIST, "Weapon Select", szMiscArray, "Select", "Back");
  999. }
  1000. case 2: {
  1001. ShowPlayerDialogEx(playerid, DIALOG_ORDER_HMASKIN, DIALOG_STYLE_INPUT, "Uniform", "Choose a skin (by ID).", "Change", "Back");
  1002. }
  1003. case 3: {
  1004. if(gettime()-GetPVarInt(playerid, "LastNameChange") < 120) {
  1005. return SendClientMessageEx(playerid, COLOR_GRAD2, "You can only request a name change every two minutes.");
  1006. }
  1007. ShowPlayerDialogEx(playerid, DIALOG_NAMECHANGE2, DIALOG_STYLE_INPUT, "Name Change","Please enter your new desired name!\n\nNote: Name Changes are free for your faction.", "Change", "Back");
  1008. }
  1009. }
  1010. }
  1011. }
  1012. case DIALOG_ORDER_HMAWPS:
  1013. {
  1014. if(!response) {
  1015. format(szMiscArray, sizeof(szMiscArray), "Health and Armour\t\t $2000\nWeapons\nUniform\nName Change");
  1016. ShowPlayerDialogEx(playerid, DIALOG_ORDER_HMA1, DIALOG_STYLE_LIST, "HMA Order Weapons", szMiscArray, "Order", "Cancel");
  1017. }
  1018. else {
  1019. switch(listitem) {
  1020. case 0: { // tear gas - $5000
  1021. if(GetPlayerCash(playerid) >= 5000) {
  1022. GivePlayerValidWeapon(playerid, 17);
  1023. GivePlayerCash(playerid, - 5000);
  1024. format(szMiscArray, sizeof szMiscArray, "%s has taken teargas (17) from the locker at $5,000.", GetPlayerNameEx(playerid));
  1025. new file[256], month, day, year;
  1026. getdate(year,month,day);
  1027. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1028. Log(file, szMiscArray);
  1029. }
  1030. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1031. }
  1032. case 1: { // knife - $12000
  1033. if(GetPlayerCash(playerid) >= 12000) {
  1034. GivePlayerValidWeapon(playerid, 4);
  1035. GivePlayerCash(playerid, - 12000);
  1036. format(szMiscArray, sizeof szMiscArray, "%s has taken a knife (4) from the locker at $12,000.", GetPlayerNameEx(playerid));
  1037. new file[256], month, day, year;
  1038. getdate(year,month,day);
  1039. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1040. Log(file, szMiscArray);
  1041. }
  1042. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1043. }
  1044. case 2: {// baton - $5000
  1045. if(GetPlayerCash(playerid) >= 5000) {
  1046. GivePlayerValidWeapon(playerid, 3);
  1047. GivePlayerCash(playerid, - 5000);
  1048. format(szMiscArray, sizeof szMiscArray, "%s has taken a baton (3) from the locker at $5,000.", GetPlayerNameEx(playerid));
  1049. new file[256], month, day, year;
  1050. getdate(year,month,day);
  1051. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1052. Log(file, szMiscArray);
  1053. }
  1054. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1055. }
  1056. case 3: { // Spraycan - $4500
  1057. if(GetPlayerCash(playerid) >= 4500) {
  1058. GivePlayerValidWeapon(playerid, 41);
  1059. GivePlayerCash(playerid, - 4500);
  1060. format(szMiscArray, sizeof szMiscArray, "%s has taken a spraycan (41) from the locker at $4,500.", GetPlayerNameEx(playerid));
  1061. new file[256], month, day, year;
  1062. getdate(year,month,day);
  1063. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1064. Log(file, szMiscArray);
  1065. }
  1066. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1067. }
  1068. case 4: { // Colt.45 - $5000
  1069. if(GetPlayerCash(playerid) >= 5000) {
  1070. GivePlayerValidWeapon(playerid, 22);
  1071. GivePlayerCash(playerid, - 5000);
  1072. format(szMiscArray, sizeof szMiscArray, "%s has taken a 9mm (22) from the locker at $5,000.", GetPlayerNameEx(playerid));
  1073. new file[256], month, day, year;
  1074. getdate(year,month,day);
  1075. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1076. Log(file, szMiscArray);
  1077. }
  1078. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1079. }
  1080. case 5: { // SD Pistol - $7500
  1081. if(GetPlayerCash(playerid) >= 7500) {
  1082. GivePlayerValidWeapon(playerid, 23);
  1083. GivePlayerCash(playerid, - 7500);
  1084. format(szMiscArray, sizeof szMiscArray, "%s has taken an SD pistol (23) from the locker at $7,500.", GetPlayerNameEx(playerid));
  1085. new file[256], month, day, year;
  1086. getdate(year,month,day);
  1087. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1088. Log(file, szMiscArray);
  1089. }
  1090. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1091. }
  1092. case 6: { // Deagle - $12000
  1093. if(GetPlayerCash(playerid) >= 12000) {
  1094. GivePlayerValidWeapon(playerid, 24);
  1095. GivePlayerCash(playerid, - 12000);
  1096. format(szMiscArray, sizeof szMiscArray, "%s has taken a deagle (24) from the locker at $12,000.", GetPlayerNameEx(playerid));
  1097. new file[256], month, day, year;
  1098. getdate(year,month,day);
  1099. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1100. Log(file, szMiscArray);
  1101. }
  1102. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1103. }
  1104. case 7: { // MP5 - $17500
  1105. if(GetPlayerCash(playerid) >= 17500) {
  1106. GivePlayerValidWeapon(playerid, 29);
  1107. GivePlayerCash(playerid, - 17500);
  1108. format(szMiscArray, sizeof szMiscArray, "%s has taken an MP5 (29) from the locker at $17,500.", GetPlayerNameEx(playerid));
  1109. new file[256], month, day, year;
  1110. getdate(year,month,day);
  1111. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1112. Log(file, szMiscArray);
  1113. }
  1114. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1115. }
  1116. case 8: { // UZI - $17500
  1117. if(GetPlayerCash(playerid) >= 17500) {
  1118. GivePlayerValidWeapon(playerid, 28);
  1119. GivePlayerCash(playerid, - 17500);
  1120. format(szMiscArray, sizeof szMiscArray, "%s has taken an uzi (28) from the locker at $17,500.", GetPlayerNameEx(playerid));
  1121. new file[256], month, day, year;
  1122. getdate(year,month,day);
  1123. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1124. Log(file, szMiscArray);
  1125. }
  1126. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1127. }
  1128. case 9: { // TEC9 - $17500
  1129. if(GetPlayerCash(playerid) >= 17500) {
  1130. GivePlayerValidWeapon(playerid, 32);
  1131. GivePlayerCash(playerid, - 17500);
  1132. format(szMiscArray, sizeof szMiscArray, "%s has taken a tec9 (32) from the locker at $17,500.", GetPlayerNameEx(playerid));
  1133. new file[256], month, day, year;
  1134. getdate(year,month,day);
  1135. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1136. Log(file, szMiscArray);
  1137. }
  1138. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1139. }
  1140. case 10: { // Shotgun - $11000
  1141. if(GetPlayerCash(playerid) >= 11000) {
  1142. GivePlayerValidWeapon(playerid, 25);
  1143. GivePlayerCash(playerid, - 11000);
  1144. format(szMiscArray, sizeof szMiscArray, "%s has taken a shotgun (25) from the locker at $11,000.", GetPlayerNameEx(playerid));
  1145. new file[256], month, day, year;
  1146. getdate(year,month,day);
  1147. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1148. Log(file, szMiscArray);
  1149. }
  1150. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1151. }
  1152. case 11: { // SPAS - $90000
  1153. if(GetPlayerCash(playerid) >= 90000) {
  1154. GivePlayerValidWeapon(playerid, 27);
  1155. GivePlayerCash(playerid, - 90000);
  1156. format(szMiscArray, sizeof szMiscArray, "%s has taken a SPAS-12 (27) from the locker at $90,000.", GetPlayerNameEx(playerid));
  1157. new file[256], month, day, year;
  1158. getdate(year,month,day);
  1159. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1160. Log(file, szMiscArray);
  1161. }
  1162. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1163. }
  1164. case 12: { // AK47 - $35000
  1165. if(GetPlayerCash(playerid) >= 35000) {
  1166. GivePlayerValidWeapon(playerid, 30);
  1167. GivePlayerCash(playerid, - 35000);
  1168. format(szMiscArray, sizeof szMiscArray, "%s has taken an AK47 (30) from the locker at $35,000.", GetPlayerNameEx(playerid));
  1169. new file[256], month, day, year;
  1170. getdate(year,month,day);
  1171. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1172. Log(file, szMiscArray);
  1173. }
  1174. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1175. }
  1176. case 13: { // M4 - $70000
  1177. if(GetPlayerCash(playerid) >= 70000) {
  1178. GivePlayerValidWeapon(playerid, 31);
  1179. GivePlayerCash(playerid, - 70000);
  1180. format(szMiscArray, sizeof szMiscArray, "%s has taken an m4 (31) from the locker at $70,000.", GetPlayerNameEx(playerid));
  1181. new file[256], month, day, year;
  1182. getdate(year,month,day);
  1183. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1184. Log(file, szMiscArray);
  1185. }
  1186. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1187. }
  1188. case 14: { // Rifle - $10000
  1189. if(GetPlayerCash(playerid) >= 10000) {
  1190. GivePlayerValidWeapon(playerid, 33);
  1191. GivePlayerCash(playerid, - 10000);
  1192. format(szMiscArray, sizeof szMiscArray, "%s has taken a rifle (33) from the locker at $10,000.", GetPlayerNameEx(playerid));
  1193. new file[256], month, day, year;
  1194. getdate(year,month,day);
  1195. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1196. Log(file, szMiscArray);
  1197. }
  1198. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1199. }
  1200. case 15: { // Sniper - $65000
  1201. if(GetPlayerCash(playerid) >= 65000) {
  1202. GivePlayerValidWeapon(playerid, 34);
  1203. GivePlayerCash(playerid, - 65000);
  1204. format(szMiscArray, sizeof szMiscArray, "%s has taken a sniper (34) from the locker at $65,000.", GetPlayerNameEx(playerid));
  1205. new file[256], month, day, year;
  1206. getdate(year,month,day);
  1207. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1208. Log(file, szMiscArray);
  1209. }
  1210. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1211. }
  1212. case 16: { // Chainsaws - $20000
  1213. if(GetPlayerCash(playerid) >= 20000) {
  1214. GivePlayerValidWeapon(playerid, 9);
  1215. GivePlayerCash(playerid, - 20000);
  1216. format(szMiscArray, sizeof szMiscArray, "%s has taken a chainsaw (9) from the locker at $20,000.", GetPlayerNameEx(playerid));
  1217. new file[256], month, day, year;
  1218. getdate(year,month,day);
  1219. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1220. Log(file, szMiscArray);
  1221. }
  1222. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1223. }
  1224. case 17: { // C4s - $50000
  1225. if(GetPlayerCash(playerid) >= 20000) {
  1226. PlayerInfo[playerid][pC4Get] = 1;
  1227. PlayerInfo[playerid][pBombs]++;
  1228. GivePlayerCash(playerid, -50000);
  1229. format(szMiscArray, sizeof szMiscArray, "%s has taken a block of C4 from the locker at $50,000.", GetPlayerNameEx(playerid));
  1230. new file[256], month, day, year;
  1231. getdate(year,month,day);
  1232. format(file, sizeof(file), "logs/hitman/%d-%d-%d.log", month, day, year);
  1233. Log(file, szMiscArray);
  1234. SendClientMessageEx(playerid, COLOR_LIGHTBLUE," You have purchased one block of C4!");
  1235. }
  1236. else SendClientMessageEx(playerid, COLOR_GRAD2, MSG_NOMONEY);
  1237. }
  1238. }
  1239. }
  1240. }
  1241. case DIALOG_ORDER_HMASKIN:
  1242. {
  1243. if(response) {
  1244. new skin = strval(inputtext);
  1245. if(IsInvalidSkin(skin)) {
  1246. return ShowPlayerDialogEx(playerid, DIALOG_ORDER_HMASKIN, DIALOG_STYLE_INPUT, "Uniform","Invalid skin specified. Choose another.", "Select", "Cancel");
  1247. }
  1248. PlayerInfo[playerid][pModel] = skin;
  1249. SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
  1250. }
  1251. else {
  1252. format(szMiscArray, sizeof(szMiscArray), "Health and Armour\t\t $2000\nWeapons\nUniform\nName Change");
  1253. ShowPlayerDialogEx(playerid, DIALOG_ORDER_HMA1, DIALOG_STYLE_LIST, "HMA Order Weapons", szMiscArray, "Order", "Cancel");
  1254. }
  1255. }
  1256. }
  1257. return 0;
  1258. }
  1259. stock SearchingHit(playerid)
  1260. {
  1261. new string[128];
  1262. SendClientMessageEx(playerid, COLOR_WHITE, "Available Contracts:");
  1263. new hits;
  1264. foreach(new i: Player)
  1265. {
  1266. if(!IsAHitman(i) && PlayerInfo[i][pHeadValue] > 0)
  1267. {
  1268. if(GotHit[i] == 0)
  1269. {
  1270. hits++;
  1271. format(string, sizeof(string), "%s (ID %d) | $%s | Placed By: %s | Reason: %s | Chased By: Nobody", GetPlayerNameEx(i), i, number_format(PlayerInfo[i][pHeadValue]), PlayerInfo[i][pContractBy], PlayerInfo[i][pContractDetail]);
  1272. SendClientMessageEx(playerid, COLOR_GRAD2, string);
  1273. }
  1274. else
  1275. {
  1276. format(string, sizeof(string), "%s (ID %d) | $%s | Placed By: %s | Reason: %s | Chased By: %s", GetPlayerNameEx(i), i, number_format(PlayerInfo[i][pHeadValue]), PlayerInfo[i][pContractBy], PlayerInfo[i][pContractDetail], GetPlayerNameEx(GetChased[i]));
  1277. SendClientMessageEx(playerid, COLOR_GRAD2, string);
  1278. }
  1279. }
  1280. }
  1281. if(hits && PlayerInfo[playerid][pHitman] <= 4 && IsAHitman(playerid))
  1282. {
  1283. SendClientMessageEx(playerid, COLOR_YELLOW, "Use /givemehit to assign a contract to yourself.");
  1284. }
  1285. if(hits && IsAHitmanLeader(playerid))
  1286. {
  1287. SendClientMessageEx(playerid, COLOR_YELLOW, "Use /givehit to assign a contract to one of the hitmen.");
  1288. }
  1289. if(hits == 0)
  1290. {
  1291. SendClientMessageEx(playerid, COLOR_GREY, "There are no hits available.");
  1292. }
  1293. return 0;
  1294. }
  1295. CMD:contracts(playerid, params[])
  1296. {
  1297. if(IsAHitman(playerid) || PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  1298. {
  1299. SearchingHit(playerid);
  1300. }
  1301. return 1;
  1302. }
  1303. CMD:execute(playerid, params[])
  1304. {
  1305. if(IsAHitman(playerid))
  1306. {
  1307. if(GoChase[playerid] != INVALID_PLAYER_ID || HitToGet[playerid] != INVALID_PLAYER_ID) {
  1308. if(GetPVarInt(playerid, "KillShotCooldown") != 0 && gettime() < GetPVarInt(playerid, "KillShotCooldown") + 300) return SendClientMessageEx(playerid, COLOR_GRAD2, "You must wait 5 minutes between execution shots.");
  1309. SetPVarInt(playerid, "ExecutionMode", 1);
  1310. SendClientMessageEx(playerid, COLOR_GRAD2, " You have loaded a Hollow point round. Aim for the Head when executing your target. ");
  1311. SetPVarInt(playerid, "KillShotCooldown", gettime());
  1312. }
  1313. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have an active contract!");
  1314. }
  1315. return 1;
  1316. }
  1317. CMD:resetheadshot(playerid, params[])
  1318. {
  1319. if(PlayerInfo[playerid][pAdmin] >= 1337)
  1320. {
  1321. return SetPVarInt(playerid, "KillShotCooldown", gettime()-300);
  1322. }
  1323. return 1;
  1324. }
  1325. CMD:plantbomb(playerid, params[]) {
  1326. return cmd_pb(playerid, params);
  1327. }
  1328. CMD:pb(playerid, params[])
  1329. {
  1330. if (IsAHitman(playerid))
  1331. {
  1332. if (PlayerInfo[playerid][pC4] == 0)
  1333. {
  1334. if (PlayerInfo[playerid][pBombs] != 0)
  1335. {
  1336. if(IsPlayerInAnyVehicle(playerid))
  1337. {
  1338. SendClientMessageEx(playerid, COLOR_LIGHTRED,"You can't plant C4 while in a vehicle!");
  1339. return 1;
  1340. }
  1341. GetPlayerPos(playerid, Positions[0][0], Positions[0][1], Positions[0][2]);
  1342. SetPVarFloat(playerid, "DYN_C4_FLOAT_X", Positions[0][0]);
  1343. SetPVarFloat(playerid, "DYN_C4_FLOAT_Y", Positions[0][1]);
  1344. SetPVarFloat(playerid, "DYN_C4_FLOAT_Z", Positions[0][2]);
  1345. new models[9] = {1654, 1230, 1778, 2814, 1271, 1328, 2919, 2770, 1840};
  1346. ShowModelSelectionMenuEx(playerid, models, sizeof(models), "Bomb Model Selector", 1338, 0.0, 0.0, 180.0);
  1347. }
  1348. else
  1349. {
  1350. SendClientMessageEx(playerid, COLOR_GRAD2, "You do not have C4!");
  1351. return 1;
  1352. }
  1353. }
  1354. else
  1355. {
  1356. SendClientMessageEx(playerid, COLOR_GRAD2, "You can only deploy 1 C4 at a time!");
  1357. return 1;
  1358. }
  1359. }
  1360. else
  1361. {
  1362. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a member of the Hitman Agency!");
  1363. }
  1364. return 1;
  1365. }
  1366. CMD:order(playerid, params[])
  1367. {
  1368. if (IsAHitman(playerid))
  1369. {
  1370. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot do this right now.");
  1371. if(IsPlayerInRangeOfPoint(playerid, 4.0, 63.973995, 1973.618774, -68.786064) || IsPlayerInRangeOfPoint(playerid, 6.0, 1415.727905, -1299.371093, 15.054657) || IsPlayerInRangeOfPoint(playerid, 2.0, 1666.3503, -1576.5717, 2195.8643))
  1372. {
  1373. if(PlayerInfo[playerid][pConnectHours] < 2 || PlayerInfo[playerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this as you are currently restricted from possessing weapons!");
  1374. new string[128];
  1375. format(string, sizeof(string), "Health and Armour\t\t $2000\nWeapons\nUniform\nName Change");
  1376. ShowPlayerDialogEx(playerid, DIALOG_ORDER_HMA1, DIALOG_STYLE_LIST, "HMA Order Weapons", string, "Order", "Cancel");
  1377. }
  1378. else
  1379. {
  1380. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not at the gun shack!");
  1381. return 1;
  1382. }
  1383. }
  1384. else
  1385. {
  1386. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a member of the hitman agency!");
  1387. return 1;
  1388. }
  1389. return 1;
  1390. }
  1391. CMD:pub(playerid, params[]) {
  1392. return cmd_pickupbomb(playerid, params);
  1393. }
  1394. CMD:pickupbomb(playerid, params[])
  1395. {
  1396. if (!IsAHitman(playerid))
  1397. {
  1398. SendClientMessageEx(playerid, COLOR_GREY, "You are not a Hitman!");
  1399. return 1;
  1400. }
  1401. if (PlayerInfo[playerid][pC4] == 0)
  1402. {
  1403. SendClientMessageEx(playerid, COLOR_GREY, "You haven't planted a bomb!");
  1404. return 1;
  1405. }
  1406. new carid = GetPlayerVehicleID(playerid);
  1407. new closestcar = GetClosestCar(playerid, carid);
  1408. if(IsPlayerInRangeOfVehicle(playerid, closestcar, 4.0) && VehicleBomb{closestcar} == 1)
  1409. {
  1410. VehicleBomb{closestcar} = 0;
  1411. PlacedVehicleBomb[playerid] = INVALID_VEHICLE_ID;
  1412. PickUpC4(playerid);
  1413. SendClientMessageEx(playerid, COLOR_GREEN, "Bomb picked up successfully.");
  1414. PlayerInfo[playerid][pBombs]++;
  1415. PlayerInfo[playerid][pC4Used] = 0;
  1416. PlayerInfo[playerid][pC4Get] = 1;
  1417. return 1;
  1418. }
  1419. if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "DYN_C4_FLOAT_X"), GetPVarFloat(playerid, "DYN_C4_FLOAT_Y"), GetPVarFloat(playerid, "DYN_C4_FLOAT_Z")))
  1420. {
  1421. PickUpC4(playerid);
  1422. SendClientMessageEx(playerid, COLOR_GREEN, "Bomb picked up successfully.");
  1423. PlayerInfo[playerid][pBombs]++;
  1424. PlayerInfo[playerid][pC4Used] = 0;
  1425. PlayerInfo[playerid][pC4Get] = 1;
  1426. return 1;
  1427. }
  1428. return 1;
  1429. }
  1430. CMD:myc4(playerid, params[])
  1431. {
  1432. if (IsAHitman(playerid))
  1433. {
  1434. new string[128];
  1435. if (PlayerInfo[playerid][pBombs] > 0)
  1436. {
  1437. format(string, sizeof(string), "You currently have %i C4 in your inventory.", PlayerInfo[playerid][pBombs]);
  1438. }
  1439. else
  1440. {
  1441. format(string, sizeof(string), "You do not have any C4 in your inventory.");
  1442. }
  1443. SendClientMessageEx(playerid, COLOR_GRAD2, string);
  1444. }
  1445. return 1;
  1446. }
  1447. CMD:setmylevel(playerid, params[])
  1448. {
  1449. if (!IsAHitman(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use this command.");
  1450. new level;
  1451. if(sscanf(params, "d", level)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /setmylevel [level]");
  1452. if(PlayerInfo[playerid][pLevel] < level) return SendClientMessageEx(playerid, COLOR_GREY, "The new level can't be greater than your current level.");
  1453. if(level < 1 || level > 80) return SendClientMessage(playerid, COLOR_GREY, "The new level cannot be below 1 or above 80.");
  1454. DeletePVar(playerid, "TempLevel");
  1455. SetPVarInt(playerid, "TempLevel", level);
  1456. SetPlayerScore(playerid, level);
  1457. format(szMiscArray, sizeof(szMiscArray), "You have set your level to %d", level);
  1458. return SendClientMessage(playerid, COLOR_LIGHTRED, szMiscArray);
  1459. }
  1460. CMD:givemehit(playerid, params[])
  1461. {
  1462. if (IsAHitman(playerid))
  1463. {
  1464. new string[128], targetid;
  1465. if(sscanf(params, "u", targetid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /givemehit [targetid]");
  1466. if(IsPlayerConnected(targetid))
  1467. {
  1468. if(GoChase[playerid] != INVALID_PLAYER_ID)
  1469. {
  1470. SendClientMessageEx(playerid, COLOR_GREY, " You are already busy with another contract!");
  1471. return 1;
  1472. }
  1473. if(GotHit[targetid] == 1)
  1474. {
  1475. SendClientMessageEx(playerid, COLOR_GREY, " Another hitman has already assigned this target!");
  1476. return 1;
  1477. }
  1478. if(PlayerInfo[targetid][pHeadValue] == 0)
  1479. {
  1480. SendClientMessageEx(playerid, COLOR_GREY, " That target doesn't have a contract on them!");
  1481. return 1;
  1482. }
  1483. format(string, sizeof(string), "* You have offered yourself a contract to kill %s. (type /accept contract)", GetPlayerNameEx(targetid));
  1484. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  1485. HitOffer[playerid] = playerid;
  1486. HitToGet[playerid] = targetid;
  1487. return 1;
  1488. }
  1489. else
  1490. {
  1491. SendClientMessageEx(playerid, COLOR_GREY, " The contracted person is offline, use /contracts!");
  1492. return 1;
  1493. }
  1494. }
  1495. return 1;
  1496. }
  1497. CMD:deletehit(playerid, params[])
  1498. {
  1499. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || IsAHitmanLeader(playerid))
  1500. {
  1501. new string[128], giveplayerid;
  1502. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /deletehit [player]");
  1503. if(!IsPlayerConnected(giveplayerid))
  1504. {
  1505. SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  1506. return 1;
  1507. }
  1508. if(PlayerInfo[giveplayerid][pHeadValue] >= 1 )
  1509. {
  1510. PlayerInfo[giveplayerid][pHeadValue] = 0;
  1511. format(string, sizeof(string), "<< %s(%d) has removed the contract on %s(%d) >>", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid));
  1512. Log("logs/contracts.log", string);
  1513. format(string, sizeof(string), "You have removed the contract which was on %s's head.", GetPlayerNameEx(giveplayerid) );
  1514. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1515. GoChase[giveplayerid] = INVALID_PLAYER_ID;
  1516. foreach(new i: Player)
  1517. {
  1518. if( HitToGet[i] == giveplayerid )
  1519. {
  1520. HitToGet[i] = INVALID_PLAYER_ID;
  1521. HitOffer[i] = INVALID_PLAYER_ID;
  1522. }
  1523. }
  1524. }
  1525. else
  1526. {
  1527. SendClientMessageEx( playerid, COLOR_WHITE, "There's not an active contract on that player!" );
  1528. }
  1529. }
  1530. return 1;
  1531. }
  1532. CMD:contract(playerid, params[])
  1533. {
  1534. if(PlayerCuffed[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place contracts while in cuffs.");
  1535. if(PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place contracts while in jail.");
  1536. new string[128], giveplayerid, moneys, detail[32];
  1537. if(sscanf(params, "uds[32]", giveplayerid, moneys, detail))
  1538. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /contract [player] [amount] [details]");
  1539. if (IsPlayerConnected(giveplayerid) && giveplayerid != INVALID_PLAYER_ID)
  1540. {
  1541. if(giveplayerid == playerid)
  1542. return SendClientMessageEx(playerid, COLOR_GREY, "You can't contract yourself.");
  1543. if(PlayerInfo[playerid][pLevel] < 3 || PlayerInfo[giveplayerid][pLevel] < 3)
  1544. return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot place a contract unless both you and the hit are at least level 3.");
  1545. if(moneys < 50000 || moneys > 3000000)
  1546. return SendClientMessageEx(playerid, COLOR_GREY, "You can't place contracts that are less than $50,000 or more than $3,000,000.");
  1547. if((moneys < 50000 || moneys > 3000000) && IsACop(giveplayerid))
  1548. return SendClientMessageEx(playerid, COLOR_GREY, "The minimum hit amount for a law enforcement officer is $150,000.");
  1549. if(PlayerInfo[playerid][pMember] != INVALID_GROUP_ID && arrGroupData[PlayerInfo[playerid][pMember]][g_iGroupType] == GROUP_TYPE_CONTRACT)
  1550. return SendClientMessageEx(playerid, COLOR_GREY, "You cannot do this to that person.");
  1551. if(PlayerInfo[giveplayerid][pHeadValue] >= 3000000 || moneys + PlayerInfo[giveplayerid][pHeadValue] > 3000000)
  1552. return SendClientMessageEx(playerid, COLOR_GREY, "That person has the maximum on their head.");
  1553. if(PlayerInfo[playerid][pJailTime] > 0 || PlayerCuffed[playerid] > 0)
  1554. return SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
  1555. if(IsAHitman(playerid))
  1556. return SendClientMessageEx(playerid, COLOR_GREY, "Hitmen cannot place contracts.");
  1557. if (moneys > 0 && GetPlayerCash(playerid) >= moneys)
  1558. {
  1559. if(strlen(detail) > 32) return SendClientMessageEx(playerid, COLOR_GRAD1, "Contract details may not be longer than 32 characters in length.");
  1560. GivePlayerCash(playerid, (0 - moneys));
  1561. PlayerInfo[giveplayerid][pHeadValue] += moneys;
  1562. strmid(PlayerInfo[giveplayerid][pContractBy], GetPlayerNameEx(playerid), 0, strlen(GetPlayerNameEx(playerid)), MAX_PLAYER_NAME);
  1563. strmid(PlayerInfo[giveplayerid][pContractDetail], detail, 0, strlen(detail), 32);
  1564. format(string, sizeof(string), "%s has placed a contract on %s for $%s, details: %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), number_format(moneys), detail);
  1565. foreach(new i: Player) if(IsAHitman(i)) SendClientMessage(i, COLOR_YELLOW, string);
  1566. format(string, sizeof(string), "* You placed a contract on %s for $%s, details: %s", GetPlayerNameEx(giveplayerid), number_format(moneys), detail);
  1567. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  1568. format(string, sizeof(string), "<< %s has placed a contract on %s for $%s, details: %s >>", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), number_format(moneys), detail);
  1569. Log("logs/contracts.log", string);
  1570. format(string, sizeof(string), "%s has placed a contract on %s for $%s, details: %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), number_format(moneys), detail);
  1571. ABroadCast(COLOR_YELLOW, string, 2);
  1572. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  1573. }
  1574. else
  1575. {
  1576. SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have enough money for this.");
  1577. }
  1578. }
  1579. else
  1580. {
  1581. SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  1582. }
  1583. return 1;
  1584. }
  1585. CMD:knife(playerid, params[])
  1586. {
  1587. if(IsAHitman(playerid)) {
  1588. if(GetPVarInt(playerid, "HidingKnife") == 1) {
  1589. GivePlayerValidWeapon(playerid, 4);
  1590. DeletePVar(playerid, "HidingKnife");
  1591. SendClientMessageEx(playerid, COLOR_YELLOW, "You have pulled out your knife.");
  1592. }
  1593. else {
  1594. if(PlayerInfo[playerid][pGuns][1] == WEAPON_KNIFE) {
  1595. RemovePlayerWeapon(playerid, 4); // Remove Knife
  1596. SetPVarInt(playerid, "HidingKnife", 1);
  1597. SendClientMessageEx(playerid, COLOR_YELLOW, "You have hidden your knife.");
  1598. }
  1599. else {
  1600. SendClientMessageEx(playerid, COLOR_WHITE, "You do not have a knife available.");
  1601. }
  1602. }
  1603. }
  1604. return 1;
  1605. }