Raised This Month: $ Target: $400
 0% 

Replacing Player-Specific Task with Think on Player's Entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-29-2012 , 05:41   Replacing Player-Specific Task with Think on Player's Entity
Reply With Quote #1

So I just wrote this and it apparently works.
Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_clcmd("say /test", "OnSayTest");         register_think("player", "OnThink"); } public OnSayTest(id)     entity_set_float(id, EV_FL_nextthink, get_gametime() + 1.0); // This gets called 1 second after writing "/test" public OnThink(id)     client_print(id, print_chat, "* Think.");
However I didn't notice anyone else doing this instead of
Code:
set_task(1.0, "OnSayTest", id);
So I'm wondering if it's safe to hook player's Think? This should be much better than settings tasks for player's individually and we also avoid creating a new entity for hooking its think, if seeking performance over setting tasks.

Of course, there could only be one task per player per all the plugins at a time.

Last edited by hleV; 04-29-2012 at 05:44.
hleV 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 07:51.


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