AlliedModders
XFactor Servers

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


Post New Thread Reply   
 
Thread Tools Display Modes
psychonic
Veteran Member
Karma: Neutral
Old 11-06-2009 , 17:49   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #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.
__________________
HLstatsX Community Edition - http://www.hlxcommunity.com - Free stats package supporting many HL1/HL2 games and mods
psychonic is offline
Chris-_-
SourceMod Donor
Karma: Neutral
Old 11-06-2009 , 18:50   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #102

Post to see page 11
__________________
Chris-_- is online now
[AAA] Thrawn
Junior Member
Karma: Neutral
Old 11-07-2009 , 08:29   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #103

Quote:
Originally Posted by rhelgeby View Post
awesome. works! thx.
[AAA] Thrawn is online now
AtomicStryker
Veteran Member
Karma: Neutral
Location: Teutonia
Old 11-07-2009 , 09:48   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #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
[AAA] Thrawn
Junior Member
Karma: Neutral
Old 11-07-2009 , 10:10   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #105

try this:
PHP Code:
    //GetEdictClassname(inflictor, sWeapon, sizeof(sWeapon));
    
GetClientWeapon(attackersWeaponsizeof(sWeapon)); 
[AAA] Thrawn is online now
AtomicStryker
Veteran Member
Karma: Neutral
Location: Teutonia
Old 11-07-2009 , 11:27   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #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
Veteran Member
Karma: Neutral
Old 11-07-2009 , 11:59   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #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.
__________________
HLstatsX Community Edition - http://www.hlxcommunity.com - Free stats package supporting many HL1/HL2 games and mods
psychonic is offline
AtomicStryker
Veteran Member
Karma: Neutral
Location: Teutonia
Old 11-07-2009 , 13:35   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #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
Veteran Member
Karma: Neutral
Old 11-07-2009 , 14:37   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #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.
__________________
HLstatsX Community Edition - http://www.hlxcommunity.com - Free stats package supporting many HL1/HL2 games and mods
psychonic is offline
AtomicStryker
Veteran Member
Karma: Neutral
Location: Teutonia
Old 11-07-2009 , 14:51   Re: [EXTENSION] SDK Hooks 1.1 (Updated 11/03/09)
Reply With Quote #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
Reply


Thread Tools
Display Modes

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 21:43.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Theme made by Freecode Sponsored by Layered Technologies