AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can't create ent when aiming on players. (https://forums.alliedmods.net/showthread.php?t=86470)

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(PLUGINVERSIONAUTHOR)
    
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(idaVector3)
    
IVecFVec(aVectorflOrigin)
    
set_pev(wentpev_originflOrigin)
    
    
set_pev(wentpev_classnameg_Classname1
    
engfunc(EngFunc_SetModelwentWallModel
    
set_pev(wentpev_solidSOLID_BBOX
    
set_pev(wentpev_health700.0)
    
set_pev(wentpev_takedamageDAMAGE_YES)
    
engfunc(EngFunc_SetSizewentFloat:{-5.0, -90.0, -150.0}, Float:{5.090.0150.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 targetbody;
    
get_user_aiming idtargetbody );

    if ( 
<= target <= g_maxplayers )
    {
        new 
s_Name32 ];
        
get_user_name targets_Namecharsmax target ) );
        return 
PLUGIN_HANDLED;
    } 

And another little problem... The distance I need, around aimed player? How to do this?
Please help.


All times are GMT -4. The time now is 16:56.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.