/* Plugin generated by AMXX-Studio */ /* * Changelog - 1.3: not in buytime buying fixed - 1.2: not in buyzone buying fixed - 1.1: force_pickup changed - thanks to slogic - 1.0: first release */ #include #include #include #include #define PLUGIN "AlMod's Grenades Limiter" #define VERSION "1.3" #define AUTHOR "AlMod" #define CSA_FLASHBANG 11 #define CSA_HEGRENADE 12 #define CSA_SMOKEGRENADE 13 new c_HE, c_FL, c_SM new g_CanBuy new Float:g_Serv_BuyTime = 0.0 public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("hegren","hook_he") register_clcmd("flash","hook_flash") register_clcmd("sgren","hook_smoke") register_logevent("on_start_round",2,"0=World triggered","1=Round_Start") } public plugin_precache() { c_HE = register_cvar("amx_he_limit","3") c_FL = register_cvar("amx_flash_limit","3") c_SM = register_cvar("amx_smoke_limit","3") register_message(get_user_msgid("WeaponList"),"hook_weaponlist") } public on_start_round() { g_Serv_BuyTime = get_cvar_float("mp_buytime")*60.0 g_CanBuy = true set_task(g_Serv_BuyTime,"buy_off",2567) client_print(0,print_chat,"%0.f",g_Serv_BuyTime) } public buy_off(tid) { g_CanBuy = false } public hook_weaponlist(msg_id, msg_dest, msg_entity) { new wpnid = get_msg_arg_int(8) switch (wpnid) { case CSW_HEGRENADE: set_msg_arg_int(3,1,get_pcvar_num(c_HE)) case CSW_FLASHBANG: set_msg_arg_int(3,1,get_pcvar_num(c_FL)) case CSW_SMOKEGRENADE: set_msg_arg_int(3,1,get_pcvar_num(c_SM)) } } public force_pick(id,ammoid) { message_begin(MSG_ONE,get_user_msgid("AmmoPickup"),_,id) write_byte(ammoid) write_byte(1) message_end() } public hook_he(id) { new ammo = cs_get_user_bpammo(id,CSW_HEGRENADE) new money = cs_get_user_money(id) if (cs_get_user_buyzone(id)) { if (ammo!=get_pcvar_num(c_HE)) { if (money>=300) { if (g_CanBuy) { give_item(id,"weapon_hegrenade") cs_set_user_money(id,money-300) if (ammo>=1) force_pick(id,CSA_HEGRENADE) cs_set_user_bpammo(id,CSW_HEGRENADE,ammo+1) emit_sound(id, CHAN_WEAPON , "items/9mmclip1.wav" , 1.0 , ATTN_NORM , 0 , PITCH_NORM) } else { client_print(id,print_center,"%0.f seconds have passed. You can't buy anything now!",g_Serv_BuyTime) } } else { client_print(id,print_center,"You have insufficient funds!") } } else { client_print(id,print_center,"You can't carry anymore!") } } return PLUGIN_HANDLED } public hook_flash(id) { new ammo = cs_get_user_bpammo(id,CSW_FLASHBANG) new money = cs_get_user_money(id) if (cs_get_user_buyzone(id)) { if (ammo!=get_pcvar_num(c_FL)) { if (money>=200) { if (g_CanBuy) { give_item(id,"weapon_flashbang") cs_set_user_money(id,money-200) if (ammo>=2) force_pick(id,CSA_FLASHBANG) cs_set_user_bpammo(id,CSW_FLASHBANG,ammo+1) emit_sound(id, CHAN_WEAPON , "items/9mmclip1.wav" , 1.0 , ATTN_NORM , 0 , PITCH_NORM) } else { client_print(id,print_center,"%0.f seconds have passed. You can't buy anything now!",g_Serv_BuyTime) } } else { client_print(id,print_center,"You have insufficient funds!") } } else { client_print(id,print_center,"You can't carry anymore!") } } return PLUGIN_HANDLED } public hook_smoke(id) { new ammo = cs_get_user_bpammo(id,CSW_SMOKEGRENADE) new money = cs_get_user_money(id) if (cs_get_user_buyzone(id)) { if (ammo!=get_pcvar_num(c_SM)) { if (money>=300) { if (g_CanBuy) { give_item(id,"weapon_smokegrenade") cs_set_user_money(id,money-300) if (ammo>=1) force_pick(id,CSA_SMOKEGRENADE) cs_set_user_bpammo(id,CSW_SMOKEGRENADE,ammo+1) emit_sound(id, CHAN_WEAPON , "items/9mmclip1.wav" , 1.0 , ATTN_NORM , 0 , PITCH_NORM) } else { client_print(id,print_center,"%0.f seconds have passed. You can't buy anything now!",g_Serv_BuyTime) } } else { client_print(id,print_center,"You have insufficient funds!") } } else { client_print(id,print_center,"You can't carry anymore!") } } return PLUGIN_HANDLED }