View Single Post
Fixsek Kot
Member
Join Date: Feb 2022
Old 07-05-2022 , 16:02   Re: Spawned a NULL entity
Reply With Quote #3

oh I tried PHP but I didn't see the icon of it before now I see it, so I apologize
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <xs>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
new LM_MODEL[] = "models/zombiechronicbykot/lasermine/lasermine.mdl"
enum _:SERVER_DATA
{
    
LASER_ENTITY
}
enum _:LASER_PROPS
{
    
LASER_OWNER pev_iuser1,
    
LASER_BEAM pev_iuser2,
    
LASER_TEAM pev_iuser3,
    
LASER_STEP pev_iuser4,
    
LASER_END pev_vuser1,
    
LASER_ANGLES pev_angles,
    
LASER_ORIGIN pev_origin,
    
LASER_POWERUP 0,
    
LASER_ACTIVATED 1,
    
LASER_EXPLODE 2,
    
LASER_CREATE 3,
    
LASER_REMOVE 4
}
enum _:LASER_VECTOR
{
    
Float:LV_PLAYER,
    
Float:LV_ANGLES,
    
Float:LV_END,
    
Float:LV_NORMAL,
}
new 
server_data[SERVER_DATA]
public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}
public 
plugin_precache()
{
    
precache_model(LM_MODEL)
}
public 
client_putinserver(id)
{
    
set_task(8.0"CreateUserLaser"id)
}
public 
CreateUserLaser(iTask)
{
    static 
idiEnt
    
    iEnt 
engfunc(EngFunc_CreateNamedEntityserver_data[LASER_ENTITY])
    
    
engfunc(EngFunc_SetModeliEntLM_MODEL);
    
engfunc(EngFunc_SetSizeiEnt, { -4.0,-4.0,-4.0 }, { 4.0,4.0,4.0 });
    
    
set_pev(iEntpev_classname"zm_laser");
    
set_pev(iEntpev_solidSOLID_NOT);
    
set_pev(iEntpev_movetypeMOVETYPE_FLY);
    
    
set_pev(iEntpev_health750.0);
    
set_pev(iEntpev_takedamage0.0);
    
    
set_pev(iEntpev_iuser1id);
    
set_pev(iEntpev_iuser3get_user_team(id));
    
set_pev(iEntpev_iuser40);
    
    
SetLaserPosition(idiEnt);
    
    
set_pev(iEntpev_frame0);
    
set_pev(iEntpev_framerate0);
    
set_pev(iEntpev_body3);
    
set_pev(iEntpev_sequence7);
    
set_pev(iEntpev_nextthinkget_gametime() + 3.0)
}
SetLaserPosition(const id, const iEnt)
{
    static 
Float:fVector[LASER_VECTOR][3], Float:fFractioniTrace;
    
iTrace create_tr2();
    
    
pev(idpev_originfVector[LV_PLAYER]);
    
pev(idpev_v_anglefVector[LV_ANGLES]);
    
    
angle_vector(fVector[LV_ANGLES], ANGLEVECTOR_FORWARDfVector[LV_ANGLES]);
    
    
xs_vec_mul_scalar(fVector[LV_ANGLES], 128.0fVector[LV_ANGLES]);
    
xs_vec_add(fVector[LV_PLAYER], fVector[LV_ANGLES], fVector[LV_END]);
    
    
engfunc(EngFunc_TraceLinefVector[LV_PLAYER], fVector[LV_END], DONT_IGNORE_MONSTERSidiTrace);
    
    
get_tr2(iTraceTR_flFractionfFraction);
    
get_tr2(iTraceTR_vecEndPosfVector[LV_END]);
    
get_tr2(iTraceTR_vecPlaneNormalfVector[LV_NORMAL]);
    
    
free_tr2(iTrace);
    
iTrace create_tr2();
    
    
xs_vec_mul_scalar(fVector[LV_NORMAL], 8.0fVector[LV_NORMAL]);
    
xs_vec_add(fVector[LV_END], fVector[LV_NORMAL], fVector[LV_END]);
    
    
engfunc(EngFunc_SetOriginiEntfVector[LV_END]);
    
    
vector_to_angle(fVector[LV_NORMAL], fVector[LV_ANGLES]);
    
set_pev(iEntLASER_ANGLESfVector[LV_ANGLES]);
    
    if (
fFraction 1.0)
    {    
    
xs_vec_mul_scalar(fVector[LV_NORMAL], 8192.0fVector[LV_NORMAL]);
    
engfunc(EngFunc_TraceLinefVector[LV_END], fVector[LV_NORMAL], IGNORE_MONSTERSiEntiTrace);
    
    
get_tr2(iTraceTR_vecEndPosfVector[LV_END]);
    
free_tr2(iTrace);
    }
    
    
set_pev(iEntLASER_ENDfVector[LV_END])

Fixsek Kot is offline