Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>
public plugin_init()
{
register_plugin("Hostage auto escape", ".01b1", "Obbin")
register_clcmd("host", "get_hitent")
}
public get_hitent(id)
{
new iEnt, bodyPart, Float:fDistance
fDistance = get_user_aiming(id, iEnt, bodyPart, 999999)
client_print(id, print_chat, "you hit %i", iEnt)
new classname[32]
entity_get_string(iEnt, EV_SZ_classname, classname, 31)
if (equal(classname, "hostage_entity"))
{
client_print(id, print_chat, "IT IS A HOST")
new follent = CreateFollEnt(id)
cs_set_hostage_foll(iEnt, follent)
}
return PLUGIN_HANDLED
}
public CreateFollEnt(id)
{
//Get player's origin as a Float
new Float:origin[3]
entity_get_vector(id,EV_VEC_origin,origin)
//Create Entity
new ent = create_entity("info_target")
//Set Classname (Good to use in order to find out if a player touches an object w/ this classname. Use pfn_touch for such an ocation.)
entity_set_string(ent,EV_SZ_classname,"host_foll")
//Set Model
//entity_set_model(ent,"models/ghw_health.mdl")
//Set Origin
entity_set_origin(ent,origin)
//Set Movetypem Solidtype + Owner
//entity_set_int(ent, EV_INT_solid,SOLID_BBOX)
//entity_set_int(ent,EV_INT_movetype,MOVETYPE_FLY)
//entity_set_edict(ent,EV_ENT_owner,33)
//Set Model's play sequence (Framerate 1.0 means normal speed + sequence 0 is the idle sequence)
//entity_set_float(ent,EV_FL_framerate,1.0)
//entity_set_int(ent,EV_INT_sequence,0)
return ent
}