As the title says,the TE_BEAMENTS message does nothing,and I can't find what I'm doing wrong.
Code:
BeamEnts(ent1,ent2,sprite,color[4] = {255,255,255,255})
{
server_print("BEAMENTS %d %d %d %d %d %d %d",ent1,ent2,sprite,color[0],color[1],color[2],color[3])
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_BEAMENTS)
write_short(ent1) // start entity
write_short(ent2) // end entity
write_short(sprite) // sprite index
write_byte(1) // starting frame
write_byte(1) // frame rate in 0.1's
write_byte(50) // life in 0.1's
write_byte(16) // line width in 0.1's
write_byte(1) // noise amplitude in 0.01's
// red, green, blue, brightness
for(new i=0; i < 4;i++)
write_byte(color[i])
write_byte(1) // scroll speed in 0.1's
message_end()
}
public HookStartCommand(id)
{
if(!is_user_admin(id) && !iPlayerHook_On[id])
{
client_print(id,print_chat,"[KZ] You don't have access to this command")
return PLUGIN_HANDLED
}
new ent= engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
if(!ent)
return PLUGIN_HANDLED
RegisterHamFromEntity(Ham_Think,ent,"fwHookThink")
dllfunc(DLLFunc_Spawn,ent)
set_pev(ent,pev_aiment,id)
new Float:vAimOrigin[3]
fm_get_aim_origin(id,vAimOrigin)
engfunc(EngFunc_SetOrigin,ent,vAimOrigin)
new Float:fNow
global_get(glb_time,fNow)
set_pev(ent,pev_nextthink,fNow + 0.01)
new Float:vOrigin[3]
pev(id,pev_origin,vOrigin)
BeamEnts(id,ent,iBeamSprite,{255,0,0,200})
iPlayerHook_Ent[id] = ent
return PLUGIN_HANDLED
}
fwHookThink is okay,works fine,movement is correct.
The entity is created and deleted fine according to the logs.
The ent id's look right when printed in console.
No beam is shown.