AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved entity think vs task? (https://forums.alliedmods.net/showthread.php?t=336188)

kww 02-03-2022 01:08

entity think vs task?
 
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)
}


fysiks 02-03-2022 01:45

Re: entity think vs task?
 
Found this by simply searhing for your thread title in the Scripting Help (this) forum. It includes a couple other relevant links too.

kww 02-04-2022 16:15

Re: entity think vs task?
 
really. thx


All times are GMT -4. The time now is 11:39.

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