Quote:
Originally Posted by MeRcyLeZZ
Yeah, that's right. The code is still not perfect, but prevents SVC_BAD a lot better than the old one in those cases.
|
that would have helped me some months ago when antidote bomb did that, so i was forced to fix it LOL
EDIT: mercylezz if you want i may post a new flashlight sistem for your next updatewich is lagless and looks pretty better
EDIT2: here it is, i may not explain step by step because you will understand in a pretty easy way
PHP Code:
RegisterHam(Ham_Player_PreThink, "player", "FwdPlayerPreThink") //the same than actual prethink but i like more hamsandwich :D
public FwdPlayerPreThink(id)
{
if( g_flashlight[id] && is_user_alive(id) && !g_zombie[id] )
{
Make_FlashLight(id)
}
}
stock Float:Get_StarEndPos(id, Float:flStart[3], Float:flAim[3])
{
pev(id, pev_origin, flStart)
pev(id, pev_view_ofs, flAim)
xs_vec_add(flStart, flAim, flStart)
pev(id, pev_v_angle, flAim)
engfunc(EngFunc_MakeVectors, flAim)
global_get(glb_v_forward, flAim)
xs_vec_mul_scalar(flAim, 9999.0, flAim)
xs_vec_add(flStart, flAim, flAim)
engfunc(EngFunc_TraceLine, flStart, flAim, 0, id, 0)
get_tr2(0, TR_vecEndPos, flAim)
}
Make_FlashLight(id)
{
static Float:nada[3], Float:origin[3], colors[12], r[4], g[4], b[4]
Get_StarEndPos(id, nada, origin)
parse(colors, r, 3, g, 3, b, 4)
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
write_byte(TE_DLIGHT)
engfunc(EngFunc_WriteCoord, origin[0])
engfunc(EngFunc_WriteCoord, origin[1])
engfunc(EngFunc_WriteCoord, origin[2])
write_byte(6)
write_byte(199)
write_byte(166)
write_byte(90)
write_byte(1)
write_byte(10)
message_end()
}
and comment so it would look like this
Quote:
// Finally call our custom flashlight task
remove_task(id+TASK_FLASH)
//set_task(0.1, "set_user_flashlight", id+TASK_FLASH, _, _, "b")
|
and above that, the same thing
Quote:
// Finally call our custom flashlight task
remove_task(id+TASK_FLASH)
//set_task(0.1, "set_user_flashlight", id+TASK_FLASH, _, _, "b")
|