Player_Interact.pwn 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315
  1. #include <YSI\y_hooks>
  2. #define ITEM_DRUG (0)
  3. #define ITEM_MATS (1)
  4. #define ITEM_FIREWORK (2)
  5. #define ITEM_SYRINGES (3)
  6. #define ITEM_SPRUNKDRINK (4)
  7. #define ITEM_PBTOKENS (5)
  8. #define ITEM_WEAPON (6)
  9. #define INTERACT_AMOUNT (10049)
  10. #define INTERACT_MAIN (10050)
  11. #define INTERACT_GIVE (10051)
  12. #define DETAIN_SEAT (10052)
  13. #define GIVE_TICKET (10053)
  14. #define HEAL_PLAYER (10054)
  15. #define TICKET_REASON (10055)
  16. #define PATIENT_SEAT (10056)
  17. #define INTERACT_WEAPON (10057)
  18. #define PAY_PLAYER (10058)
  19. #define INTERACT_SELL (10059)
  20. #define INTERACT_SELLCONFIRM (10060)
  21. #define INTERACT_DRUGS (10061)
  22. #define INTERACT_SELLCONFIRM2 (10062)
  23. #define INTERACT_PRESCRIBE (10063)
  24. #define INTERACT_PRESCRIBE1 (10064)
  25. Player_InteractMenu(playerid, giveplayerid, menu = 0) {
  26. // if(playerid == giveplayerid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot interact with yourself.");
  27. szMiscArray[0] = 0;
  28. new szTitle[64];
  29. format(szTitle, sizeof(szTitle), "Interaction - %s", GetPlayerNameEx(giveplayerid));
  30. switch(menu) {
  31. case 0: {
  32. DeletePVar(giveplayerid, "Interact_Buying");
  33. DeletePVar(playerid, "Interact_SellPrice");
  34. DeletePVar(playerid, "Interact_Sell");
  35. DeletePVar(playerid, "Interact_SellGun");
  36. DeletePVar(playerid, "Interact_GiveItem");
  37. DeletePVar(playerid, "Interact_SellAmt");
  38. DeletePVar(playerid, "Interact_Drug");
  39. SetPVarInt(playerid, "Interact_Target", giveplayerid);
  40. format(szMiscArray, sizeof(szMiscArray), "Pay\nGive Item\nSell Item\nFrisk\nShow License");
  41. if(IsACop(playerid)) { // LEO-related interaction commands
  42. strcat(szMiscArray, "\nCuff\nDrag\nDetain\nTicket\nUncuff\nDrug Test\nConfiscate Drugs");
  43. }
  44. if(IsAMedic(playerid)) { // Medical-related commands.
  45. strcat(szMiscArray, "\nPrescribe Drug\nLoad Patient\nTriage\nHeal\nMove Patient\nDrug Test");
  46. }
  47. return ShowPlayerDialogEx(playerid, INTERACT_MAIN, DIALOG_STYLE_LIST, szTitle, szMiscArray, "Select", "Close");
  48. }
  49. case 1: {
  50. /*Ingredients\n\
  51. Pistol Ammo\t%d\n\
  52. Rifle Ammo\t%d\n\
  53. Deagle Ammo\t%d\n\
  54. Shotgun Ammo\t%d\n\*/
  55. format(szMiscArray, sizeof(szMiscArray), "Item\tCurrent Amount\n\
  56. Drugs\n\
  57. Materials\t%d\n\
  58. Fireworks\t%d\n\
  59. Syringes\t%d\n\
  60. Sprunk\t%d\n\
  61. PB Tokens\t%d\n\
  62. Weapon",
  63. PlayerInfo[playerid][pMats],
  64. PlayerInfo[playerid][pFirework],
  65. PlayerInfo[playerid][pSyringes],
  66. PlayerInfo[playerid][pSprunk],
  67. PlayerInfo[playerid][pPaintTokens]
  68. );
  69. return ShowPlayerDialogEx(playerid, INTERACT_GIVE, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szMiscArray, "Select", "Back");
  70. }
  71. case 2: {
  72. new itemid = GetPVarInt(playerid, "Interact_GiveItem");
  73. if(GetPVarType(playerid, "Interact_Drug")) {
  74. format(szMiscArray, sizeof(szMiscArray), "How many pieces of %s do you want to give %s", Drugs[GetPVarInt(playerid, "Interact_Drug")], GetPlayerNameEx(giveplayerid));
  75. }
  76. else format(szMiscArray, sizeof(szMiscArray), "How much %s do you want to give %s", Item_Getname(itemid), GetPlayerNameEx(giveplayerid));
  77. return ShowPlayerDialogEx(playerid, INTERACT_AMOUNT, DIALOG_STYLE_INPUT, szTitle, szMiscArray, "Select", "Back");
  78. }
  79. case 3: {
  80. for(new g = 0; g < 12; g++) {
  81. if(PlayerInfo[playerid][pGuns][g] != 0 && PlayerInfo[playerid][pAGuns][g] == 0) {
  82. format(szMiscArray, sizeof(szMiscArray), "%s\n%s(%i)", szMiscArray, Weapon_ReturnName(PlayerInfo[playerid][pGuns][g]), PlayerInfo[playerid][pGuns][g]);
  83. }
  84. }
  85. return ShowPlayerDialogEx(playerid, INTERACT_WEAPON, DIALOG_STYLE_LIST, szTitle, szMiscArray, "Give", "Back");
  86. }
  87. case 4: {
  88. new itemid = GetPVarInt(playerid, "Interact_GiveItem");
  89. new amount = GetPVarInt(playerid, "Interact_SellAmt");
  90. if(GetPVarType(playerid, "Interact_SellGun")) {
  91. new weaponid = GetPVarInt(playerid, "Interact_SellGun");
  92. format(szMiscArray, sizeof(szMiscArray), "How much do you want to sell %s to %s for?", ReturnWeaponName(weaponid), GetPlayerNameEx(giveplayerid));
  93. }
  94. if(GetPVarType(playerid, "Interact_Drug")) {
  95. new drugid = GetPVarInt(playerid, "Interact_Drug");
  96. format(szMiscArray, sizeof(szMiscArray), "How much do you want to sell %dg of %s to %s for?", amount, Drugs[drugid], GetPlayerNameEx(giveplayerid));
  97. }
  98. else format(szMiscArray, sizeof(szMiscArray), "How much do you want to sell %d %s to %s for?", amount, Item_Getname(itemid), GetPlayerNameEx(giveplayerid));
  99. return ShowPlayerDialogEx(playerid, INTERACT_SELL, DIALOG_STYLE_INPUT, szTitle, szMiscArray, "Sell", "Back");
  100. }
  101. case 5: {
  102. new itemid = GetPVarInt(playerid, "Interact_GiveItem");
  103. new amount = GetPVarInt(playerid, "Interact_SellAmt");
  104. new offerprice = GetPVarInt(playerid, "Interact_SellPrice");
  105. if(GetPVarType(playerid, "Interact_SellGun")) {
  106. new weaponid = GetPVarInt(playerid, "Interact_SellGun");
  107. format(szMiscArray, sizeof(szMiscArray), "[Interact]: You have offered %s to buy a %s for $%s", GetPlayerNameEx(giveplayerid), Item_Getname(itemid), number_format(offerprice));
  108. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  109. format(szMiscArray, sizeof(szMiscArray), "%s has offered you to buy a %s for $%s", GetPlayerNameEx(playerid), ReturnWeaponName(weaponid), number_format(offerprice));
  110. }
  111. else if(GetPVarType(playerid, "Interact_Drug")) {
  112. new drugid = GetPVarInt(playerid, "Interact_Drug");
  113. format(szMiscArray, sizeof(szMiscArray), "[Interact]: You have offered %s to buy %dg of %s {FFFFFF}for $%s", GetPlayerNameEx(giveplayerid), amount, Drugs[drugid], number_format(offerprice));
  114. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  115. format(szMiscArray, sizeof(szMiscArray), "%s has offered you to buy %dg of %s {FFFFFF}for $%s", GetPlayerNameEx(playerid), amount, Drugs[drugid], number_format(offerprice));
  116. }
  117. else {
  118. format(szMiscArray, sizeof(szMiscArray), "[Interact]: You have offered %s to buy %d %s for $%s", GetPlayerNameEx(giveplayerid), amount, Item_Getname(itemid), number_format(offerprice));
  119. SendClientMessage(playerid, COLOR_LIGHTBLUE, szMiscArray);
  120. format(szMiscArray, sizeof(szMiscArray), "%s has offered you to buy %d %s for $%s", GetPlayerNameEx(playerid), amount, Item_Getname(itemid), number_format(offerprice));
  121. }
  122. ShowPlayerDialogEx(giveplayerid, INTERACT_SELLCONFIRM, DIALOG_STYLE_MSGBOX, szTitle, szMiscArray, "Buy", "Reject");
  123. }
  124. case 6: {
  125. szMiscArray = "Drug\tAmount\n";
  126. for(new d; d < sizeof(Drugs); ++d) {
  127. format(szMiscArray, sizeof(szMiscArray), "%s%s\t%d\n", szMiscArray, Drugs[d], PlayerInfo[playerid][pDrugs][d]);
  128. }
  129. return ShowPlayerDialogEx(playerid, INTERACT_DRUGS, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szMiscArray, "Select", "Back");
  130. }
  131. }
  132. return 1;
  133. }
  134. Player_GiveItem(playerid, giveplayerid, itemid, amount, saleprice = 0) {
  135. // amount in the case of giving weapons is the weapon id ...
  136. szMiscArray[0] = 0;
  137. if(amount <= 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot give nothing.");
  138. if(restarting) return SendClientMessageEx(playerid, COLOR_RED, "Server restart in progress, trading is disabled.");
  139. if(saleprice != 0 && (GetPlayerCash(giveplayerid) < saleprice || saleprice < 0)) return SendClientMessage(giveplayerid, COLOR_GRAD2, "You do not have enough money");
  140. switch(itemid) {
  141. case ITEM_DRUG: {
  142. new drugid = GetPVarInt(playerid, "Interact_Drug");
  143. if(PlayerInfo[playerid][pDrugs][drugid] < amount) return SendClientMessageEx(playerid, COLOR_WHITE, "You do not have that much.");
  144. if(amount + PlayerInfo[giveplayerid][pDrugs][drugid] > Player_MaxCapacity(giveplayerid, itemid)) {
  145. format(szMiscArray, sizeof(szMiscArray), "That player can only hold %d more of that item.", Player_LeftCapacity(giveplayerid, itemid));
  146. SendClientMessageEx(playerid, COLOR_GRAD2, szMiscArray);
  147. return Player_InteractMenu(playerid, giveplayerid);
  148. }
  149. PlayerInfo[giveplayerid][pDrugs][drugid] += amount;
  150. PlayerInfo[playerid][pDrugs][drugid] -= amount;
  151. }
  152. case ITEM_MATS: {
  153. if(PlayerInfo[playerid][pMats] < amount) return SendClientMessageEx(playerid, COLOR_WHITE, "You do not have that many materials.");
  154. if(amount + PlayerInfo[giveplayerid][pMats] > Player_MaxCapacity(giveplayerid, itemid)) {
  155. format(szMiscArray, sizeof(szMiscArray), "That player can only hold %d more of that item.", Player_LeftCapacity(giveplayerid, itemid));
  156. SendClientMessageEx(playerid, COLOR_GRAD2, szMiscArray);
  157. return Player_InteractMenu(playerid, giveplayerid);
  158. }
  159. PlayerInfo[giveplayerid][pMats] += amount;
  160. PlayerInfo[playerid][pMats] -= amount;
  161. }
  162. case ITEM_FIREWORK: {
  163. if(PlayerInfo[playerid][pFirework] < amount) return SendClientMessageEx(playerid, COLOR_WHITE, "You do not have that many fireworks.");
  164. if(amount + PlayerInfo[giveplayerid][pFirework] > Player_MaxCapacity(giveplayerid, itemid)) {
  165. format(szMiscArray, sizeof(szMiscArray), "That player can only hold %d more of that item.", Player_LeftCapacity(giveplayerid, itemid));
  166. SendClientMessageEx(playerid, COLOR_GRAD2, szMiscArray);
  167. return Player_InteractMenu(playerid, giveplayerid);
  168. }
  169. PlayerInfo[giveplayerid][pFirework] += amount;
  170. PlayerInfo[playerid][pFirework] -= amount;
  171. }
  172. case ITEM_SYRINGES: {
  173. if(PlayerInfo[playerid][pSyringes] < amount) return SendClientMessageEx(playerid, COLOR_WHITE, "You do not have that much syringes.");
  174. if(amount + PlayerInfo[giveplayerid][pSyringes] > Player_MaxCapacity(giveplayerid, itemid)) {
  175. format(szMiscArray, sizeof(szMiscArray), "That player can only hold %d more of that item.", Player_LeftCapacity(giveplayerid, itemid));
  176. SendClientMessageEx(playerid, COLOR_GRAD2, szMiscArray);
  177. return Player_InteractMenu(playerid, giveplayerid);
  178. }
  179. PlayerInfo[giveplayerid][pSyringes] += amount;
  180. PlayerInfo[playerid][pSyringes] -= amount;
  181. }
  182. case ITEM_SPRUNKDRINK: {
  183. if(PlayerInfo[playerid][pSprunk] < amount) return SendClientMessageEx(playerid, COLOR_WHITE, "You do not have that much sprunk soda.");
  184. if(amount + PlayerInfo[giveplayerid][pSprunk] > Player_MaxCapacity(giveplayerid, itemid)) {
  185. format(szMiscArray, sizeof(szMiscArray), "That player can only hold %d more of that item.", Player_LeftCapacity(giveplayerid, itemid));
  186. SendClientMessageEx(playerid, COLOR_GRAD2, szMiscArray);
  187. return Player_InteractMenu(playerid, giveplayerid);
  188. }
  189. PlayerInfo[giveplayerid][pSprunk] += amount;
  190. PlayerInfo[playerid][pSprunk] -= amount;
  191. }
  192. case ITEM_PBTOKENS: {
  193. if(PlayerInfo[playerid][pPaintTokens] < amount) return SendClientMessageEx(playerid, COLOR_WHITE, "You do not have that many PB tokens.");
  194. if(amount + PlayerInfo[giveplayerid][pPaintTokens] > Player_MaxCapacity(giveplayerid, itemid)) {
  195. format(szMiscArray, sizeof(szMiscArray), "That player can only hold %d more of that item.", Player_LeftCapacity(giveplayerid, itemid));
  196. SendClientMessageEx(playerid, COLOR_GRAD2, szMiscArray);
  197. return Player_InteractMenu(playerid, giveplayerid);
  198. }
  199. PlayerInfo[giveplayerid][pPaintTokens] += amount;
  200. PlayerInfo[playerid][pPaintTokens] -= amount;
  201. }
  202. }
  203. if(saleprice == 0) {
  204. format(szMiscArray, sizeof(szMiscArray), "You have given %s %d %s", GetPlayerNameEx(giveplayerid), amount, Item_Getname(itemid));
  205. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  206. format(szMiscArray, sizeof(szMiscArray), "%s has given you %d %s", GetPlayerNameEx(playerid), amount, Item_Getname(itemid));
  207. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  208. format(szMiscArray, sizeof(szMiscArray), "%s hands %s some %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), Item_Getname(itemid));
  209. SetPlayerChatBubble(playerid, szMiscArray, COLOR_PURPLE, 5, 5000);
  210. format(szMiscArray, sizeof(szMiscArray), "%s(%d) (IP:%s) has given %d %s to %s(%d) (IP:%s)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], PlayerInfo[playerid][pIP], amount, Item_Getname(itemid), GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pId], PlayerInfo[giveplayerid][pIP]);
  211. Log("logs/pay.log", szMiscArray);
  212. format(szMiscArray, sizeof(szMiscArray), "gave %d %s.", amount, Item_Getname(itemid));
  213. DBLog(playerid, giveplayerid, "ItemTransfer", szMiscArray);
  214. }
  215. else {
  216. GivePlayerCash(playerid, saleprice);
  217. GivePlayerCash(giveplayerid, -saleprice);
  218. //TurfWars_TurfTax(giveplayerid, Item_Getname(itemid), saleprice); // Tax the buyer, not the seller.
  219. ExtortionTurfsWarsZone(playerid, 7, saleprice); // Back to taxing the seller.
  220. format(szMiscArray, sizeof(szMiscArray), "You have sold %s %d %s for $%s", GetPlayerNameEx(giveplayerid), amount, Item_Getname(itemid), number_format(saleprice));
  221. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  222. format(szMiscArray, sizeof(szMiscArray), "%s has sold you %d %s for $%s", GetPlayerNameEx(playerid), amount, Item_Getname(itemid), number_format(saleprice));
  223. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  224. format(szMiscArray, sizeof(szMiscArray), "%s hands %s some %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), Item_Getname(itemid));
  225. SetPlayerChatBubble(playerid, szMiscArray, COLOR_PURPLE, 5, 5000);
  226. format(szMiscArray, sizeof(szMiscArray), "%s(%d) (IP:%s) has sold %d %s $%s to %s(%d) (IP:%s)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], PlayerInfo[playerid][pIP], amount, Item_Getname(itemid), number_format(saleprice), GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pId], PlayerInfo[giveplayerid][pIP]);
  227. Log("logs/pay.log", szMiscArray);
  228. format(szMiscArray, sizeof(szMiscArray), "%d %s $%s.", amount, Item_Getname(itemid), number_format(saleprice));
  229. DBLog(playerid, giveplayerid, "ItemTransfer", szMiscArray);
  230. }
  231. return 1;
  232. }
  233. Player_MaxCapacity(playerid, itemid) {
  234. // planning on making this relative to a storage system in the future
  235. new iTemp = 0;
  236. switch(itemid) {
  237. case ITEM_MATS: iTemp = 1000000;
  238. case ITEM_FIREWORK: iTemp = 10;
  239. case ITEM_SYRINGES: iTemp = 20;
  240. case ITEM_SPRUNKDRINK: iTemp = 1;
  241. case ITEM_PBTOKENS: iTemp = 40;
  242. case ITEM_DRUG: {
  243. iTemp = GetMaxDrugsAllowed(GetPVarInt(playerid, "Interact_Drug"));
  244. }
  245. }
  246. return iTemp;
  247. }
  248. Player_LeftCapacity(playerid, itemid) {
  249. new
  250. iCapacity = Player_MaxCapacity(playerid, itemid);
  251. switch(itemid) {
  252. case ITEM_MATS: return (iCapacity - PlayerInfo[playerid][pMats]);
  253. case ITEM_FIREWORK: return (iCapacity - PlayerInfo[playerid][pFirework]);
  254. case ITEM_SYRINGES: return (iCapacity - PlayerInfo[playerid][pSyringes]);
  255. case ITEM_SPRUNKDRINK: return (iCapacity - PlayerInfo[playerid][pSprunk]);
  256. case ITEM_PBTOKENS: return (iCapacity - PlayerInfo[playerid][pPaintTokens]);
  257. case ITEM_DRUG: return (iCapacity - PlayerInfo[playerid][pDrugs][GetPVarInt(playerid, "Interact_Drug")]);
  258. default: return 0;
  259. }
  260. return 0;
  261. }
  262. Item_Getname(itemid) {
  263. new szTemp[18];
  264. switch(itemid) {
  265. case ITEM_MATS: szTemp = "materials";
  266. case ITEM_FIREWORK: szTemp = "fireworks";
  267. case ITEM_SYRINGES: szTemp = "syringes";
  268. case ITEM_SPRUNKDRINK: szTemp = "sprunk";
  269. case ITEM_PBTOKENS: szTemp = "paintball tokens";
  270. }
  271. return szTemp;
  272. }
  273. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  274. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  275. switch(dialogid) {
  276. case INTERACT_MAIN: {
  277. if(!response) {
  278. return DeletePVar(playerid, "Interact_Target");
  279. }
  280. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  281. switch(listitem) {
  282. case 0: return Interact_PayPlayer(playerid, giveplayerid);
  283. case 1: return Player_InteractMenu(playerid, giveplayerid, 1);
  284. case 2: {
  285. SetPVarInt(playerid, "Interact_Sell", 1);
  286. return Player_InteractMenu(playerid, giveplayerid, 1);
  287. }
  288. case 3: return Interact_FriskPlayer(playerid, giveplayerid);
  289. case 4: return Interact_ShowLicenses(playerid, giveplayerid);
  290. }
  291. if(strcmp(inputtext, "Cuff") == 0) return Interact_CuffPlayer(playerid, giveplayerid);
  292. else if(strcmp(inputtext, "Drag") == 0) return Interact_DragPlayer(playerid, giveplayerid);
  293. else if(strcmp(inputtext, "Detain") == 0) return Interact_DetainPlayer(playerid, giveplayerid);
  294. else if(strcmp(inputtext, "Ticket") == 0) return Interact_GiveTicket(playerid, giveplayerid, "");
  295. else if(strcmp(inputtext, "Uncuff") == 0) return Interact_UncuffPlayer(playerid, giveplayerid);
  296. else if(strcmp(inputtext, "Drug Test") == 0) return SendClientMessageEx(playerid, COLOR_WHITE, "Drug tests have been disabled and will later be removed completely.");
  297. else if(strcmp(inputtext, "Confiscate Drugs") == 0) return Interact_TakeDrugs(playerid, giveplayerid);
  298. else if(strcmp(inputtext, "Prescribe Drug") == 0) return Interact_Prescribe(playerid, 0);
  299. else if(strcmp(inputtext, "Load Patient") == 0) Interact_LoadPatient(playerid, giveplayerid);
  300. else if(strcmp(inputtext, "Triage") == 0) return Interact_Triage(playerid, giveplayerid);
  301. else if(strcmp(inputtext, "Heal") == 0) return Interact_Heal(playerid, giveplayerid);
  302. else if(strcmp(inputtext, "Move Patient") == 0) return Interact_MovePatient(playerid, giveplayerid);
  303. }
  304. case INTERACT_GIVE: {
  305. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  306. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  307. if(strcmp(inputtext, "Drugs") == 0) return Player_InteractMenu(playerid, giveplayerid, 6);
  308. if(strcmp(inputtext, "Weapon") == 0) return Player_InteractMenu(playerid, giveplayerid, 3);
  309. SetPVarInt(playerid, "Interact_GiveItem", listitem);
  310. Player_InteractMenu(playerid, giveplayerid, 2);
  311. }
  312. case INTERACT_AMOUNT: {
  313. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  314. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  315. new
  316. amount = strval(inputtext),
  317. itemid = GetPVarInt(playerid, "Interact_GiveItem");
  318. if(amount < 1) {
  319. SendClientMessageEx(playerid, COLOR_RED, "You must offer an item greater than 0!");
  320. return Player_InteractMenu(playerid, giveplayerid, 0);
  321. }
  322. SetPVarInt(playerid, "Interact_SellAmt", amount);
  323. if(GetPVarType(playerid, "Interact_Sell")) {
  324. return Player_InteractMenu(playerid, giveplayerid, 4);
  325. }
  326. if(GetPVarType(playerid, "Interact_Drug")) {
  327. Interact_GivePlayerDrug(playerid, giveplayerid, GetPVarInt(playerid, "Interact_Drug"));
  328. return 1;
  329. }
  330. Player_GiveItem(playerid, giveplayerid, itemid, amount);
  331. }
  332. case DETAIN_SEAT: {
  333. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  334. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  335. new seatid = strval(inputtext);
  336. if(!(0 < seatid <= 3)) {
  337. SendClientMessageEx(playerid, COLOR_GRAD2, "Seat id must be between 1, 2 or 3.");
  338. return Interact_DetainPlayer(playerid, giveplayerid);
  339. }
  340. Interact_DetainPlayer(playerid, giveplayerid, seatid);
  341. }
  342. case GIVE_TICKET: {
  343. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  344. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  345. new amount = strval(inputtext);
  346. if(!(0 < amount <= 25000)) {
  347. SendClientMessageEx(playerid, COLOR_GRAD2, "Ticket price must be between $0 and $25,000.");
  348. return Interact_GiveTicket(playerid, giveplayerid, "");
  349. }
  350. SetPVarInt(playerid, "Ticket_Amount", amount);
  351. Interact_GiveTicket(playerid, giveplayerid, "", amount);
  352. }
  353. case TICKET_REASON: {
  354. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  355. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  356. new amount = GetPVarInt(playerid, "Ticket_Amount");
  357. Interact_GiveTicket(playerid, giveplayerid, inputtext, amount);
  358. }
  359. case PATIENT_SEAT: {
  360. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  361. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  362. new seatid = strval(inputtext);
  363. if(!(0 < seatid <= 3)) {
  364. SendClientMessageEx(playerid, COLOR_GRAD2, "Seat id must be between 1, 2 or 3.");
  365. return Interact_LoadPatient(playerid, giveplayerid);
  366. }
  367. Interact_LoadPatient(playerid, giveplayerid, seatid);
  368. }
  369. case PAY_PLAYER: {
  370. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  371. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  372. new amount = strval(inputtext);
  373. Interact_PayPlayer(playerid, giveplayerid, amount);
  374. }
  375. case INTERACT_WEAPON: {
  376. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  377. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  378. new stpos = strfind(inputtext, "(");
  379. new fpos = strfind(inputtext, ")");
  380. new idstr[4], id;
  381. strmid(idstr, inputtext, stpos+1, fpos);
  382. id = strval(idstr);
  383. if(GetPVarType(playerid, "Interact_Sell")) {
  384. SetPVarInt(playerid, "Interact_SellGun", id);
  385. return Player_InteractMenu(playerid, giveplayerid, 4);
  386. }
  387. Interact_GivePlayerValidWeapon(playerid, giveplayerid, id);
  388. }
  389. case INTERACT_DRUGS: {
  390. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  391. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  392. SetPVarInt(playerid, "Interact_GiveItem", ITEM_DRUG);
  393. SetPVarInt(playerid, "Interact_Drug", listitem);
  394. if(GetPVarType(playerid, "Interact_Sell")) {
  395. return Player_InteractMenu(playerid, giveplayerid, 2);
  396. }
  397. Player_InteractMenu(playerid, giveplayerid, 2);
  398. }
  399. case INTERACT_SELL: {
  400. new giveplayerid = GetPVarInt(playerid, "Interact_Target");
  401. if(!response) return Player_InteractMenu(playerid, giveplayerid, 0);
  402. new price = strval(inputtext);
  403. SetPVarInt(playerid, "Interact_SellPrice", price);
  404. SetPVarInt(giveplayerid, "Interact_Buying", playerid);
  405. Player_InteractMenu(playerid, giveplayerid, 5);
  406. }
  407. case INTERACT_SELLCONFIRM: {
  408. new buyingfrom = GetPVarInt(playerid, "Interact_Buying");
  409. if(!response) {
  410. SendClientMessageEx(playerid, COLOR_WHITE, "You have rejected the trade offer.");
  411. SendClientMessageEx(buyingfrom, COLOR_WHITE, "That person has rejected the trade offer.");
  412. DeletePVar(playerid, "Interact_Buying");
  413. DeletePVar(buyingfrom, "Interact_SellPrice");
  414. DeletePVar(buyingfrom, "Interact_Sell");
  415. DeletePVar(buyingfrom, "Interact_SellGun");
  416. DeletePVar(playerid, "Interact_Drug");
  417. DeletePVar(buyingfrom, "Interact_GiveItem");
  418. DeletePVar(buyingfrom, "Interact_SellAmt");
  419. return 1;
  420. }
  421. new itemid = GetPVarInt(buyingfrom, "Interact_GiveItem");
  422. new amount = GetPVarInt(buyingfrom, "Interact_SellAmt");
  423. new offerprice = GetPVarInt(buyingfrom, "Interact_SellPrice");
  424. if(GetPVarType(buyingfrom, "Interact_SellGun")) {
  425. new weaponid = GetPVarInt(buyingfrom, "Interact_SellGun");
  426. format(szMiscArray, sizeof(szMiscArray), "%s has offered you to buy a %s for $%s\n\nPlease confirm again if you really are sure you want to complete this transaction!", GetPlayerNameEx(buyingfrom), ReturnWeaponName(weaponid), number_format(offerprice));
  427. }
  428. else if(GetPVarType(buyingfrom, "Interact_Drug")) {
  429. new drugid = GetPVarInt(buyingfrom, "Interact_Drug");
  430. format(szMiscArray, sizeof(szMiscArray), "%s has offered you to buy %dg of %s {FFFFFF}for $%s\n\nPlease confirm again if you really are sure you want to complete this transaction!", GetPlayerNameEx(buyingfrom), amount, Drugs[drugid], number_format(offerprice));
  431. }
  432. else {
  433. format(szMiscArray, sizeof(szMiscArray), "%s has offered you to buy %d %s for $%s\n\nPlease confirm again if you really are sure you want to complete this transaction!", GetPlayerNameEx(playerid), amount, Item_Getname(itemid), number_format(offerprice));
  434. }
  435. ShowPlayerDialogEx(playerid, INTERACT_SELLCONFIRM2, DIALOG_STYLE_MSGBOX, "Are you really sure?", szMiscArray, "Buy", "Reject");
  436. }
  437. case INTERACT_SELLCONFIRM2: {
  438. new buyingfrom = GetPVarInt(playerid, "Interact_Buying");
  439. if(!response) {
  440. SendClientMessageEx(playerid, COLOR_WHITE, "You have rejected the trade offer.");
  441. SendClientMessageEx(buyingfrom, COLOR_WHITE, "That person has rejected the trade offer.");
  442. DeletePVar(playerid, "Interact_Buying");
  443. DeletePVar(buyingfrom, "Interact_SellPrice");
  444. DeletePVar(buyingfrom, "Interact_Sell");
  445. DeletePVar(buyingfrom, "Interact_SellGun");
  446. DeletePVar(playerid, "Interact_Drug");
  447. DeletePVar(buyingfrom, "Interact_GiveItem");
  448. DeletePVar(buyingfrom, "Interact_SellAmt");
  449. return 1;
  450. }
  451. new price = GetPVarInt(buyingfrom, "Interact_SellPrice");
  452. if(GetPVarType(buyingfrom, "Interact_Sell")) {
  453. if(GetPVarType(buyingfrom, "Interact_SellGun")) {
  454. new weaponid = GetPVarInt(buyingfrom, "Interact_SellGun");
  455. if(PlayerInfo[buyingfrom][pGuns][GetWeaponSlot(weaponid)] == weaponid)
  456. {
  457. Interact_GivePlayerValidWeapon(buyingfrom, playerid, weaponid, price);
  458. }
  459. }
  460. else if(GetPVarType(buyingfrom, "Interact_Drug")) {
  461. new drugid = GetPVarInt(buyingfrom, "Interact_Drug");
  462. Interact_GivePlayerDrug(buyingfrom, playerid, drugid, price);
  463. }
  464. else {
  465. new itemid = GetPVarInt(buyingfrom, "Interact_GiveItem");
  466. new amount = GetPVarInt(buyingfrom, "Interact_SellAmt");
  467. Player_GiveItem(buyingfrom, playerid, itemid, amount, price);
  468. }
  469. }
  470. DeletePVar(playerid, "Interact_Buying");
  471. DeletePVar(buyingfrom, "Interact_SellPrice");
  472. DeletePVar(buyingfrom, "Interact_Sell");
  473. DeletePVar(buyingfrom, "Interact_SellGun");
  474. DeletePVar(buyingfrom, "Interact_GiveItem");
  475. DeletePVar(buyingfrom, "Interact_SellAmt");
  476. }
  477. case INTERACT_PRESCRIBE: {
  478. SetPVarString(playerid, "DR_PTYPE", inputtext);
  479. Interact_Prescribe(playerid, 1);
  480. }
  481. case INTERACT_PRESCRIBE1: {
  482. if(strval(inputtext) <= 0 || !IsNumeric(inputtext)) return SendClientMessage(playerid, COLOR_GRAD1, "You specified an invalid value.");
  483. SetPVarInt(playerid, "DR_PAM", strval(inputtext));
  484. Interact_ProcessPrescription(playerid);
  485. }
  486. }
  487. return 0;
  488. }
  489. Interact_GivePlayerValidWeapon(playerid, giveplayerid, weaponid, saleprice = 0) {
  490. if(PlayerInfo[giveplayerid][pGuns][GetWeaponSlot(weaponid)] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "That player already has a weapon in that slot");
  491. if(PlayerInfo[playerid][pGuns][GetWeaponSlot(weaponid)] != weaponid) return SendClientMessageEx(playerid, COLOR_GREY, "You don't have a weapon in your possession.");
  492. if(weaponid == WEAPON_KNIFE) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot give knives!");
  493. if(GetPVarType(giveplayerid, "IsInArena") || GetPVarInt(giveplayerid, "EventToken") != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot do this right now!");
  494. if(PlayerInfo[giveplayerid][pConnectHours] < 2 || PlayerInfo[giveplayerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "That person is currently restricted from carrying weapons");
  495. if(saleprice != 0 && (GetPlayerCash(giveplayerid) < saleprice || saleprice < 0)) return SendClientMessage(giveplayerid, COLOR_GRAD2, "You do not have enough money");
  496. PlayerInfo[playerid][pGuns][GetWeaponSlot(weaponid)] = 0;
  497. SetPlayerWeaponsEx(playerid);
  498. GivePlayerValidWeapon(giveplayerid, weaponid);
  499. if(saleprice != 0) {
  500. GivePlayerCash(playerid, saleprice);
  501. GivePlayerCash(giveplayerid, -saleprice);
  502. //TurfWars_TurfTax(giveplayerid, ReturnWeaponName(weaponid), saleprice);
  503. ExtortionTurfsWarsZone(playerid, 3, saleprice);
  504. format(szMiscArray, sizeof(szMiscArray), "You have sold %s a %s for $%s", GetPlayerNameEx(giveplayerid), ReturnWeaponName(weaponid), number_format(saleprice));
  505. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  506. format(szMiscArray, sizeof(szMiscArray), "%s has sold you a %s $%s", GetPlayerNameEx(playerid), ReturnWeaponName(weaponid), number_format(saleprice));
  507. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  508. format(szMiscArray, sizeof(szMiscArray), "%s(%d) (IP:%s) has sold a %s for $%s to %s(%d) (IP:%s)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], PlayerInfo[playerid][pIP], ReturnWeaponName(weaponid), number_format(saleprice), GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pId], PlayerInfo[giveplayerid][pIP]);
  509. Log("logs/pay.log", szMiscArray);
  510. format(szMiscArray, sizeof(szMiscArray), "sold a %s for $%s.", ReturnWeaponName(weaponid), number_format(saleprice));
  511. DBLog(playerid, giveplayerid, "ItemTransfer", szMiscArray);
  512. }
  513. else {
  514. format(szMiscArray, sizeof(szMiscArray), "You have given %s a %s", GetPlayerNameEx(giveplayerid), ReturnWeaponName(weaponid));
  515. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  516. format(szMiscArray, sizeof(szMiscArray), "%s has given you a %s", GetPlayerNameEx(playerid), ReturnWeaponName(weaponid));
  517. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  518. format(szMiscArray, sizeof(szMiscArray), "%s(%d) (IP:%s) has given a %s to %s(%d) (IP:%s)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], PlayerInfo[playerid][pIP], ReturnWeaponName(weaponid), GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pId], PlayerInfo[giveplayerid][pIP]);
  519. Log("logs/pay.log", szMiscArray);
  520. format(szMiscArray, sizeof(szMiscArray), "gave a %s.", ReturnWeaponName(weaponid));
  521. DBLog(playerid, giveplayerid, "ItemTransfer", szMiscArray);
  522. }
  523. format(szMiscArray, sizeof(szMiscArray), "%s gave %s a %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), ReturnWeaponName(weaponid));
  524. SetPlayerChatBubble(playerid, szMiscArray, COLOR_PURPLE, 10, 5000);
  525. return 1;
  526. }
  527. Interact_GivePlayerDrug(playerid, giveplayerid, drugid, saleprice = 0) {
  528. szMiscArray[0] = 0;
  529. new amount = GetPVarInt(playerid, "Interact_SellAmt");
  530. if(amount < 0) return 1;
  531. if(restarting) return SendClientMessageEx(playerid, COLOR_RED, "Server restart in progress, trading is disabled.");
  532. if(saleprice != 0 && (GetPlayerCash(giveplayerid) < saleprice || saleprice < 0)) return SendClientMessage(giveplayerid, COLOR_GRAD2, "You do not have enough money");
  533. if(PlayerInfo[playerid][pDrugs][drugid] < amount) return SendClientMessageEx(playerid, COLOR_WHITE, "You do not have that much.");
  534. if(amount + PlayerInfo[giveplayerid][pDrugs][drugid] > Player_MaxCapacity(giveplayerid, ITEM_DRUG)) {
  535. format(szMiscArray, sizeof(szMiscArray), "That player can only hold %d more of that item.", Player_LeftCapacity(giveplayerid, ITEM_DRUG));
  536. SendClientMessageEx(playerid, COLOR_GRAD2, szMiscArray);
  537. return Player_InteractMenu(playerid, giveplayerid);
  538. }
  539. PlayerInfo[giveplayerid][pDrugs][drugid] += amount;
  540. PlayerInfo[playerid][pDrugs][drugid] -= amount;
  541. //PlayerInfo[giveplayerid][pDrugsQuality][drugid] = PlayerInfo[playerid][pDrugsQuality][drugid];
  542. if(saleprice != 0) {
  543. GivePlayerCash(playerid, saleprice);
  544. GivePlayerCash(giveplayerid, -saleprice);
  545. //TurfWars_TurfTax(giveplayerid, Drugs[drugid], saleprice);
  546. ExtortionTurfsWarsZone(playerid, 1, saleprice);
  547. format(szMiscArray, sizeof(szMiscArray), "You have sold %s %dg of %s for $%s", GetPlayerNameEx(giveplayerid), amount, Drugs[drugid], number_format(saleprice));
  548. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  549. format(szMiscArray, sizeof(szMiscArray), "%s has sold you %dg of %s for $%s", GetPlayerNameEx(playerid), amount, Drugs[drugid], number_format(saleprice));
  550. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  551. format(szMiscArray, sizeof(szMiscArray), "%s(%d) (IP:%s) has sold %dg of %s for $%s to %s(%d) (IP:%s)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], PlayerInfo[playerid][pIP], amount, Drugs[drugid], number_format(saleprice), GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pId], PlayerInfo[giveplayerid][pIP]);
  552. Log("logs/pay.log", szMiscArray);
  553. format(szMiscArray, sizeof(szMiscArray), "sold %dg of %s for $%s.", amount, Drugs[drugid], number_format(saleprice));
  554. DBLog(playerid, giveplayerid, "ItemTransfer", szMiscArray);
  555. }
  556. else {
  557. format(szMiscArray, sizeof(szMiscArray), "You have given %s %dg of %s", GetPlayerNameEx(giveplayerid), amount, Drugs[drugid]);
  558. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  559. format(szMiscArray, sizeof(szMiscArray), "%s has given you %dg of %s", GetPlayerNameEx(playerid), amount, Drugs[drugid]);
  560. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  561. format(szMiscArray, sizeof(szMiscArray), "%s(%d) (IP:%s) has given %dg of %s to %s(%d) (IP:%s)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], PlayerInfo[playerid][pIP], amount, Drugs[drugid], GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pId], PlayerInfo[giveplayerid][pIP]);
  562. Log("logs/pay.log", szMiscArray);
  563. format(szMiscArray, sizeof(szMiscArray), "gave %dg of %s.", amount, Drugs[drugid]);
  564. DBLog(playerid, giveplayerid, "ItemTransfer", szMiscArray);
  565. }
  566. format(szMiscArray, sizeof(szMiscArray), "%s gave %s some %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), Drugs[drugid]);
  567. SetPlayerChatBubble(playerid, szMiscArray, COLOR_PURPLE, 10, 5000);
  568. return 1;
  569. }
  570. Interact_PayPlayer(playerid, giveplayerid, amount = -1) {
  571. if(amount == -1) {
  572. format(szMiscArray, sizeof(szMiscArray), "Please enter an amount to give %s.", GetPlayerNameEx(giveplayerid));
  573. return ShowPlayerDialogEx(playerid, PAY_PLAYER, DIALOG_STYLE_INPUT, "Pay Player", szMiscArray, "Pay", "");
  574. }
  575. else {
  576. if(!(0 < amount <= 250000)) return SendClientMessageEx(playerid, COLOR_WHITE, "Maximum amount is $250,000, minimum is $1");
  577. if (!ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not near you.");
  578. if(PlayerInfo[playerid][pCash] < amount) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have enough on you.");
  579. format(szMiscArray, sizeof(szMiscArray), "You have paid %s $%s", GetPlayerNameEx(giveplayerid), number_format(amount));
  580. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  581. format(szMiscArray, sizeof(szMiscArray), "You have been paid $%s by %s", number_format(amount), GetPlayerNameEx(playerid));
  582. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  583. GivePlayerCash(playerid, -amount);
  584. GivePlayerCash(giveplayerid, amount);
  585. format(szMiscArray, sizeof(szMiscArray), "%s(%d) (IP:%s) has paid %s to %s(%d) (IP:%s)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pId], PlayerInfo[playerid][pIP], number_format(amount), GetPlayerNameEx(giveplayerid), PlayerInfo[giveplayerid][pId], PlayerInfo[giveplayerid][pIP]);
  586. Log("logs/pay.log", szMiscArray);
  587. format(szMiscArray, sizeof(szMiscArray), "has been paid $%s", number_format(amount));
  588. DBLog(playerid, giveplayerid, "Pay_Log", szMiscArray);
  589. }
  590. return 1;
  591. }
  592. Interact_CuffPlayer(playerid, giveplayerid) {
  593. if(GetPVarInt(playerid, "Injured") == 1 || PlayerCuffed[ playerid ] >= 1 || PlayerInfo[ playerid ][ pJailTime ] > 0 || PlayerInfo[playerid][pHospital] > 0)
  594. return SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
  595. if(PlayerInfo[playerid][pHasCuff] < 1) return SendClientMessageEx(playerid, COLOR_WHITE, "You do not have any pair of cuffs on you!");
  596. new Float:health, Float:armor;
  597. if(!IsPlayerConnected(giveplayerid))
  598. if (!ProxDetectorS(8.0, playerid, giveplayerid))
  599. if(GetPVarInt(giveplayerid, "Injured") == 1) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot cuff someone in a injured state.");
  600. if(PlayerCuffed[giveplayerid] != 1 && GetPlayerSpecialAction(giveplayerid) != SPECIAL_ACTION_HANDSUP) return SendClientMessage(playerid, COLOR_WHITE, "That player is not restrained");
  601. if(PlayerInfo[giveplayerid][pConnectHours] < 32) SendClientMessageEx(giveplayerid, COLOR_WHITE, "If you logout now you will automatically be prisoned for 2+ hours!");
  602. format(szMiscArray, sizeof(szMiscArray), "* You have been handcuffed by %s.", GetPlayerNameEx(playerid));
  603. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMiscArray);
  604. format(szMiscArray, sizeof(szMiscArray), "* You handcuffed %s, till uncuff.", GetPlayerNameEx(giveplayerid));
  605. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMiscArray);
  606. format(szMiscArray, sizeof(szMiscArray), "* %s handcuffs %s, tightening the cuffs securely.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  607. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  608. GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
  609. TogglePlayerControllable(giveplayerid, 0);
  610. ClearAnimationsEx(giveplayerid);
  611. GetHealth(giveplayerid, health);
  612. GetArmour(giveplayerid, armor);
  613. SetPVarFloat(giveplayerid, "cuffhealth",health);
  614. SetPVarFloat(giveplayerid, "cuffarmor",armor);
  615. SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
  616. ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0,1);
  617. PlayerCuffed[giveplayerid] = 2;
  618. SetPVarInt(giveplayerid, "PlayerCuffed", 2);
  619. SetPVarInt(giveplayerid, "IsFrozen", 1);
  620. //Frozen[giveplayerid] = 1;
  621. PlayerCuffedTime[giveplayerid] = 60;
  622. if(GetPVarType(giveplayerid, "IsTackled")) {
  623. format(szMiscArray, sizeof(szMiscArray), "* %s removes a set of cuffs from his belt and attempts to cuff %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  624. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  625. SetTimerEx("CuffTackled", 4000, 0, "ii", playerid, giveplayerid);
  626. }
  627. return 1;
  628. }
  629. Interact_UncuffPlayer(playerid, giveplayerid) {
  630. if (!ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not near you.");
  631. if(PlayerCuffed[giveplayerid]>1) {
  632. DeletePVar(giveplayerid, "IsFrozen");
  633. format(szMiscArray, sizeof(szMiscArray), "* You have been uncuffed by %s.", GetPlayerNameEx(playerid));
  634. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMiscArray);
  635. format(szMiscArray, sizeof(szMiscArray), "* You uncuffed %s.", GetPlayerNameEx(giveplayerid));
  636. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMiscArray);
  637. format(szMiscArray, sizeof(szMiscArray), "* %s has uncuffed %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  638. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  639. GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3);
  640. TogglePlayerControllable(giveplayerid, 1);
  641. ClearAnimationsEx(giveplayerid);
  642. SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_NONE);
  643. PlayerCuffed[giveplayerid] = 0;
  644. PlayerCuffedTime[giveplayerid] = 0;
  645. SetHealth(giveplayerid, GetPVarFloat(giveplayerid, "cuffhealth"));
  646. SetArmour(giveplayerid, GetPVarFloat(giveplayerid, "cuffarmor"));
  647. DeletePVar(giveplayerid, "cuffhealth");
  648. DeletePVar(giveplayerid, "PlayerCuffed");
  649. DeletePVar(giveplayerid, "jailcuffs");
  650. }
  651. else if(GetPVarInt(giveplayerid, "jailcuffs") == 1) {
  652. DeletePVar(giveplayerid, "IsFrozen");
  653. format(szMiscArray, sizeof(szMiscArray), "* You have been uncuffed by %s.", GetPlayerNameEx(playerid));
  654. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMiscArray);
  655. format(szMiscArray, sizeof(szMiscArray), "* You uncuffed %s.", GetPlayerNameEx(giveplayerid));
  656. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMiscArray);
  657. format(szMiscArray, sizeof(szMiscArray), "* %s has uncuffed %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  658. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  659. GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3);
  660. ClearAnimationsEx(giveplayerid);
  661. SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_NONE);
  662. DeletePVar(giveplayerid, "jailcuffs");
  663. }
  664. return 1;
  665. }
  666. /*Interact_DrugTest(playerid, giveplayerid) {
  667. new szTitle[128];
  668. format(szTitle, sizeof(szTitle), "_______ %s's Drug Test _______", GetPlayerNameEx(giveplayerid));
  669. szMiscArray = "Name\tLevel (CT)\n";
  670. for(new i; i < sizeof(Drugs); ++i) {
  671. if(PlayerInfo[giveplayerid][pDrugsTaken][i] > 0) format(szMiscArray, sizeof(szMiscArray), "%s%s \t Level: %d CT\n", szMiscArray, Drugs[i], PlayerInfo[giveplayerid][pDrugsTaken][i]);
  672. else format(szMiscArray, sizeof(szMiscArray), "%s%s \t Level: None\n", szMiscArray, Drugs[i]);
  673. }
  674. strcat(szMiscArray, "________________________________", sizeof(szMiscArray));
  675. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szMiscArray, "<<", "");
  676. format(szMiscArray, sizeof(szMiscArray), "** %s has conducted a drug test on %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  677. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  678. return 1;
  679. return SendClientMessage(playerid, COLOR_WHITE, "This feature has been removed.");
  680. }*/
  681. Interact_TakeDrugs(playerid, giveplayerid) {
  682. for(new i; i < sizeof(Drugs); ++i) {
  683. PlayerInfo[giveplayerid][pDrugs][i] = 0;
  684. PlayerInfo[giveplayerid][pBDrugs][i] = 0;
  685. }
  686. format(szMiscArray, sizeof(szMiscArray), "** %s has confiscated %s's drugs.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  687. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  688. return 1;
  689. }
  690. Interact_ShowLicenses(playerid, giveplayerid) {
  691. if (!ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not near you.");
  692. new text1[40], text2[20], text3[20], text4[20], text5[40];
  693. if(PlayerInfo[playerid][pCarLic] == 0) { text1 = "Not acquired"; }
  694. else { text1 = date(PlayerInfo[playerid][pCarLic], 1); }
  695. if(PlayerInfo[playerid][pFlyLic]) { text4 = "Acquired"; } else { text4 = "Not acquired"; }
  696. if(PlayerInfo[playerid][pBoatLic]) { text2 = "Acquired"; } else { text2 = "Not acquired"; }
  697. if(PlayerInfo[playerid][pTaxiLicense]) { text3 = "Acquired"; } else { text3 = "Not acquired"; }
  698. if(PlayerInfo[playerid][pGunLic] == 0) {text5 = "Not acquired"; }
  699. else {text5 = date(PlayerInfo[playerid][pGunLic], 1);}
  700. switch(PlayerInfo[playerid][pNation]) {
  701. case 0: SendClientMessageEx(giveplayerid, COLOR_WHITE, "** Citizen of San Andreas **");
  702. case 1: SendClientMessageEx(giveplayerid, COLOR_TR, "** Citizen of New Robada **");
  703. case 2: SendClientMessageEx(giveplayerid, COLOR_TR, "** No citizenship **");
  704. }
  705. format(szMiscArray, sizeof(szMiscArray), "Listing %s's licenses...", GetPlayerNameEx(playerid));
  706. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  707. format(szMiscArray, sizeof(szMiscArray), "Date of Birth: %s", PlayerInfo[playerid][pBirthDate]);
  708. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  709. format(szMiscArray, sizeof(szMiscArray), "** Driver's license: %s.", text1);
  710. SendClientMessageEx(giveplayerid, COLOR_GREY, szMiscArray);
  711. format(szMiscArray, sizeof(szMiscArray), "** Pilot license: %s.", text4);
  712. SendClientMessageEx(giveplayerid, COLOR_GREY, szMiscArray);
  713. format(szMiscArray, sizeof(szMiscArray), "** Boating license: %s.", text2);
  714. SendClientMessageEx(giveplayerid, COLOR_GREY, szMiscArray);
  715. format(szMiscArray, sizeof(szMiscArray), "** Taxi license: %s.", text3);
  716. SendClientMessageEx(giveplayerid, COLOR_GREY, szMiscArray);
  717. format(szMiscArray, sizeof(szMiscArray), "** SA Firearm license: %s.", text5);
  718. SendClientMessageEx(giveplayerid, COLOR_GREY, szMiscArray);
  719. format(szMiscArray, sizeof(szMiscArray), "* %s has shown their licenses to you.", GetPlayerNameEx(playerid));
  720. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMiscArray);
  721. format(szMiscArray, sizeof(szMiscArray), "* You have shown your licenses to %s.", GetPlayerNameEx(giveplayerid));
  722. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMiscArray);
  723. return 1;
  724. }
  725. Interact_FriskPlayer(playerid, giveplayerid) {
  726. if (!ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You are not in range of that player");
  727. if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot frisk yourself!"); return 1; }
  728. new packages = GetPVarInt(giveplayerid, "Packages");
  729. new crates = PlayerInfo[giveplayerid][pCrates];
  730. SendClientMessageEx(playerid, COLOR_GREEN, "_______________________________________");
  731. format(szMiscArray, sizeof(szMiscArray), "Listing pocket for %s.", GetPlayerNameEx(giveplayerid));
  732. SendClientMessageEx(playerid, COLOR_YELLOW, szMiscArray);
  733. SendClientMessageEx(playerid, COLOR_WHITE, "** Items **");
  734. if(PlayerInfo[giveplayerid][pMats] > 0)
  735. {
  736. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d materials.", PlayerInfo[giveplayerid][pMats]);
  737. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  738. }
  739. if(PlayerInfo[giveplayerid][pSyringes] > 0)
  740. {
  741. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d syringes.", PlayerInfo[giveplayerid][pSyringes]);
  742. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  743. }
  744. if(packages > 0)
  745. {
  746. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d material packages.", packages);
  747. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  748. }
  749. if(crates > 0)
  750. {
  751. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d drug crates.", crates);
  752. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  753. }
  754. SendClientMessageEx(playerid, COLOR_WHITE, "** Drugs **");
  755. for(new i = 0; i < sizeof(Drugs); i++) {
  756. if(PlayerInfo[giveplayerid][pDrugs][i] > 0) {
  757. format(szMiscArray, sizeof(szMiscArray), "%s: %dg", Drugs[i], PlayerInfo[giveplayerid][pDrugs][i]);
  758. SendClientMessageEx(playerid, COLOR_GRAD1, szMiscArray);
  759. }
  760. }
  761. if(Fishes[giveplayerid][pWeight1] > 0 || Fishes[giveplayerid][pWeight2] > 0 || Fishes[giveplayerid][pWeight3] > 0 || Fishes[giveplayerid][pWeight4] > 0 || Fishes[giveplayerid][pWeight5] > 0)
  762. {
  763. format(szMiscArray, sizeof(szMiscArray), "(Pocket) %d fish.", PlayerInfo[giveplayerid][pFishes]);
  764. SendClientMessageEx(playerid, COLOR_GREY, szMiscArray);
  765. }
  766. SendClientMessageEx(playerid, COLOR_WHITE, "** Misc **");
  767. if(PlayerInfo[giveplayerid][pPhoneBook] > 0) SendClientMessageEx(playerid, COLOR_GREY, "Phone book.");
  768. if(PlayerInfo[giveplayerid][pCDPlayer] > 0) SendClientMessageEx(playerid, COLOR_GREY, "Music player.");
  769. new weaponname[50];
  770. SendClientMessageEx(playerid, COLOR_WHITE, "** Weapons **");
  771. for (new i = 0; i < 12; i++)
  772. {
  773. if(PlayerInfo[giveplayerid][pGuns][i] > 0)
  774. {
  775. GetWeaponName(PlayerInfo[giveplayerid][pGuns][i], weaponname, sizeof(weaponname));
  776. format(szMiscArray, sizeof(szMiscArray), "Weapon: %s.", weaponname);
  777. SendClientMessageEx(playerid, COLOR_GRAD1, szMiscArray);
  778. }
  779. }
  780. SendClientMessageEx(playerid, COLOR_GREEN, "_______________________________________");
  781. format(szMiscArray, sizeof(szMiscArray), "* %s has frisked %s for any illegal items.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
  782. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  783. return 1;
  784. }
  785. Interact_DragPlayer(playerid, giveplayerid) {
  786. if(GetPVarInt(giveplayerid, "PlayerCuffed") != 2) return SendClientMessageEx(playerid, COLOR_WHITE, " The specified person is not cuffed !");
  787. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, " You must be out of the vehicle to use this command.");
  788. if(GetPVarInt(giveplayerid, "BeingDragged") == 1) return SendClientMessageEx(playerid, COLOR_WHITE, " That person is already being dragged. ");
  789. new
  790. Float:TempPos[3];
  791. GetPlayerPos(giveplayerid, TempPos[0], TempPos[1], TempPos[2]);
  792. if(!IsPlayerInRangeOfPoint(playerid, 5.0, TempPos[0], TempPos[1], TempPos[2])) return SendClientMessageEx(playerid, COLOR_GRAD2, " That suspect is not near you.");
  793. format(szMiscArray, sizeof(szMiscArray), "* %s is now dragging you.", GetPlayerNameEx(playerid));
  794. SendClientMessageEx(giveplayerid, COLOR_WHITE, szMiscArray);
  795. format(szMiscArray, sizeof(szMiscArray), "* You are now dragging %s, you may move them now.", GetPlayerNameEx(giveplayerid));
  796. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  797. format(szMiscArray, sizeof(szMiscArray), "* %s grabs ahold of %s and begins to move them.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  798. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  799. SendClientMessageEx(playerid, COLOR_WHITE, "You are now dragging the suspect, press the '{AA3333}FIRE{FFFFFF}' button to stop.");
  800. SetPVarInt(giveplayerid, "BeingDragged", 1);
  801. SetPVarInt(playerid, "DraggingPlayer", giveplayerid);
  802. SetTimerEx("DragPlayer", 1000, 0, "ii", playerid, giveplayerid);
  803. return 1;
  804. }
  805. Interact_DetainPlayer(playerid, giveplayerid, seatid = -1) {
  806. if(seatid == -1) {
  807. format(szMiscArray, sizeof(szMiscArray), "Please enter a seat id (1-3) to detain %s into.", GetPlayerNameEx(giveplayerid));
  808. return ShowPlayerDialogEx(playerid, DETAIN_SEAT, DIALOG_STYLE_INPUT, "Detain Player", szMiscArray, "Detain", "");
  809. }
  810. else {
  811. if(IsPlayerInAnyVehicle(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That person is in a car - get them out first.");
  812. if (!ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You are not in range of that player!");
  813. if(PlayerCuffed[giveplayerid] != 2) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not cuffed");
  814. new carid = gLastCar[playerid];
  815. if(!IsSeatAvailable(carid, seatid)) {
  816. SendClientMessageEx(playerid, COLOR_GREY, "That seatid is taken!");
  817. return Interact_DetainPlayer(playerid, giveplayerid);
  818. }
  819. new Float:pos[6];
  820. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  821. GetPlayerPos(giveplayerid, pos[3], pos[4], pos[5]);
  822. GetVehiclePos( carid, pos[0], pos[1], pos[2]);
  823. if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
  824. floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
  825. floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
  826. format(szMiscArray, sizeof(szMiscArray), "* You were detained by %s .", GetPlayerNameEx(playerid));
  827. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMiscArray);
  828. format(szMiscArray, sizeof(szMiscArray), "* You detained %s.", GetPlayerNameEx(giveplayerid));
  829. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMiscArray);
  830. format(szMiscArray, sizeof(szMiscArray), "* %s throws %s in the vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  831. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  832. GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
  833. ClearAnimationsEx(giveplayerid);
  834. TogglePlayerControllable(giveplayerid, false);
  835. IsPlayerEntering{giveplayerid} = true;
  836. PutPlayerInVehicle(giveplayerid, carid, seatid);
  837. }
  838. return 1;
  839. }
  840. Interact_GiveTicket(playerid, giveplayerid, reason[], amount = -1) {
  841. if(amount == -1) {
  842. format(szMiscArray, sizeof(szMiscArray), "Please enter an amount to fine %s", GetPlayerNameEx(giveplayerid));
  843. return ShowPlayerDialogEx(playerid, GIVE_TICKET, DIALOG_STYLE_INPUT, "Ticket Player", szMiscArray, "Next", "");
  844. }
  845. if(isnull(reason)) {
  846. format(szMiscArray, sizeof(szMiscArray), "Please enter a fine reason for %s", GetPlayerNameEx(giveplayerid));
  847. return ShowPlayerDialogEx(playerid, TICKET_REASON, DIALOG_STYLE_INPUT, "Ticket Player", szMiscArray, "Issue", "");
  848. }
  849. else {
  850. if(!ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in range of that player");
  851. format(szMiscArray, sizeof(szMiscArray), "* You gave %s a ticket costing $%d, reason: %s", GetPlayerNameEx(giveplayerid), amount, reason);
  852. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMiscArray);
  853. format(szMiscArray, sizeof(szMiscArray), "* Officer %s has given you a ticket costing $%d, reason: %s", GetPlayerNameEx(playerid), amount, reason);
  854. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMiscArray);
  855. format(szMiscArray, sizeof(szMiscArray), "* Officer %s writes up a ticket and gives it to %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  856. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  857. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, "* Type /accept ticket, to accept it.");
  858. TicketOffer[giveplayerid] = playerid;
  859. TicketMoney[giveplayerid] = amount;
  860. }
  861. return 1;
  862. }
  863. Interact_LoadPatient(playerid, giveplayerid, seatid = -1) {
  864. if(seatid == -1) {
  865. format(szMiscArray, sizeof(szMiscArray), "Please enter a seat id (1-3) to load %s into.", GetPlayerNameEx(giveplayerid));
  866. return ShowPlayerDialogEx(playerid, PATIENT_SEAT, DIALOG_STYLE_INPUT, "Load Patient", szMiscArray, "Load", "");
  867. }
  868. else {
  869. if(GetPVarInt(giveplayerid, "Injured") != 1) return SendClientMessageEx(playerid, COLOR_GREY, "That patient not injured - you can't load them.");
  870. if(IsPlayerInAnyVehicle(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That patient is inside a car - you can't load them.");
  871. if (!ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You are not near that player.");
  872. new carid = gLastCar[playerid];
  873. if(!IsAnAmbulance(carid)) return SendClientMessageEx(playerid, COLOR_GREY, "Your last vehicle was not an ambulance.");
  874. if(IsVehicleOccupied(carid, seatid)) return SendClientMessageEx(playerid, COLOR_GREY, "That seat is occupied.");
  875. if(!IsPlayerInRangeOfVehicle(giveplayerid, carid, 10.0) || !IsPlayerInRangeOfVehicle(playerid, carid, 10.0)) return SendClientMessageEx(playerid, COLOR_GREY, "Both you and your patient must be near the ambulance.");
  876. format(szMiscArray, sizeof(szMiscArray), "* You were loaded by paramedic %s.", GetPlayerNameEx(playerid));
  877. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMiscArray);
  878. format(szMiscArray, sizeof(szMiscArray), "* You loaded patient %s.", GetPlayerNameEx(giveplayerid));
  879. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMiscArray);
  880. format(szMiscArray, sizeof(szMiscArray), "* %s loads %s in the %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), GetVehicleName(carid));
  881. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  882. SetPVarInt(giveplayerid, "EMSAttempt", 3);
  883. ClearAnimationsEx(giveplayerid);
  884. IsPlayerEntering{giveplayerid} = true;
  885. PutPlayerInVehicle(giveplayerid,carid,seatid);
  886. TogglePlayerControllable(giveplayerid, false);
  887. }
  888. return 1;
  889. }
  890. Interact_Triage(playerid, giveplayerid) {
  891. if(PlayerInfo[playerid][pTriageTime] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You must wait for 2 minutes to use this command.");
  892. if(!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "That player is not connected.");
  893. if(!ProxDetectorS(5.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "That player isn't near you!");
  894. new Float: health;
  895. GetHealth(giveplayerid, health);
  896. if(health >= 85) SetHealth(giveplayerid, 100);
  897. else SetHealth(giveplayerid, health+15.0);
  898. format(szMiscArray, sizeof(szMiscArray), "* %s has given %s 15 health.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  899. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  900. PlayerInfo[playerid][pTriageTime] = 120;
  901. return 1;
  902. }
  903. Interact_Heal(playerid, giveplayerid, healprice = -1) {
  904. if(healprice == -1) {
  905. format(szMiscArray, sizeof(szMiscArray), "Please enter a price that you wish to heal %d for.", GetPlayerNameEx(giveplayerid));
  906. return ShowPlayerDialogEx(playerid, HEAL_PLAYER, DIALOG_STYLE_INPUT, "Heal Player", szMiscArray, "Heal", "");
  907. }
  908. else {
  909. new Float:X, Float:Y, Float:Z;
  910. GetPlayerPos(giveplayerid, X, Y, Z);
  911. if(!IsPlayerInRangeOfPoint(playerid, 10, X, Y, Z)) return SendClientMessageEx(playerid, TEAM_GREEN_COLOR,"You are not near them!");
  912. new Float:tempheal;
  913. GetHealth(giveplayerid,tempheal);
  914. if(tempheal >= 100.0) return SendClientMessageEx(playerid, TEAM_GREEN_COLOR,"That person is fully healed.");
  915. format(szMiscArray, sizeof(szMiscArray), "You healed %s for $%d.", GetPlayerNameEx(giveplayerid),healprice);
  916. SendClientMessageEx(playerid, COLOR_PINK, szMiscArray);
  917. GivePlayerCash(playerid, healprice / 2);
  918. //Tax += healprice / 2;
  919. GivePlayerCash(giveplayerid, -healprice);
  920. SetHealth(giveplayerid, 100);
  921. PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
  922. PlayerPlaySound(giveplayerid, 1150, 0.0, 0.0, 0.0);
  923. format(szMiscArray, sizeof(szMiscArray), "You have been healed to 100 health for $%d by %s.",healprice, GetPlayerNameEx(playerid));
  924. SendClientMessageEx(giveplayerid, TEAM_GREEN_COLOR,szMiscArray);
  925. if(GetPVarType(giveplayerid, "STD")){
  926. DeletePVar(giveplayerid, "STD");
  927. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, "* You are no longer infected with a STD because of the medic's help.");
  928. }
  929. }
  930. return 1;
  931. }
  932. Interact_MovePatient(playerid, giveplayerid) {
  933. if(GetPVarInt(giveplayerid,"Injured") != 1) return SendClientMessageEx(playerid, COLOR_WHITE, "That player is not injured");
  934. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command while in a vehicle.");
  935. if(PlayerInfo[giveplayerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command on jailed players.");
  936. if(GetPVarInt(giveplayerid, "OnStretcher") == 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "The person is already on a stretcher, you can't do this right now!");
  937. new Float:mX, Float:mY, Float:mZ;
  938. GetPlayerPos(giveplayerid, mX, mY, mZ);
  939. if(!IsPlayerInRangeOfPoint(playerid, 5.0, mX, mY, mZ)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You have to be close to the patient to be able to move them!");
  940. SendClientMessageEx(playerid, COLOR_GRAD2, "You have 30 seconds to move to another location or you can either press the '{AA3333}FIRE{BFC0C2}' button.");
  941. format(szMiscArray, sizeof(szMiscArray), "* You have been put on a stretcher by %s.", GetPlayerNameEx(playerid));
  942. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, szMiscArray);
  943. format(szMiscArray, sizeof(szMiscArray), "* You have put %s on a stretcher, you may move them now.", GetPlayerNameEx(giveplayerid));
  944. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMiscArray);
  945. format(szMiscArray, sizeof(szMiscArray), "* %s puts %s on a stretcher, tightening the belts securely.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  946. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  947. SetPVarInt(giveplayerid, "OnStretcher", 1);
  948. SetPVarInt(playerid, "TickEMSMove", SetTimerEx("MoveEMS", 30000, false, "d", playerid));
  949. SetPVarInt(playerid, "MovingStretcher", giveplayerid);
  950. return 1;
  951. }
  952. Interact_Prescribe(playerid, stage = 0) {
  953. switch(stage) {
  954. case 0: {
  955. ShowPlayerDialogEx(playerid, DIALOG_STYLE_LIST, INTERACT_PRESCRIBE, "Type | Drug Prescription", "Demerol\n\
  956. Morphine\n\
  957. Haloperidol\n\
  958. Aspirin",
  959. "Select", "Cancel");
  960. }
  961. case 1: {
  962. ShowPlayerDialogEx(playerid, DIALOG_STYLE_INPUT, INTERACT_PRESCRIBE1, "Grams | Drug Prescription", "How many pieces would you like to prescribe?", "Prescribe", "Cancel");
  963. }
  964. }
  965. return 1;
  966. }
  967. Interact_ProcessPrescription(playerid) {
  968. new giveplayerid = GetPVarInt(playerid, "Interact_Target"),
  969. iAmount = GetPVarInt(playerid, "DR_PAM");
  970. GetPVarString(playerid, "DR_PTYPE", szMiscArray, sizeof(szMiscArray));
  971. new iDrugID = GetDrugID(szMiscArray);
  972. if(iAmount + PlayerInfo[giveplayerid][pDrugs][iDrugID] > Player_MaxCapacity(giveplayerid, ITEM_DRUG)) {
  973. format(szMiscArray, sizeof(szMiscArray), "That player can only hold %d more of that item.", Player_LeftCapacity(giveplayerid, ITEM_DRUG));
  974. SendClientMessageEx(playerid, COLOR_GRAD2, szMiscArray);
  975. return Player_InteractMenu(playerid, giveplayerid);
  976. }
  977. if(PlayerInfo[playerid][pDrugs][iDrugID] < iAmount) return SendClientMessage(playerid, COLOR_GRAD1, "You do not have enough of that on you.");
  978. format(szMiscArray, sizeof(szMiscArray), "You have prescribed %s %d pc of %s.", GetPlayerNameEx(giveplayerid), iAmount, szMiscArray);
  979. SendClientMessage(playerid, COLOR_GRAD2, szMiscArray);
  980. format(szMiscArray, sizeof(szMiscArray), "%s has prescribed you %d pc of %s.", GetPlayerNameEx(playerid), iAmount, szMiscArray);
  981. SendClientMessage(giveplayerid, COLOR_GRAD2, szMiscArray);
  982. PlayerInfo[playerid][pDrugs][iDrugID] += iAmount;
  983. return 1;
  984. }
  985. /*
  986. Concept is to introduce the ability to pickup items that have been dropped and have a player add it to their inventory.
  987. Also to centralize all posessions into a single dialog.
  988. */
  989. /*Player_InventoryMenu(playerid) {
  990. return 1;
  991. }
  992. Player_InventoryAction(playerid) {
  993. return 1;
  994. }
  995. Player_DropItem(playerid) {
  996. return 1;
  997. }*/
  998. CMD:interact(playerid, params[]) {
  999. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /interact [playerid]");
  1000. new giveplayerid = strval(params);
  1001. if(playerid == giveplayerid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot interact with yourself.");
  1002. if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_GREY, "This player isn't online.");
  1003. if(GetPVarInt(playerid, "Injured") == 1) return 1;
  1004. if(!ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not near you.");
  1005. if(PlayerInfo[giveplayerid][pAdmin] >= 2 && !PlayerInfo[giveplayerid][pTogReports]) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not near you.");
  1006. Player_InteractMenu(playerid, giveplayerid);
  1007. return 1;
  1008. }