Raised This Month: $32 Target: $400
 8% 

SDK Hooks 2.1 - Updated 2011-9-10


Post New Thread Closed Thread   
 
Thread Tools Display Modes
psychonic

BAFFLED
Join Date: May 2008
Old 11-06-2009 , 16:49   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#101

Quote:
Originally Posted by AtomicStryker View Post
Relating to these error messages
http://forums.alliedmods.net/showpos...&postcount=173

What exactly are &attacker and &inflictor - entity ids? user ids? Of whom or what?
Attacker will be the entity/client id of the client attacking (or entity id if an l4d common-infected). Inflictor can vary from being same as the attacker, the ent id of a weapon, the ent of a projectile, or even something else.

For example, in TF2:
Quote:
Originally Posted by psychonic
A note about inflictor and finding the weapon used:
For instant-hit weapons, this will be the client id, and the weapon will be the one they are currently holding.
For the syringe gun and blutsauger, this will be the ent id of the weapon.
For other projectiles (flare, arrow, rocket, nade, sticky), this will be the ent id of the projectile. The weapon will be the projectile's owner.
psychonic is offline
Chris-_-
SourceMod Donor
Join Date: Oct 2008
Old 11-06-2009 , 17:50   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#102

Post to see page 11
Chris-_- is offline
Thrawn2
Veteran Member
Join Date: Apr 2009
Old 11-07-2009 , 07:29   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#103

Quote:
Originally Posted by rhelgeby View Post
awesome. works! thx.
Thrawn2 is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 11-07-2009 , 08:48   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#104

This crashes my windows server, a few seconds ingame

