Hola gente , he vuelto despues de tantos dias.
Y hoy me puse a probar sobre entidad y cuando alguien la toca..
Pero no logro hacer que funcione , que me de lo que quiero..
PHP Code:
#define HEMDL "models/w_hegrenade.mdl"
#define FBMDL "models/w_flashbang.mdl"
#define SGMDL "models/w_smokegrenade.mdl"
#define HECN "BombaHE"
#define FBCN "BombaFB"
#define SGCN "BombaSG"
enum
{
HE = 0,
FB,
SG
}
public plugin_precache()
{
precache_model(HEMDL)
precache_model(FBMDL)
precache_model(SGMDL)
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
register_forward(FM_Touch, "TouchNade")
}
public fw_PlayerKilled (victim)
{
new origin[3], randomm = random_num(1,3)
get_user_origin(victim, origin, 0)
switch (randomm)
{
case 1: CreateNade(origin, HE)
case 2: CreateNade(origin, FB)
case 3: CreateNade(origin, SG)
}
}
public CreateNade(origin[3], Nade)
{
new Float:fOrigin[3]
new ent = create_entity("info_target")
switch (Nade)
{
case HE:
{
entity_set_model(ent, HEMDL)
entity_set_string(ent, EV_SZ_classname, HECN)
}
case FB:
{
entity_set_model(ent, FBMDL)
entity_set_string(ent, EV_SZ_classname, FBCN)
}
case SG:
{
entity_set_model(ent, SGMDL)
entity_set_string(ent, EV_SZ_classname, SGCN)
}
}
entity_set_size(ent, Float:{-2.0, -2.0, -2.0}, Float:{2.0, 2.0, 2.0})
IVecFVec(origin, fOrigin)
entity_set_origin(ent, fOrigin)
entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
drop_to_floor(ent)
}
public TouchNade (id, ent)
{
new szClasName[32]
entity_get_string(ent, EV_SZ_classname, szClasName, 31)
if (equal(szClasName, HECN))
{
client_print(id, print_chat, "Has tocado una HeGrenade")
give_item(id, "weapon_hegrenade")
}
else if (equal(szClasName, FBCN))
{
client_print(id, print_chat, "Has tocado una FlashGrenade")
give_item(id, "weapon_flashbang")
}
else if (equal(szClasName, SGCN))
{
client_print(id, print_chat, "Has tocado una SmokeGrenade")
give_item(id, "weapon_smokegrenade")
}
}
No se como lograr que al tocar cierta bomba me de ese mismo item y tampoco sale el mensaje
Edit: Lo que no me funciona es el TOUCH