View Single Post
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 02-05-2021 , 06:02   Re: [Any] Simple HealthBars
Reply With Quote #4

You should change this
PHP Code:
public OnMapStart() {
    
beamSprite PrecacheModel("materials/sprites/laserbeam.vmt");
    
glowsprite PrecacheModel("sprites/redglow3.vmt");
    
CreateTimer(0.1Timer_Render_TIMER_REPEAT);

to this
PHP Code:
public OnMapStart() {
    
beamSprite PrecacheModel("materials/sprites/laserbeam.vmt");
    
glowsprite PrecacheModel("sprites/redglow3.vmt");
    
CreateTimer(0.1Timer_Render_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);

in order to prevent creating duplicated timers on each mapchange.

Code:
TIMER_FLAG_NO_MAPCHANGE 
The timer will automatically stop if the map changes
Source: https://wiki.alliedmods.net/SourcePa...rs#Timer_Flags
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 02-05-2021 at 06:03.
Franc1sco is offline
Send a message via MSN to Franc1sco