PHP Code:
public OnClientPutInServer(client)
{
    
Damage[client] = GetConVarFloat(g_playermultiplier);
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
OnEntityCreated(entity, const String:classname[])
{
    if (
StrEqual(classname"infected") || StrEqual(classname"witch"))
    {
        
SDKHook(entitySDKHook_OnTakeDamageOnTakeDamage);
    }
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if(!
GetConVarBool(g_enabled)) return Plugin_Handled// is this thing even on?

    
decl String:sWeapon[32], Float:mWeaponFloat:amountWeapon;
    
GetEdictClassname(inflictorsWeaponsizeof(sWeapon));
    
    new 
bool:changed;
    new 
Float:changemulti 1.0;
    new 
Float:globalmulti GetConVarFloat(g_multiplier);
    
    if(
globalmulti != 1.0//check for a global damage multiplier setting
    
{
        if(
globalmulti == 0.0damage == 0.0//nullify setting?
        
else changemulti += globalmulti 1.0//else add multi
        
changed true;    
    }
    
    if (
attacker && attacker <= MAXPLAYERS)
    {
        if(
Damage[attacker] != globalmulti//check for a player specific multiplier setting
        
{
            if (
Damage[attacker] == 0damage == 0.0//nullify setting?
            
else changemulti += Damage[attacker] - 1.0//else add multi
            
changed true;
        }
    }
    
    if(
GetTrieValue(trieWeapons,sWeapon,mWeapon)) // check for the gun multiplier setting
    
{
        if (
mWeapon == 0damage == 0.0//nullify setting?
        
else changemulti += mWeapon 1.0//else add multi
        
changed true;
    }
    
    if(
changed && damage 0.0damage *= changemulti//add all multipliers if not nullified yet
    
    
if(GetTrieValue(trieAmount,sWeapon,amountWeapon)) //check for gun damage amount setting
    
{
        
damage += amountWeapon//add gun specific damage amount
        
changed true;
    }
    
    if(
changed) return Plugin_Changed;    
    return 
Plugin_Continue;

Any ideas? Just crashes, no error messages.
AtomicStryker is offline
Thrawn2
Veteran Member
Join Date: Apr 2009
Old 11-07-2009 , 09:10   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#105

try this:
PHP Code:
    //GetEdictClassname(inflictor, sWeapon, sizeof(sWeapon));
    
GetClientWeapon(attackersWeaponsizeof(sWeapon)); 
Thrawn2 is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 11-07-2009 , 10:27   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#106

Also, add l4d2 support? Ive looked up the Virtual adresses for you, but i have no idea about the signature

PHP Code:
    "left4dead2"
    
{
        
"Offsets"
        
{
            
"EndTouch"
            
{
                
"windows"    "108"
                "linux"        "109"
            
}
            
"FireBullets"
            
{
                
"windows"    "121"
                "linux"        "122"
            
}
            
"OnTakeDamage"
            
{
                
"windows"    "71"
                "linux"        "72"
            
}
            
"PreThink"
            
{
                
"windows"    "354"
                "linux"        "355"
            
}
            
"PostThink"
            
{
                
"windows"    "355"
                "linux"        "356"
            
}
            
"SetTransmit"
            
{
                
"windows"    "21"
                "linux"        "22"
            
}
            
"Spawn"
            
{
                
"windows"    "23"
                "linux"        "24"
            
}
            
"StartTouch"
            
{
                
"windows"    "106"
                "linux"        "107"
            
}
            
"Think"
            
{
                
"windows"    "55"
                "linux"        "56"
            
}
            
"Touch"
            
{
                
"windows"    "107"
                "linux"        "108"
            
}
            
"TraceAttack"
            
{
                
"windows"    "69"
                "linux"        "70"
            
}
            
"UpdateOnRemove"
            
{
                
"windows"    "114"
                "linux"        "115"
            
}
            
"Weapon_Drop"
            
{
                
"windows"    "281"
                "linux"        "282"
            
}
            
"Weapon_Equip"
            
{
                
"windows"    "279"
                "linux"        "280"
            
}
            
"Weapon_Switch"
            
{
                
"windows"    "282"
                "linux"        "283"
            
}
        }
        
        
"Signatures"
        
{
            
"IEntityFactoryDictionary"
            
{
                
"library"    "server"
                "windows"    "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3"
                "linux"        "@_Z23EntityFactoryDictionaryv"
            
}
        }
    } 
AtomicStryker is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-07-2009 , 10:59   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#107

Quote:
Originally Posted by [AAA] Thrawn View Post
try this:
PHP Code:
    //GetEdictClassname(inflictor, sWeapon, sizeof(sWeapon));
    
GetClientWeapon(attackersWeaponsizeof(sWeapon)); 
Weapon someone is hit by is not always the weapon the attacker is still holding.
psychonic is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 11-07-2009 , 12:35   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#108

I've dumbed it down a lot, and narrowed it down to the OnEntityCreated Hook crashing

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

public 
OnEntityCreated(entity, const String:classname[])
{
    if (
entity MAXPLAYERS+1) return;
    if (
StrEqual(classname"witch"false) || StrEqual(classname"infected"false))
    {
        
SDKHook(entitySDKHook_OnTakeDamageOnTakeDamage);
    }
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if(!
GetConVarBool(g_enabled)) return Plugin_Handled// is this thing even on?

    
decl String:sWeapon[32], Float:mWeapon;
    
GetEdictClassname(inflictorsWeaponsizeof(sWeapon));
    
    if(
GetTrieValue(trieWeapons,sWeapon,mWeapon)) // check for the gun multiplier setting
    
{
        
damage *= mWeapon;
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;

AtomicStryker is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-07-2009 , 13:37   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#109

Quote:
Originally Posted by AtomicStryker View Post
Also, add l4d2 support? Ive looked up the Virtual adresses for you, but i have no idea about the signature
The signature you posted (the l4d1 one) looks like it will probably work. It is found in the binary, so, try it.
psychonic is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 11-07-2009 , 13:51   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
#110

Tried putting the Entity Hook behind a 0.1 Timer and checking for a valid entity -

No dice. Still causes instant crash
AtomicStryker 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 12:59.


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