Raised This Month: $51 Target: $400
 12% 

[L4D] SDKHooks No Damage?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 08-08-2013 , 15:55   [L4D] SDKHooks No Damage?
Reply With Quote #1

The Code Below says the damage and the new damage, but does not take affect...

PHP Code:
public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    
decl String:z_difficulty[16];
    
GetConVarString(FindConVar("z_difficulty"), z_difficultysizeof(z_difficulty));

    if(
StrEqual(z_difficulty"Impossible"false) && GetClientTeam(victim) == 2)
    {
        
PrintToChat(victim"Damage: %f, New: %f"damagedamage*0.5);
        
damage damage 0.5;
        return 
Plugin_Changed;
    }
    return 
Plugin_Changed;

__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
mcpan313
Senior Member
Join Date: Mar 2010
Old 08-08-2013 , 16:07   Re: [L4D] SDKHooks No Damage?
Reply With Quote #2

Have you reload it after map start?
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 08-08-2013 , 16:11   Re: [L4D] SDKHooks No Damage?
Reply With Quote #3

Might need to validate the attacker, try this.

Edit:Actually NVM, you never used attacker...

Try to do a full map refresh, and do what mcpan says about late loading the plugin.
__________________

Last edited by Chaosxk; 08-08-2013 at 16:14.
Chaosxk is offline
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 08-08-2013 , 16:18   Re: [L4D] SDKHooks No Damage?
Reply With Quote #4

Tried it all, does not work, I read somewhere that this SDKHook does not work in L4D(2) games? true?
__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-08-2013 , 21:52   Re: [L4D] SDKHooks No Damage?
Reply With Quote #5

Have you checked if it's firing at all?
__________________
thetwistedpanda is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 08-08-2013 , 23:39   Re: [L4D] SDKHooks No Damage?
Reply With Quote #6

Works fine... view any of my plugins for examples.

Edit: Maybe update, SM/MM I heard some people had issues (in L4D2) where SDKHooks would not fire certain functions at all, until they updated.
__________________

Last edited by Silvers; 08-08-2013 at 23:43.
Silvers is offline
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 08-14-2013 , 02:15   Re: [L4D] SDKHooks No Damage?
Reply With Quote #7

Quote:
Originally Posted by thetwistedpanda View Post
Have you checked if it's firing at all?
It is firing, but 0 damage.

Quote:
Originally Posted by Silvers View Post
Works fine... view any of my plugins for examples.

Edit: Maybe update, SM/MM I heard some people had issues (in L4D2) where SDKHooks would not fire certain functions at all, until they updated.
I checked, I am using 1.5 stable. I get 0 damage, but its suppose damage half.
__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 08-14-2013 , 06:37   Re: [L4D] SDKHooks No Damage?
Reply With Quote #8

It works in L4D(2). I used it extensively in the skyrpg series, as well as in damage reflect plugins! If it didn't, setting damage to 0 and returning Plugin_Changed would have done nothing =)

Last edited by Skyy; 08-14-2013 at 06:38.
Skyy is offline
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 08-14-2013 , 14:37   Re: [L4D] SDKHooks No Damage?
Reply With Quote #9

Quote:
Originally Posted by Skyy View Post
It works in L4D(2). I used it extensively in the skyrpg series, as well as in damage reflect plugins! If it didn't, setting damage to 0 and returning Plugin_Changed would have done nothing =)
I didn't set it to 0, I set it to half damage. As you can see below, there are no mistakes, yet in game, I am in godmode.

PHP Code:
public OnClientPutInServer(client

    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 


public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype

    
decl String:z_difficulty[16]; 
    
GetConVarString(FindConVar("z_difficulty"), z_difficultysizeof(z_difficulty)); 

    if(
StrEqual(z_difficulty"Impossible"false) && GetClientTeam(victim) == 2
    { 
        
PrintToChat(victim"Damage: %f, New: %f"damagedamage*0.5); 
        
damage damage 0.5
        return 
Plugin_Changed
    } 
    return 
Plugin_Changed

__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-14-2013 , 15:01   Re: [L4D] SDKHooks No Damage?
Reply With Quote #10

First off, you should really cache the value of z_difficulty and hook it for changes and use the result within the call; forcing it to find the convar then get the value every time damage is taken is bad. Second, you're returning Plugin_Changed even if no changes are made; should consider changing that to Plugin_Continue. SDKHooks also has an updated prototype for OnTakeDamage depending on what version you're using, so may want to grab the latest (although it likely wouldn't resolve the issue). I assume the PrintToChat is firing?
__________________
thetwistedpanda is offline
Reply



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:08.


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