AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   SDK Hooks 2.1 - Updated 2011-9-10 (https://forums.alliedmods.net/showthread.php?t=106748)

psychonic 11-06-2009 16:49

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
Quote:

Originally Posted by AtomicStryker (Post 982453)
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.


Chris-_- 11-06-2009 17:50

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
Post to see page 11

Thrawn2 11-07-2009 07:29

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
Quote:

Originally Posted by rhelgeby (Post 981081)

awesome. works! thx.

AtomicStryker 11-07-2009 08:48

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
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.

Thrawn2 11-07-2009 09:10

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
try this:
PHP Code:

    //GetEdictClassname(inflictor, sWeapon, sizeof(sWeapon));
    
GetClientWeapon(attackersWeaponsizeof(sWeapon)); 


AtomicStryker 11-07-2009 10:27

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
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"
            
}
        }
    } 


psychonic 11-07-2009 10:59

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
Quote:

Originally Posted by [AAA] Thrawn (Post 983081)
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.

AtomicStryker 11-07-2009 12:35

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
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;



psychonic 11-07-2009 13:37

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
Quote:

Originally Posted by AtomicStryker (Post 983126)
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.

AtomicStryker 11-07-2009 13:51

Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
 
Tried putting the Entity Hook behind a 0.1 Timer and checking for a valid entity -

No dice. Still causes instant crash


All times are GMT -4. The time now is 17:48.

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