Ham_Killed & TFC

For scripting examples for learning how to use AMXX.
User avatar
Archive-Poster
Posts: 1367
Gender:
United States of America

Ham_Killed & TFC

Post by Archive-Poster »

Hi,

Since hooking CBasePlayer::Killed with Ham_Killed makes TFC(Team Fortress Classic) hang/crash under windows, here is an alternative way using Orpheu which works incase someone out there would need it.

JSON file:

Code: Select all

{
    "name"      : "Killed",
    "class"     : "CBasePlayer",
    "library"   : "mod",
    "arguments" : 
    [
        {
            "type" : "entvars_s *"
        },
        {
            "type" : "entvars_s *"
        },
        {
            "type" : "int"
        }
    ],
    "indexes" : 
    [
        {
            "os"    : "windows",
            "mod"   : "tfc",
            "value" : 14
        },
        {
            "os"    : "linux",
            "mod"   : "tfc",
            "value" : 16
        }
    ]
} 
Test plugin:

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <orpheu>

public plugin_init()
{
    new OrpheuFunction:Player_Killed = OrpheuGetFunctionFromClass("player","Killed", "CBasePlayer" ) 
    OrpheuRegisterHook(Player_Killed,"Killed",OrpheuHookPre) 
}

public Killed(idvictim,idattacker,shouldgib)
{
    new victim[32],attacker[32]
    get_user_name(idvictim, victim, 31)     
    get_user_name(idattacker, attacker, 31) 
    
    client_print(0,print_chat,"%s was killed by %s",victim,attacker)
} 

Who is online

Users browsing this forum: No registered users and 1 guest