Replacing Player-Specific Task with Think on Player's Entity
So I just wrote this and it apparently works.
Code:
Code:
Of course, there could only be one task per player per all the plugins at a time. |
Re: Replacing Player-Specific Task with Think on Player's Entity
Quote:
Quote:
|
Re: Replacing Player-Specific Task with Think on Player's Entity
You do realize that hooking a player's think is the same as using PreThink, right?
|
Re: Replacing Player-Specific Task with Think on Player's Entity
Because pfnThink will call CBasePlayer :: PlayerDeathThink, you can use it only for alive players, as following :
- If user is alive, set nextthink to what you want. - When Think is called, check if player is still alive. - If player is dead, do nothing, return PLUGIN_CONTINUE - If player is still alive, execute your code and block the function returning PLUGIN_HANDLED - In that case, (alive player), if you want to execute something again, set nextthink to the wanted value, ELSE and that is important, set nextthink to -1. Also, for players, i guess it's better to hook with Ham than with engine. |
Re: Replacing Player-Specific Task with Think on Player's Entity
I would not recommend to play with player's think ; it's way more simple here to use a new entity.
|
Re: Replacing Player-Specific Task with Think on Player's Entity
I see. I've always thought that Think on player's entity would be called every player's frame, but once I found out it wasn't the case, wanted to check if it's safe. Apparently it's not worth it.
Quote:
|
| All times are GMT -4. The time now is 07:51. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.