Raised This Month: $ Target: $400
 0% 

[Help] WalkGuard Block Bombsites


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
LegacyCode
Member
Join Date: Apr 2017
Old 05-25-2017 , 10:40   Re: [Help] WalkGuard Block Bombsites
Reply With Quote #6

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(entitypev_originpos)

    new 
Float:size[3], Float:mins[3], Float:maxs[3]
    
pev(entitypev_sizesize)
    
pev(entitypev_minsmins)
    
pev(entitypev_maxsmaxs)

    
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 View Post
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

Last edited by LegacyCode; 05-25-2017 at 11:32.
LegacyCode is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode