View Single Post
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 07-25-2012 , 05:52   Re: [L4D2] Undo Friendly Fire (1.3) [2012-Jul-25]
Reply With Quote #3

A few things that could change.

#define IS_CONNECTED_INGAME(%1) (IsClientConnected(%1) && IsClientInGame(%1))

Once a player is in game, you do not need to check if they are also connected. The only way for them to be in game is to be connected.

PHP Code:
// TODO: When the plugin is reloaded, existing clients' hooks are lost
//          How can I fix this? 
You do that by using OnAllPluginsLoaded.

PHP Code:
// Account for late loading
public OnAllPluginsLoaded()
{
    for (new 
client 1client <= MaxClientsclient++)
    {
        if (
IsClientInGame(client))
        {
            
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamageUndoFF);
            
SDKHook(clientSDKHook_TraceAttackTraceAttackUndoFF);
        }
    }

Other than that, please notice that OnTraceAttack or OnTakeDamage also fires during god frames. Meaning while the Survivor is getting up after being attacked by SI but take no damage even through OnTakeDamage hook fires.

Good plugin!
Good use of stocks as well ;)

Last edited by Mr. Zero; 07-25-2012 at 05:53.
Mr. Zero is offline