| xbatista |
02-26-2009 08:57 |
Can't create ent when aiming on players.
How to do: the player can't create wall/ent when aiming on other player?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "XxX"
#define AUTHOR "xbatista"
#define VERSION "0.1"
new g_Classname1[] = "wall_brekeable"
new WallModel[] = "models/wall.mdl"
public plugin_precache()
{
precache_model(WallModel)
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("+wall", "wall")
// register_forward(FM_Touch,"ForwardTouch")
}
public wall(id)
{
new went = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"))
new Float:flOrigin[3]
new aVector[3]
get_user_origin(id, aVector, 3)
IVecFVec(aVector, flOrigin)
set_pev(went, pev_origin, flOrigin)
set_pev(went, pev_classname, g_Classname1)
engfunc(EngFunc_SetModel, went, WallModel)
set_pev(went, pev_solid, SOLID_BBOX)
set_pev(went, pev_health, 700.0)
set_pev(went, pev_takedamage, DAMAGE_YES)
engfunc(EngFunc_SetSize, went, Float:{-5.0, -90.0, -150.0}, Float:{5.0, 90.0, 150.0})
}
/*public ForwardTouch(Ptd,Ptr)
{
new Classname[33],Ent = Ptd,id = Ptr
pev(Ptd,pev_classname,Classname,32)
if(!equal(Classname,g_Classname1))
{
Ent = Ptr
id = Ptd
pev(Ptr,pev_classname,Classname,32)
if(!equal(Classname,g_Classname1))
return
}
new Owner = pev(Ent,pev_owner)
if(Owner != id)
return
client_print(id,print_chat,"You have used this car. Due to time purposes, I'm not going to add code beyond this.")
}*/
EDIT: hmmm.....I solved it somehow...
PHP Code:
new target, body;
get_user_aiming ( id, target, body );
if ( 1 <= target <= g_maxplayers )
{
new s_Name[ 32 ];
get_user_name ( target, s_Name, charsmax ( target ) );
return PLUGIN_HANDLED;
}
And another little problem... The distance I need, around aimed player? How to do this?
Please help.
|