Hello,
what I did for now:
- increasing the task time to 1.0 (instead of 0.2)
- only show one side of the block (x/y) by comparing the size with pev_size
(- always show top z)
- set a task when player touches a bombsite block, to only show the message every 5 seconds
This should at least decrease the performance hit a bit for now, as it only draws a max of 4 lines at once for a box instead of 12.
PHP Code:
public show_zone_cross(entity)
{
entity -= TASK_SHOW_BLOCK
if (!pev_valid(entity)) return
new Float:pos[3]
pev(entity, pev_origin, pos)
new Float:size[3], Float:mins[3], Float:maxs[3]
pev(entity, pev_size, size)
pev(entity, pev_mins, mins)
pev(entity, pev_maxs, maxs)
mins[0] += pos[0]
mins[1] += pos[1]
mins[2] += pos[2]
maxs[0] += pos[0]
maxs[1] += pos[1]
maxs[2] += pos[2]
if ( size[0] < size[1] )
{
// x
draw_block_line(maxs[0], maxs[1], maxs[2], maxs[0], mins[1], mins[2], zone_color_red)
draw_block_line(maxs[0], maxs[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_red)
}
else if ( size[0] > size[1] )
{
// y
draw_block_line(mins[0], mins[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_red)
draw_block_line(maxs[0], mins[1], mins[2], mins[0], mins[1], maxs[2], zone_color_red)
}
// z
draw_block_line(maxs[0], maxs[1], maxs[2], mins[0], mins[1], maxs[2], zone_color_red)
draw_block_line(maxs[0], mins[1], maxs[2], mins[0], maxs[1], maxs[2], zone_color_red)
}
Quote:
Originally Posted by JusTGo
you have to spawn an entity give it a model (wall model or any thing that you want). then remove it when not needed that way you don't need to keep sending the show cross each 0.2 sec
|
I want to avoid any custom models clients would have to download...
- LegacyCode