Advertisement
Guest User

....

a guest
Jul 28th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.21 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fun>
  3. #include <cstrike>
  4. #include <colorchat>
  5. #include <hamsandwich>
  6. #include <fakemeta>
  7.  
  8. #define SLOT_PRIMARY 1
  9. #define SLOT_SECONDARY 2
  10.  
  11.  
  12. enum _:WeaponInfo
  13. {
  14. slot,
  15. ammo
  16. }
  17.  
  18. new g_Weapons[][WeaponInfo] =
  19. {
  20. {0, 0}, // ------
  21. {2, 52}, //CSW_P228
  22. {0, 0}, // ------
  23. {1, 90}, //CSW_SCOUT
  24. {4, 1}, //CSW_HEGRENADE
  25. {1, 32}, //CSW_XM1014
  26. {5, 1}, //CSW_C4
  27. {1, 100}, //CSW_MAC10
  28. {1, 90}, //CSW_AUG
  29. {4, 1}, //CSW_SMOKEGRENADE
  30. {2, 120}, //CSW_ELITE
  31. {2, 100}, //CSW_FIVESEVEN
  32. {1, 100}, //CSW_UMP45
  33. {1, 90}, //CSW_SG550
  34. {1, 90}, //CSW_GALIL
  35. {1, 90}, //CSW_FAMAS
  36. {2, 100}, //CSW_USP
  37. {2, 120}, //CSW_GLOCK18
  38. {1, 30}, //CSW_AWP
  39. {1, 120}, //CSW_MP5NAVY
  40. {1, 200}, //CSW_M249
  41. {1, 32}, //CSW_M3
  42. {1, 90}, //CSW_M4A1
  43. {1, 120}, //CSW_TMP
  44. {1, 90}, //CSW_G3SG1
  45. {4, 2}, //CSW_FLASHBANG
  46. {2, 35}, //CSW_DEAGLE
  47. {1, 90}, //CSW_SG552
  48. {1, 90}, //CSW_AK47
  49. {3, 0}, //CSW_KNIFE
  50. {1, 100} //CSW_P90
  51. };
  52.  
  53. #define PLUGIN "Shop Bonus"
  54. #define VERSION "1.0"
  55. #define AUTHOR "lol"
  56.  
  57. #define HEALTH 50
  58. #define SPEED 300.0
  59.  
  60. new Float:normal_speed = 240.0
  61. new bool:hasSpeed[33]
  62. new bool:g_bHasCF[33]
  63. new bool:g_hasulti[33]
  64. new bool:g_hasNorc[33]
  65.  
  66. new const Prefix[] = "[Shop_bonus]"
  67.  
  68. #define MODEL_T "gsg9"
  69. #define MODEL_CT "leet"
  70. #define MODEL_T_END "leet"
  71. #define MODEL_CT_END "gsg9"
  72.  
  73. new const Items[][]=
  74. {
  75. "Health",
  76. "10 Extra Frag",
  77. "Speed",
  78. "Gravity",
  79. "Camouflage-[change skin model]",
  80. "Invisibility",
  81. "Unlimited Ammo For All Weapons",
  82. "No Recoil"
  83. }
  84.  
  85. public plugin_init() {
  86. register_plugin(PLUGIN, VERSION, AUTHOR)
  87.  
  88. register_event("DeathMsg", "Death", "a")
  89. register_event("CurWeapon", "Weapon", "be", "1=1")
  90.  
  91. RegisterHam(Ham_Spawn, "player", "Spawn", 1)
  92.  
  93. register_clcmd("say /shop", "cmdTest")
  94.  
  95. register_event("CurWeapon", "onCurWeaponEvent", "be", "1=1")
  96.  
  97. register_forward(FM_PlayerPreThink,"func_prethink");
  98. }
  99.  
  100. public Spawn(id)
  101. {
  102. if(!is_user_alive(id))
  103. return PLUGIN_HANDLED
  104. hasSpeed[id] = false
  105. g_bHasCF[id] = false
  106. g_hasulti[id] = false
  107. g_hasNorc[id] = false
  108. set_user_rendering(id)
  109.  
  110. return PLUGIN_CONTINUE
  111. }
  112.  
  113. public cmdTest(id)
  114. {
  115. if(is_user_alive(id))
  116. {
  117. MenuDisplay(id)
  118. }
  119. else
  120. {
  121. ColorChat(id,GREY,"^4]-=[T[S]K]=-[ ^1For use shop, ^4you need to alive!!")
  122. }
  123. }
  124.  
  125.  
  126. public MenuDisplay(id)
  127. {
  128. if(!is_user_alive(id))
  129. {
  130. remove_task(id)
  131. return PLUGIN_HANDLED
  132. }
  133. new Title[64]
  134. formatex(Title, charsmax(Title), "Shop XP Menu")
  135.  
  136. new menu = menu_create(Title, "HandlerMenu")
  137.  
  138. for(new i = 0; i < sizeof Items; i++)
  139. menu_additem(menu, Items[i], "", 0)
  140.  
  141. menu_display(id, menu, 0)
  142. set_task(10.0, "CancelMenu", id)
  143.  
  144. return PLUGIN_CONTINUE
  145. }
  146.  
  147. public HandlerMenu(id, menu, item)
  148. {
  149. if(item == MENU_EXIT)
  150. {
  151. menu_destroy(menu)
  152. return PLUGIN_HANDLED
  153. }
  154.  
  155. switch(item)
  156. {
  157. case 0:
  158. {
  159. set_user_health(id, get_user_health(id) + HEALTH)
  160. }
  161. case 1:
  162. {
  163. set_user_frags( id, get_user_frags(id) + 10 );
  164. }
  165. case 2:
  166. {
  167. set_user_maxspeed(id, SPEED)
  168. hasSpeed[id] = true
  169. set_task(10.0, "remove_speed", id)
  170. }
  171. case 3:
  172. {
  173. set_user_gravity(id, 0.7)
  174. }
  175. case 4:
  176. {
  177. g_bHasCF[id] = true
  178. cs_set_user_model(id, cs_get_user_team(id) == CS_TEAM_T ? MODEL_T : MODEL_CT)
  179. set_task(20.0, "func_RemoveCF", id)
  180. }
  181. case 5:
  182. {
  183. set_user_rendering( id, kRenderFxNone, 0,0,0, kRenderTransAdd, 50);
  184. set_task(10.0, "remove_invis", id)
  185. }
  186. case 6:
  187. {
  188. g_hasulti[id] = true
  189. }
  190. case 7:
  191. {
  192. g_hasNorc[id] = true
  193. }
  194. }
  195. ColorChat(id, GREEN, "^4%s^1 You got bonus ^3%s^1 for used shop!!", Prefix, Items[item])
  196. menu_destroy(menu)
  197. return PLUGIN_CONTINUE
  198. }
  199.  
  200. public CancelMenu(id)
  201. if(is_user_connected(id))
  202. client_cmd(id, "slot1")
  203.  
  204. public Weapon(id)
  205. if(is_user_alive(id) && hasSpeed[id])
  206. set_user_maxspeed(id, SPEED)
  207.  
  208. public remove_invis(id)
  209. {
  210. if(!is_user_alive(id))
  211. return PLUGIN_HANDLED
  212.  
  213. set_user_rendering(id)
  214. ColorChat(id, GREEN, "%s^1 Your ^3%s^1 has been removed^4!", Prefix, Items[5])
  215.  
  216. return PLUGIN_CONTINUE
  217. }
  218.  
  219. public remove_speed(id)
  220. {
  221. if(!is_user_alive(id))
  222. return PLUGIN_HANDLED
  223.  
  224. set_user_maxspeed(id, normal_speed)
  225. hasSpeed[id] = false
  226. ColorChat(id, GREEN, "%s^1 Your ^3%s^1 has been removed^4!", Prefix, Items[2])
  227.  
  228. return PLUGIN_CONTINUE
  229. }
  230.  
  231. public func_RemoveCF(id)
  232. {
  233. if(!is_user_alive(id))
  234. return PLUGIN_HANDLED
  235. cs_set_user_model(id, cs_get_user_team(id) == CS_TEAM_T ? MODEL_T_END : MODEL_CT_END)
  236. g_bHasCF[id] = false
  237. ColorChat(id, GREEN, "%s^1 Your ^3%s^1 has been removed^4!", Prefix, Items[5])
  238. return PLUGIN_CONTINUE
  239. }
  240. public func_prethink(id)
  241. {
  242. if(!is_user_alive(id) && !g_hasNorc[id])
  243. return;
  244.  
  245. set_pev(id,pev_punchangle,{ 0.0,0.0,0.0 });
  246. }
  247.  
  248. public onCurWeaponEvent(id)
  249. {
  250. if (!g_hasulti[id])
  251. return PLUGIN_HANDLED
  252.  
  253. new iWeapon = read_data(2)
  254.  
  255. if (g_Weapons[iWeapon][slot] == SLOT_PRIMARY || g_Weapons[iWeapon][slot] == SLOT_SECONDARY)
  256. if (cs_get_user_bpammo(id, iWeapon) < g_Weapons[iWeapon][ammo])
  257. cs_set_user_bpammo(id, iWeapon, g_Weapons[iWeapon][ammo])
  258.  
  259. return PLUGIN_CONTINUE
  260. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement