Out of curiosity, I made a plugin to see how snappy the "laser pointer" would be.
In conclusion, it can't be made snappy enough. It'll always have some "lag", not really usable. You might want to try the metamod plugin that does the same thing, but I doubt that it'll be much quicker.
I included some extra code, feel free to ask questions:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <xs>
new sprite;
public plugin_init()
{
register_plugin("Laser Beam", "1.0", "stupok")
register_forward(FM_PlayerPreThink, "fw_playerprethink")
}
public plugin_precache()
{
sprite = precache_model("sprites/laserbeam.spr");
}
/*
public server_frame()
{
for(new i = 1; i < 33; i++)
{
if(is_user_alive(i))
{
show_beam2(i)
}
}
}
*/
/*
public fw_playerprethink(id)
{
show_beam2(id)
}
*/
public show_beam2(id)
{
static Float:fStart[3], Float:fEnd[3];
static tr;
// This block is interchangeable with get_user_origin(id,origin,3)
pev(id, pev_origin, fStart)
pev(id, pev_v_angle, fEnd)
engfunc(EngFunc_MakeVectors, fEnd)
global_get(glb_v_forward, fEnd)
xs_vec_mul_scalar(fEnd, 9999.0, fEnd)
xs_vec_add(fStart, fEnd, fEnd)
tr = create_tr2()
engfunc(EngFunc_TraceLine, fStart, fEnd, DONT_IGNORE_MONSTERS, id, tr)
get_tr2(tr, TR_vecEndPos, fEnd)
free_tr2(tr)
//
//get_user_origin(id,origin,3); // 3 - End position from eyes (hit point for weapon)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(TE_BEAMENTPOINT);
write_short(id | 0x1000); // start entity
engfunc(EngFunc_WriteCoord, fEnd[0])
engfunc(EngFunc_WriteCoord, fEnd[1])
engfunc(EngFunc_WriteCoord, fEnd[2])
//write_coord(origin[0]); // endposition.x
//write_coord(origin[1]); // endposition.y
//write_coord(origin[2]); // endposition.z
write_short(sprite); // sprite index
write_byte(0); // starting frame
write_byte(0); // frame rate in 0.1's
write_byte(1); // life in 0.1's
write_byte(10); // line wdith in 0.1's
write_byte(0); // noise amplitude in 0.01's
write_byte(0); // red
write_byte(0); // green
write_byte(255); // blue
write_byte(255); // brightness
write_byte(255); // scroll speed in 0.1's
message_end();
return PLUGIN_HANDLED;
}
__________________