Raised This Month: $ Target: $400
 0% 

SDK Hooks 2.1 - Updated 2011-9-10


Post New Thread Closed Thread   
 
Thread Tools Display Modes
strontiumdog
Veteran Member
Join Date: Jan 2007
Location: BC, Canada
Old 02-10-2010 , 19:14   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#401

Quote:
Originally Posted by Greyscale View Post
(Although I don't know why you multiply damage by 0, you could just set it and save a few billionths of a second )
I just grabbed the code and pasted it from a DoDS plugin - I was using it to control the amount of damage a MG was dishing out!
__________________
Plugins | TheVille
Zombie Mod for DoD:S - l4dod.theville.org
strontiumdog is offline
toazron1
Senior Member
Join Date: Oct 2006
Old 02-10-2010 , 21:04   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#402

Quote:
Originally Posted by Greyscale View Post
(Although I don't know why you multiply damage by 0, you could just set it and save a few billionths of a second )
How about return Plugin_Handled instead?

edit mixed returns up.. don't post when tired lol
__________________

Last edited by toazron1; 02-11-2010 at 09:28.
toazron1 is offline
Send a message via AIM to toazron1
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 02-10-2010 , 21:31   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#403

I assume you mean Plugin_Handled. He could do that too.
__________________
Greyscale is offline
spunkster21
Senior Member
Join Date: Aug 2008
Old 02-11-2010 , 03:16   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#404

Quote:
Originally Posted by Sammy-ROCK! View Post
If it doesn't display the text then knife's damagetype ain't slash. You should research a bit more to find the right damagetype.
Yes, I suppose it was foolish of me to assume cut, clawed, stabbed would have any relation to knife damage. Because, of course, in Valve world knife damage is the same as bullet damage.

PHP Code:
#define DMG_SLASH                                    (1 << 2)    // cut, clawed, stabbed 
Quote:
Originally Posted by strontiumdog View Post
You need to add 'plugin_changed' to make the damage take effect...

PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    
//ensure that is is a player and not anything else
    
if ((attacker && attacker 33) && (victim && victim 33))
    {               
            
decl String:Weapon[32];
            
GetClientWeapon(attackerWeaponsizeof(Weapon));
       
            
// replace with weapon name
            
if (StrEqual(Weapon"weapon_knife"))
            {
                
damage *= 0.0;
                return 
Plugin_Changed;
            }
    }
    
    return 
Plugin_Continue;

Thank you very much for this example.
spunkster21 is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 02-11-2010 , 17:39   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#405

Quote:
Originally Posted by spunkster21 View Post
Yes, I suppose it was foolish of me to assume cut, clawed, stabbed would have any relation to knife damage. Because, of course, in Valve world knife damage is the same as bullet damage.

Indeed
__________________
Greyscale is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 02-12-2010 , 09:47   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#406

The idea of saying that the arguments are passed by ref in pre hooks is very nice. Why doesn't it apply to the first argument?
__________________
joaquimandrade is offline
Sammy-ROCK!
Senior Member
Join Date: Jun 2008
Location: Near Mrs.Lag
Old 02-12-2010 , 10:01   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#407

What hook your talking about?
Sammy-ROCK! is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 02-12-2010 , 10:08   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#408

Quote:
Originally Posted by Sammy-ROCK! View Post
What hook your talking about?
PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype
__________________
joaquimandrade is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-14-2010 , 14:53   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#409

Is that is correct?
PHP Code:
public OnEntityCreated(entity, const String:classname[])
{
    if ( 
IsValidEdict(entity) )
    {
        if( 
StrEqualclassname"weapon_shotgun_chrome_spawn") )
        {
            
AcceptEntityInputentity"Disable");
            
RemoveEdictentity );
        }
    }

__________________
xbatista is offline
Send a message via Skype™ to xbatista
Sammy-ROCK!
Senior Member
Join Date: Jun 2008
Location: Near Mrs.Lag
Old 02-14-2010 , 14:54   Re: [EXTENSION] SDK Hooks 1.3 (Updated 02/02/10)
#410

I'm not sure if you should remove a entity right after it's created and didn't even spawn yet.
Sammy-ROCK! is offline
Closed Thread



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 11:09.


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