Quote:
Originally Posted by Tote
if (find_ent_by_class(-1, "func_bomb_target") != 0 || find_ent_by_class(-1, "info_bomb_target") != 0)
u dont need to do this when u have already put a check of "if player is not ct then return" cuz it will only work on ct
|
this code : "if (find_ent_by_class(-1, "func_bomb_target") != 0 || find_ent_by_class(-1, "info_bomb_target") != 0)" prevents to call "ham_spawn_post" function in other prefixed maps (cs_, zm_, ze_ , etc.)
for seeing defuser icon, you can change codes to:
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <hamsandwich>
#define PLUGIN "Free Defuser"
#define VERSION "1.0"
#define AUTHOR "HakimKILLER44"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
if (find_ent_by_class(-1, "func_bomb_target") != 0 || find_ent_by_class(-1, "info_bomb_target") != 0)
RegisterHam(Ham_Spawn, "player", "ham_spawn_post", 1)
}
public client_putinserver(id)
{
if (is_user_bot(id))
set_task(0.1, "task_bot_hams", id)
}
public task_bot_hams(id)
{
if (!is_user_connected(id))
return
RegisterHamFromEntity(Ham_Spawn, id, "ham_spawn_post", 1)
}
public ham_spawn_post(id)
{
if (!is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT || cs_get_user_defuse(id))
return
give_item(id, "item_thighpack")
cs_set_user_defuse(id, 1)
client_print(id, print_chat, "You got free DEFUSER KIT")
}