Raised This Month: $ Target: $400
 0% 

Help set_task


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
tolpecek
Member
Join Date: Dec 2018
Old 12-26-2018 , 16:54   Help set_task
Reply With Quote #1

Hello
it looks like set_task ignores a delay or idk.. code:
Code:
plugin_init()
{
RegisterHam(Ham_Spawn, "player", "zaciatok_kola", 1 )
}
Code:
public zaciatok_kola(id)
{
	set_task(2,"Task_HPRegenLoop",id,_,_,"b")
	set_task(2,"uzdraveniloop",id,_,_,"b")
}
Code:
public Task_HPRegenLoop(id)
{
	if(g_item_reg[id] && cs_get_user_team(id)== CS_TEAM_CT && is_user_alive(id))
	{
		if((get_user_health(id) >= 500))
		{
			set_user_health(id, 500)
		}
		else
		{ 
			set_user_health(id, get_user_health(id) + 5)
		}
	}
	else 
	{
		set_user_health(id, get_user_health(id))
	}
}
public uzdraveniloop(id)
{
	new float:addhealths = MaxHP[id]*0.05
	if(g_item_sti[id] && cs_get_user_team(id) == CS_TEAM_T && is_user_alive(id))
	{
		if(!(get_user_health(id) >= MaxHP[id]))
			set_user_health(id, get_user_health(id) + floatround(addhealths))
			if(get_user_health(id) > MaxHP[id]) 
				set_user_health(id, floatround(MaxHP[id]))
	}
	else 
	{
		set_user_health(id, get_user_health(id))
	}
}
adding health works ok but that delay thanks

Last edited by tolpecek; 12-26-2018 at 18:45.
tolpecek is offline
 


Thread Tools
Display Modes

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 07:34.


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