Raised This Month: $51 Target: $400
 12% 

Solved entity think vs task?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 02-03-2022 , 01:08   entity think vs task?
Reply With Quote #1

Hi! What benefits we have in creating an entity instead of a task?
Code:
{
public plugin_init() {
	new iEnt = create_entity("info_target")

	if(iEnt) {
		entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1)
		entity_set_string(iEnt, EV_SZ_classname, "_hud_spec")
		register_think("_hud_spec", "UpdateSpecHud")
	} else {
		set_task(0.1, "UpdateSpecHud", .flags="b")
	}
}

public UpdateSpecHud(iEnt) {
	if(iEnt)
		entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1)
}
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 02-04-2022 at 16:15.
kww is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-03-2022 , 01:45   Re: entity think vs task?
Reply With Quote #2

Found this by simply searhing for your thread title in the Scripting Help (this) forum. It includes a couple other relevant links too.
__________________

Last edited by fysiks; 02-03-2022 at 01:46.
fysiks is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 02-04-2022 , 16:15   Re: entity think vs task?
Reply With Quote #3

really. thx
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951
kww is offline
Reply



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 04:30.


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