Guest User

WeaponShop

a guest
Jun 12th, 2011
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.45 KB | None | 0 0
  1. /**************************************************************
  2. * WeaponShop FS v.1.0 *
  3. * ^^ *
  4. * (o )o) (o )o) *
  5. * <-- | --> .: By Gertin :. <-- | --> *
  6. * / \ / \ *
  7. ***************************************************************/
  8.  
  9. //================================INCLUDES======================================
  10. #include <a_samp>
  11. #include <zcmd>
  12. #include <dudb>
  13. #include <sscanf2>
  14. //================================DEFINES=======================================
  15. #define RED 0xFF0000AA
  16. #pragma unused ret_memcpy
  17. //================================NEWS==========================================
  18. new Weaps;
  19. new bool:Shop;
  20. //================================COMMANDS======================================
  21. COMMAND:shop(playerid,params[])
  22. {
  23. if(Shop == true)
  24. {
  25. SendClientMessage(playerid,RED,"{33FF00}You've opened the shop.");
  26. ShowDialog(playerid, 9954);
  27. return 1;
  28. }
  29. if(Shop == false)
  30. {
  31. SendClientMessage(playerid,RED,"{33FF00}Shop is closed .");
  32. return 1;
  33. }
  34. return 0;
  35. }
  36. //==============================================================================
  37. COMMAND:ashop(playerid, params[])
  38. {
  39. if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,RED,"{FF0000}You need to be rcon admin !");
  40. ShowDialog(playerid, 9963);
  41. return 1;
  42. }
  43. //==============================PUBLICS=========================================
  44. public OnFilterScriptInit()
  45. {
  46. Shop = true;
  47. printf("===================================================");
  48. printf("Oh , you loaded me . I'm WeaponShop FilterScript ^^");
  49. printf("I'm Maked By Gertin !");
  50. printf("===================================================");
  51. return 1;
  52. }
  53. //==============================================================================
  54. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  55. {
  56. if(response)
  57. {
  58. if(dialogid == 9954)
  59. {
  60. if(listitem == 0)
  61. {
  62. new string[256];
  63. format(string, sizeof(string), "~w~Thanks ~b~For ~p~Using Shop ^^");
  64. GameTextForPlayer(playerid, string, 7500, 3);
  65. }
  66. if(listitem == 1)
  67. {
  68. ShowDialog(playerid,9955);
  69. }
  70. if(listitem == 2)
  71. {
  72. ShowDialog(playerid,9956);
  73. }
  74. if(listitem == 3)
  75. {
  76. ShowDialog(playerid,9957);
  77. }
  78. if(listitem == 4)
  79. {
  80. ShowDialog(playerid,9958);
  81. }
  82. if(listitem == 5)
  83. {
  84. ShowDialog(playerid,9959);
  85. }
  86. if(listitem == 6)
  87. {
  88. ShowDialog(playerid,9960);
  89. }
  90. if(listitem == 7)
  91. {
  92. ShowDialog(playerid,9961);
  93. }
  94. if(listitem == 8)
  95. {
  96. ShowDialog(playerid,9962);
  97. }
  98. }
  99. }
  100. if(dialogid == 9963)
  101. {
  102. new string[256];
  103. new ime[MAX_PLAYER_NAME];
  104. GetPlayerName(playerid, ime, sizeof(ime));
  105. if(response)
  106. {
  107. format(string, sizeof(string), "~r~[]Shop]~b~ is turned on by an admin:~y~ %s", ime);
  108. GameTextForAll(string,5000,3);
  109. Shop = true;
  110. }
  111. if(!response)
  112. {
  113. format(string, sizeof(string), "~r~[]Shop]~b~ is turned off by an admin:~y~ %s", ime);
  114. GameTextForAll(string,5000,3);
  115. Shop = false;
  116. }
  117. }
  118. if(response)
  119. {
  120. if(dialogid == 9955)
  121. {
  122. Weaps = strval(inputtext);
  123. if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
  124. if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
  125. if(GetPlayerMoney(playerid) <= Weaps*50) return SendClientMessage(playerid,RED,"You don´t have so much money!");
  126. GivePlayerMoney(playerid, -Weaps*50);
  127. GivePlayerWeapon(playerid, 34, Weaps);
  128. SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Sniper Rifle !");
  129. }
  130. }
  131. if(response)
  132. {
  133. if(dialogid == 9956)
  134. {
  135. Weaps = strval(inputtext);
  136. if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
  137. if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
  138. if(GetPlayerMoney(playerid) <= Weaps*10000) return SendClientMessage(playerid,RED,"You don´t have so much money!");
  139. GivePlayerMoney(playerid, -Weaps*10000);
  140. GivePlayerWeapon(playerid, 35, Weaps);
  141. SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Rocket Launcher !");
  142. }
  143. }
  144. if(response)
  145. {
  146. if(dialogid == 9957)
  147. {
  148. Weaps = strval(inputtext);
  149. if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
  150. if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
  151. if(GetPlayerMoney(playerid) <= Weaps*100) return SendClientMessage(playerid,RED,"You don´t have so much money!");
  152. GivePlayerMoney(playerid, -Weaps*100);
  153. GivePlayerWeapon(playerid, 18, Weaps);
  154. SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Molotov Cocktail !");
  155. }
  156. }
  157. if(response)
  158. {
  159. if(dialogid == 9958)
  160. {
  161. Weaps = strval(inputtext);
  162. if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
  163. if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
  164. if(GetPlayerMoney(playerid) <= Weaps*50) return SendClientMessage(playerid,RED,"You don´t have so much money!");
  165. GivePlayerMoney(playerid, -Weaps*50);
  166. GivePlayerWeapon(playerid, 27, Weaps);
  167. SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Combat Shotgun !");
  168. }
  169. }
  170. if(response)
  171. {
  172. if(dialogid == 9959)
  173. {
  174. Weaps = strval(inputtext);
  175. if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
  176. if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
  177. if(GetPlayerMoney(playerid) <= Weaps*50) return SendClientMessage(playerid,RED,"You don´t have so much money!");
  178. GivePlayerMoney(playerid, -Weaps*50);
  179. GivePlayerWeapon(playerid, 26, Weaps);
  180. SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Sawn-Off Shotgun !");
  181. }
  182. }
  183. if(response)
  184. {
  185. if(dialogid == 9960)
  186. {
  187. Weaps = strval(inputtext);
  188. if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
  189. if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
  190. if(GetPlayerMoney(playerid) <= Weaps*30) return SendClientMessage(playerid,RED,"You don´t have so much money!");
  191. GivePlayerMoney(playerid, - Weaps*30);
  192. GivePlayerWeapon(playerid, 24, Weaps);
  193. SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Desert Eagle !");
  194. }
  195. }
  196. if(response)
  197. {
  198. if(dialogid == 9961)
  199. {
  200. Weaps = strval(inputtext);
  201. if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
  202. if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
  203. if(GetPlayerMoney(playerid) <= Weaps*300) return SendClientMessage(playerid,RED,"You don´t have so much money!");
  204. GivePlayerMoney(playerid, -Weaps*300);
  205. GivePlayerWeapon(playerid, 16, Weaps);
  206. SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy Grenade !");
  207. }
  208. }
  209. if(response)
  210. {
  211. if(dialogid == 9962)
  212. {
  213. Weaps = strval(inputtext);
  214. if(Weaps > 250) return SendClientMessage(playerid, 0x0000D9AA, "{FF0000}Max Ammo is 250 .");
  215. if(!isNumeric(inputtext)) return SendClientMessage(playerid, 0x0000D9AA, "Only numbers");
  216. if(GetPlayerMoney(playerid) <= Weaps*10) return SendClientMessage(playerid,RED,"You don´t have so much money!");
  217. GivePlayerMoney(playerid, -Weaps*10);
  218. GivePlayerWeapon(playerid, 29, Weaps);
  219. SendClientMessage(playerid, RED, "{33FF00}Thanks to use shop !{FF9900} You have buy MP5 !");
  220. }
  221. }
  222. return 0;
  223. }
  224. //================================STOCKS========================================
  225. stock IsNumeric(string[])
  226. {
  227. for (new i = 0, j = strlen(string);
  228. i < j; i++)
  229. {
  230. if (string[i] > '9' || string[i] < '0')
  231. return 0;
  232. }
  233. return 1;
  234. }
  235. //==============================================================================
  236. stock ShowDialog(playerid, dialog)
  237. {
  238. switch(dialog)
  239. {
  240. case 9954: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_LIST,"{003399}S{00FF66}hop", "{6600CC}|<-------Weapons------>|\nSniper Rifle [Ammo Price: 50$ ]\nRocket Launcher [Ammo Price: 10.000$ ]\nMolotiv Coctails [Ammo Price: 100$ ]\nCombat Shotgun [Ammo Price: 50$ ]\nShawn-Off Shotgun [Ammo Price: 50$ ]\nDesert Eagle [Ammo Price: 30$ ]\nGranade [Ammo Price: 300$ ]\nMP5 [Ammo Price: 10$ ]","Next", "Cancel");
  241. case 9955: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Sniper Rifle","{00FF66}Type the ammo, what you want for sniper .\n 1 Ammo Price is 50$","Buy","Cancel");
  242. case 9956: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Rocket Launcher","{00FF66}Type the ammo, what you want for rocket launcher .\n 1 Ammo Price is 2000$","Buy","Cancel");
  243. case 9957: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Molotiv Coctails","{00FF66}Type the ammo, what you want for coctails .\n 1 Ammo Price is 100$","Buy","Cancel");
  244. case 9958: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Combat ShotGun","{00FF66}Type the ammo, what you want for shotgun .\n 1 Ammo Price is 50$","Buy","Cancel");
  245. case 9959: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Shawn-Off ShotGun","{00FF66}Type the ammo, what you want for shawn-off .\n 1 Ammo Price is 50$","Buy","Cancel");
  246. case 9960: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Desert Eagle","{00FF66}Type the ammo, what you want for eagle .\n 1 Ammo Price is 30$","Buy","Cancel");
  247. case 9961: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}Granades","{00FF66}Type the ammo, what you want for granades .\n 1 Ammo Price is 300$","Buy","Cancel");
  248. case 9962: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_INPUT,"{003399}MP5","{00FF66}Type the ammo, what you want for MP5 .\n 1 Ammo Price is 10$","Buy","Cancel");
  249. case 9963: ShowPlayerDialog(playerid, dialog, DIALOG_STYLE_MSGBOX, "{FF0000}Shop !","{FF6600}You wan't to {6600CC}open{33CC00}/{00FFFF}close{FF6600} shop ?","Open","Close");
  250. }
  251. return 0;
  252. }
  253. //====================[ BEST PART OF THAT FILTERSCRIPT ]========================
  254. //========================[ THEY CALLED IT THE END ! ]==========================
Advertisement
Add Comment
Please, Sign In to add comment