How to set SDKHook on round_start correctly?
Hi,
Let's say I'm using SDKHook_OnTakeDamage to block some damage on all SURVIVORS (2) team (L4D). It require to set hook on each individual client: Code:
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage); So I need to set it again once player is fully-ingame (I guess) on next round_start. For this reason, I'm using "player_team" event and check if "team == 2" (don't need extra unnecessary hooks). Everything work ok. I just curious are there a simpler way than my monstro-code? Code:
#include <sourcemod> P.S. I saw some people use OnClientPutInServer() to set hook, but it's extra hooks (e.g. here also clients with team == 3). |
Re: How to set SDKHook on round_start correctly?
how do you know the game engine unhooks after round end?
|
Re: How to set SDKHook on round_start correctly?
Quote:
|
Re: How to set SDKHook on round_start correctly?
Quote:
|
Re: How to set SDKHook on round_start correctly?
In l4d2 i use onclientputinserver....it either rehooks it on everymap load or never unhooks it to begin with...not really sure but it always works between map changes or round end. .i havent tried a client loop in on round start but the problem with that is not all clients may be available to hook at that time...not sure though...could use player spawn event...set a bool in round end and check...but i think onclientputinserver is what u want.
|
Re: How to set SDKHook on round_start correctly?
Quote:
OnClientPutInServer() is the way to go. For late loads, you can use a for () loop on OnPluginStart() or OnMapStart(). |
Re: How to set SDKHook on round_start correctly?
8guawong, thanks. You are right. I made a problem myself by Unhooking on "disconnect" reason.
I thought player_team set that reason when player is really disconnect from the server. Looks like my main question is over. After hooking it once, engine never unhook it again itself. So, how to recognize is it disconnection because client quit the game or because map ends? OnClientDisconnect() forward is also called for all clients just right before map ends. EDIT. Ohh, MasterMind, Crasher, thanks too. |
Re: How to set SDKHook on round_start correctly?
Quote:
|
Re: How to set SDKHook on round_start correctly?
Just hook in onclientputinserver and check there if team == 3
|
Re: How to set SDKHook on round_start correctly?
Quote:
Looks like the only opportunity is player_team or round_start + timer. Quote:
... All right. It's enough info for me. Thanks @all. |
All times are GMT -4. The time now is 07:45. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.