Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.75 KB | None | 0 0
  1. if (strcmp(cmd, "/buygun", true) == 0)
  2. {
  3. if(IsPlayerConnected(playerid))
  4. {
  5. if(GetPlayerMoney(playerid) < 1)
  6. {
  7. SendClientMessage(playerid, COLOR_GREY, " You dont have enough money with you !");
  8. return 1;
  9. }
  10. new gun;
  11. new gunid[16];
  12. new gunstring1[256];
  13. new gunstring2[256];
  14. new gunstring3[256];
  15. new gunstring4[256];
  16. new gunstring5[256];
  17. new infostring[256];
  18. new guncharge;
  19. new ammocharge;
  20. new location = PlayerInfo[playerid][pLocal];
  21. if(location == 99 || location == 100 || location == 102 || location == 104 || location == 105 || location == 108)
  22. {
  23. if(BizzInfo[location-99][bProducts] <= 0)
  24. {
  25. GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
  26. return 1;
  27. }
  28. new mod = 100;
  29. tmp = strtok(cmdtext, idx);
  30. if(!strlen(tmp))
  31. {
  32. format(string, sizeof(string), "USAGE: /buygun [gunname] [ammoamount]");
  33. SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
  34. SendClientMessage(playerid, COLOR_WHITE,"*** Guns & Ammo ***");
  35. SendClientMessage(playerid, COLOR_GRAD2,string);
  36. format(gunstring1, 256, "Weapons: parachute ($%d) golfclub ($%d) nightstick ($%d) baseballbat ($%d) shovel ($%d) poolcue ($%d)",
  37. GunPrice[0][0]/100*mod,GunPrice[1][0]/100*mod,GunPrice[2][0]/100*mod,GunPrice[3][0]/100*mod,GunPrice[4][0]/100*mod,GunPrice[5][0]/100*mod,GunPrice[6][0]/100*mod);
  38. SendClientMessage(playerid, COLOR_GRAD3, gunstring1);
  39. format(gunstring2, 256, "Weapons: purpledildo ($%d) whitedildo ($%d) longwhitedildo ($%d) whitedildo2 ($%d) flowers ($%d) cane($600)",
  40. GunPrice[7][0]/100*mod,GunPrice[8][0]/100*mod,GunPrice[9][0]/100*mod,GunPrice[10][0]/100*mod,GunPrice[11][0]/100*mod,GunPrice[12][0]/100*mod);
  41. SendClientMessage(playerid, COLOR_GRAD3, gunstring2);
  42. format(gunstring3, 256, "Weapons: sdpistol ($%d) deagle ($%d) mp5 ($%d)",
  43. GunPrice[13][0]/100*mod,GunPrice[14][0]/100*mod,GunPrice[15][0]/100*mod,GunPrice[16][0]/100*mod,GunPrice[17][0]/100*mod,GunPrice[18][0]/100*mod);
  44. SendClientMessage(playerid, COLOR_GRAD3, gunstring3);
  45. format(gunstring4, 256, "Weapons: shotgun ($%d) ak47 ($%d) m4 ($%d) rifle ($%d)",
  46. GunPrice[19][0]/100*mod,GunPrice[20][0]/100*mod,GunPrice[21][0]/100*mod,GunPrice[22][0]/100*mod,GunPrice[23][0]/100*mod,GunPrice[24][0]/100*mod);
  47. SendClientMessage(playerid, COLOR_GRAD3, gunstring4);
  48. format(gunstring5, 256, "Weapons: deagleammo ($1) shotgunammo ($1) m4ammo ($1) mp5ammo ($1) rifleammo ($1)");
  49. SendClientMessage(playerid, COLOR_GRAD3, gunstring5);
  50. SendClientMessage(playerid, COLOR_GRAD3, "Weapons: bomb ($150000)");
  51. SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
  52. return 1;
  53. }
  54. strmid(gunid, tmp, 0, strlen(cmdtext), 255);
  55. tmp = strtok(cmdtext, idx);
  56. if(!strlen(tmp))
  57. {
  58. format(string, sizeof(string), "USAGE: /buygun [gunname] [ammoamount]");
  59. return 1;
  60. }
  61. new ammo = strval(tmp);
  62. if(ammo < 1 || ammo > 999) { SendClientMessage(playerid, COLOR_GREY, " Ammo ammount not lower then 1 or higher then 999 !"); return 1; }
  63. if (strcmp(gunid, "parachute", true, strlen(gunid)) == 0)
  64. {
  65. gun = 46;
  66. guncharge = GunPrice[0][0]/100*mod;
  67. ammocharge = 0;
  68. }
  69. else if (strcmp(gunid, "golfclub", true, strlen(gunid)) == 0)
  70. {
  71. gun = 2; guncharge = GunPrice[1][0]/100*mod; ammocharge = 0;
  72. PlayerInfo[playerid][pGun1] = 2; PlayerInfo[playerid][pAmmo1] = 1;
  73. }
  74. else if (strcmp(gunid, "nightstick", true, strlen(gunid)) == 0)
  75. {
  76. gun = 3; guncharge = GunPrice[2][0]/100*mod; ammocharge = 0;
  77. PlayerInfo[playerid][pGun1] = 3; PlayerInfo[playerid][pAmmo1] = 1;
  78. }
  79. else if (strcmp(gunid, "baseballbat", true, strlen(gunid)) == 0)
  80. {
  81. gun = 5; guncharge = GunPrice[4][0]/100*mod; ammocharge = 0;
  82. PlayerInfo[playerid][pGun1] = 5; PlayerInfo[playerid][pAmmo1] = 1;
  83. }
  84. else if (strcmp(gunid, "shovel", true, strlen(gunid)) == 0)
  85. {
  86. gun = 6; guncharge = GunPrice[5][0]/100*mod; ammocharge = 0;
  87. PlayerInfo[playerid][pGun1] = 6; PlayerInfo[playerid][pAmmo1] = 1;
  88. }
  89. else if (strcmp(gunid, "poolcue", true, strlen(gunid)) == 0)
  90. {
  91. gun = 7; guncharge = GunPrice[6][0]/100*mod; ammocharge = 0;
  92. PlayerInfo[playerid][pGun1] = 7; PlayerInfo[playerid][pAmmo1] = 1;
  93. }
  94. else if (strcmp(gunid, "purpledildo", true, strlen(gunid)) == 0)
  95. {
  96. gun = 10; guncharge = GunPrice[7][0]/100*mod; ammocharge = 0;
  97. PlayerInfo[playerid][pGun1] = 10; PlayerInfo[playerid][pAmmo1] = 1;
  98. }
  99. else if (strcmp(gunid, "whitedildo", true, strlen(gunid)) == 0)
  100. {
  101. gun = 11; guncharge = GunPrice[8][0]/100*mod; ammocharge = 0;
  102. PlayerInfo[playerid][pGun1] = 11; PlayerInfo[playerid][pAmmo1] = 1;
  103. }
  104. else if (strcmp(gunid, "longwhitedildo", true, strlen(gunid)) == 0)
  105. {
  106. gun = 12; guncharge = GunPrice[9][0]/100*mod; ammocharge = 0;
  107. PlayerInfo[playerid][pGun1] = 12; PlayerInfo[playerid][pAmmo1] = 1;
  108. }
  109. else if (strcmp(gunid, "whitedildo2", true, strlen(gunid)) == 0)
  110. {
  111. gun = 13; guncharge = GunPrice[10][0]/100*mod; ammocharge = 0;
  112. PlayerInfo[playerid][pGun1] = 13; PlayerInfo[playerid][pAmmo1] = 1;
  113. }
  114. else if (strcmp(gunid, "flowers", true, strlen(gunid)) == 0)
  115. {
  116. gun = 14; guncharge = GunPrice[11][0]/100*mod; ammocharge = 0;
  117. PlayerInfo[playerid][pGun1] = 14; PlayerInfo[playerid][pAmmo1] = 1;
  118. }
  119. else if (strcmp(gunid, "cane", true, strlen(gunid)) == 0)
  120. {
  121. gun = 15; guncharge = GunPrice[12][0]/100*mod; ammocharge = 0;
  122. PlayerInfo[playerid][pGun1] = 15; PlayerInfo[playerid][pAmmo1] = 1;
  123. }
  124. else if (strcmp(gunid, "sdpistol", true, strlen(gunid)) == 0)
  125. {
  126. gun = 23; guncharge = GunPrice[13][0]/100*mod; ammocharge = GunPrice[25][0]*ammo;
  127. PlayerInfo[playerid][pGun2] = 23; PlayerInfo[playerid][pAmmo2] = ammo;
  128. }
  129. else if (strcmp(gunid, "deagle", true, strlen(gunid)) == 0)
  130. {
  131. gun = 24; guncharge = GunPrice[15][0]/100*mod; ammocharge = GunPrice[25][0]*ammo;
  132. PlayerInfo[playerid][pGun2] = 24; PlayerInfo[playerid][pAmmo2] = ammo;
  133. }
  134. else if (strcmp(gunid, "mp5", true, strlen(gunid)) == 0)
  135. {
  136. gun = 29; guncharge = GunPrice[18][0]/100*mod; ammocharge = GunPrice[27][0]*ammo;
  137. PlayerInfo[playerid][pGun3] = 29; PlayerInfo[playerid][pAmmo3] = ammo;
  138. }
  139. else if (strcmp(gunid, "shotgun", true, strlen(gunid)) == 0)
  140. {
  141. gun = 25; guncharge = GunPrice[19][0]/100*mod; ammocharge = GunPrice[26][0]*ammo;
  142. PlayerInfo[playerid][pGun3] = 25; PlayerInfo[playerid][pAmmo3] = ammo;
  143. }
  144. else if (strcmp(gunid, "ak47", true, strlen(gunid)) == 0)
  145. {
  146. gun = 30; guncharge = GunPrice[22][0]/100*mod; ammocharge = GunPrice[28][0]*ammo;
  147. PlayerInfo[playerid][pGun4] = 30; PlayerInfo[playerid][pAmmo4] = ammo;
  148. }
  149. else if (strcmp(gunid, "m4", true, strlen(gunid)) == 0)
  150. {
  151. gun = 31; guncharge = GunPrice[23][0]/100*mod; ammocharge = GunPrice[28][0]*ammo;
  152. PlayerInfo[playerid][pGun4] = 31; PlayerInfo[playerid][pAmmo4] = ammo;
  153. }
  154. else if (strcmp(gunid, "rifle", true, strlen(gunid)) == 0)
  155. {
  156. gun = 33; guncharge = GunPrice[24][0]/100*mod; ammocharge = GunPrice[29][0]*ammo;
  157. PlayerInfo[playerid][pGun4] = 33; PlayerInfo[playerid][pAmmo4] = ammo;
  158. }
  159. else if (strcmp(gunid, "deagleammo", true, strlen(gunid)) == 0)
  160. {
  161. if(PlayerInfo[playerid][pGun4] != 24) {}
  162. else
  163. {
  164. SCM(playerid,COLOR_GREY," You need a deagle"," Tu nao tens uma deagle!");
  165. }
  166. PlayerInfo[playerid][pAmmo2] = ammo;
  167. }
  168. else if (strcmp(gunid, "shotgunammo", true, strlen(gunid)) == 0)
  169. {
  170. if(PlayerInfo[playerid][pGun4] != 25) {}
  171. else
  172. {
  173. SCM(playerid,COLOR_GREY," You need a shotgun"," Tu nao tens uma shotgun!");
  174. }
  175. PlayerInfo[playerid][pAmmo3] = ammo;
  176. }
  177. else if (strcmp(gunid, "m4ammo", true, strlen(gunid)) == 0)
  178. {
  179. if(PlayerInfo[playerid][pGun4] != 31) {}
  180. else
  181. {
  182. SCM(playerid,COLOR_GREY," You need a M4"," Tu nao tens uma M4!");
  183. }
  184. PlayerInfo[playerid][pAmmo4] = ammo;
  185. }
  186. else if (strcmp(gunid, "mp5ammo", true, strlen(gunid)) == 0)
  187. {
  188. if(PlayerInfo[playerid][pGun4] != 29) {}
  189. else
  190. {
  191. SCM(playerid,COLOR_GREY," You need a MP5"," Tu nao tens uma MP5!");
  192. }
  193. PlayerInfo[playerid][pAmmo3] = ammo;
  194. }
  195. else if (strcmp(gunid, "rifleammo", true, strlen(gunid)) == 0)
  196. {
  197. if(PlayerInfo[playerid][pGun4] != 33) {}
  198. else
  199. {
  200. SCM(playerid,COLOR_GREY," You need a Rifle"," Tu nao tens uma Rifle!");
  201. }
  202. PlayerInfo[playerid][pAmmo4] = ammo;
  203. }
  204. else if (strcmp(gunid, "bomb", true, strlen(gunid)) == 0)
  205. {
  206. if(IsACop)
  207. {
  208. return 1;
  209. }
  210. ammocharge = 75000;
  211. guncharge = 75000;
  212. gun = 999;
  213. }
  214. else
  215. {
  216. SendClientMessage(playerid, COLOR_GRAD6, "ShopKeeper says: I have never heard of that weapon.");
  217. return 1;
  218. }
  219. if((guncharge+ammocharge) > GetPlayerMoney(playerid))
  220. {
  221. format(infostring, 256, " You don't have $%d !",guncharge+ammocharge);
  222. SendClientMessage(playerid, COLOR_GRAD3, infostring);
  223. return 1;
  224. }
  225. if(GetPlayerMoney(playerid) < (guncharge+ammocharge))
  226. {
  227. SendClientMessage(playerid, COLOR_GREY, " Can't afford that !");
  228. return 1;
  229. }
  230. if(gun == 999)
  231. {
  232. ammo = 1;
  233. }
  234. new payout = guncharge + ammocharge;
  235. format(infostring, 256, "You have purchased %s with %d ammo for $%d",gunid,ammo,payout);
  236. SendClientMessage(playerid, COLOR_GRAD3, infostring);
  237. if(location == 102 && IsACop(playerid)) { }
  238. else if(location == 104 && IsACop(playerid)) { }
  239. else if(location == 105 && IsACop(playerid)) { }
  240. else { GivePlayerMoney(playerid, - payout); }
  241. if(gun != 999) { BizzInfo[location-99][bTill] += payout; ExtortionBiz(location-99, payout); }
  242. else { BizzInfo[location-99][bTill] += 15000; ExtortionBiz(location-99, 15000); }
  243. BizzInfo[location-99][bProducts]-=2;
  244. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  245. if(gun != 999) { GivePlayerWeapon(playerid, gun, ammo); }
  246. else { PlayerInfo[playerid][pBomb] += ammo; }
  247. if(IsACop(playerid) && OnDuty[playerid] < 1) { PlayerInfo[playerid][pBomb] = 0; }
  248. GetPlayerName(playerid, sendername, sizeof(sendername));
  249. format(string, sizeof(string), "%s bought weapons for $%d at biz %d", sendername, payout, location-99);
  250. printf("%s", string);
  251. PayLog(string);
  252. }
  253. else
  254. {
  255. SendClientMessage(playerid, COLOR_WHITE,"You are not in a store.");
  256. return 1;
  257. }
  258. }
  259. return 1;
  260. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement