Перейти к содержанию

SDK Hooks

ZizionarD
CSS
Авторизация  

Рекомендуемые сообщения

SDK Hooks 2.2.0


Это расширение позволяет использовать некоторые полезные функции. Необходимо при использовании некоторых модов и плагинов. Ранее расширение называлось Hacks Extension.

 

Установка:
1. Извлечь hacks.ext.dll и hacks.ext.so в папку addons/sourcemod/extensions.
2. Извлечь hacks.inc в папку addons/sourcemod/scripting/include.
3. Извлечь hacks.ext.cfg в папку addons/sourcemod/configs.

 

Спойлер

[COLOR=Red]/**
 * Hooks a virtual function.
 *
 * @param entity            Index of the entity.
 * @param type                Type of the function, see Hacks_HookType.
 * @param handler            Your function that will be called on hooking.
 * @param post                True for post operation, false for pre operation.
 * @return                HookID, that's needed to unhook.
 */[/COLOR]
native Hacks_Hook(entity, Hacks_HookType:type, Hacks_HookFunc:func, bool:post=false);

[COLOR=Red]/**
 * Unhooks a virtual function.
 *
 * @param hookid            The returned hookid from Hacks_Hook.
 * @noreturn
 */[/COLOR]
native Hacks_Unhook(hookid);

[COLOR=Red]/**
 * Scans for a function in the memory.
 *
 * @param name                Name of the function (e.g. "CBaseAnimating::Ignite").
 * @param signature            Signature to scan for (Windows). 2A = wildcard
 *                     (e.g. "56 8B 74 24 0C 83 FE FF 57 8B 7C 24 0C 74 25 8B")
 * @param symbol            Symbol to scan for (Linux).
 * @return                CallID, that's needed to call the function.
 */[/COLOR]
native Hacks_Find(const String:name[], const String:signature[], const String:symbol[]);

[COLOR=Red]/**
 * Calls a previously scanned function.
 *
 * @param entity            Index of the entity.
 * @param callid            The returned callid from Hacks_Find.
 * @param calltype            Type to call, see Hacks_CallType.
 * @param returntype            Return type, see Hacks_ReturnType.
 * @param[x] argtype            Datatype of argument, see Hacks_Param.
 * @param[y] arg            Argument for function.
 * @return                If there was a failure in the function, it will return -1,
 *                     otherwise see Hacks_ReturnType.
 */[/COLOR]
native Hacks_Call(entity, callid, Hacks_CallType:calltype, Hacks_ReturnType:returntype, any:...);

[COLOR=Red]/**
 * Calls a virtual function by its offset.
 *
 * @param entity            Index of the entity.
 * @param windows            Windows offset.
 * @param linux                Linux offset.
 * @param calltype            Type to call, see Hacks_CallType.
 * @param returntype            Return type, see  Hacks_ReturnType.
 * @param[x] argtype            Datatype of argument, see Hacks_Param.
 * @param[y] arg            Argument for function.
 * @return                If there was a failure in the function, it will return -1,
 *                     otherwise see Hacks_ReturnType.
 */[/COLOR]
native Hacks_Call_Offset(entity, windows, linux, Hacks_CallType:calltype, Hacks_ReturnType:returntype, any:...);

[COLOR=Red]/**
 * Calls a previously scanned function, but without an entity.
 *
 * @param callid            The returned callid from Hacks_Find.
 * @param returntype            Return type, see Hacks_ReturnType.
 * @param[x] argtype            Datatype of argument, see Hacks_Param.
 * @param[y] arg            Argument for function.
 * @return                If there was a failure in the function, it will return -1,
 *                     otherwise see Hacks_ReturnType.
 */[/COLOR]
native Hacks_Call_NoEntity(callid, Hacks_ReturnType:returntype, any:...);

[COLOR=Red]/**
 * Adds a file to be force downloaded (cleared every map change).
 *
 * @param ...                Each argument = One file that will be added.
 * @noreturn
 */[/COLOR]
native Hacks_AddDownload(const String:...);

[COLOR=Red]/**
 * Creates a patch that you can use with Hacks_Patch/Hacks_Unpatch
 *
 * @param callid            The returned callid from Hacks_Find.
 * @param windows_bytes            New Bytes (eg "C2 08 00")
 * @param windows_offset        Offset (addr to patch = func_addr + offset)
 * @param linux_bytes
 * @param linux_offset
 * @return                PatchID, that's needed to patch/unpatch.
 */[/COLOR]
native Hacks_CreatePatch(callid, const String:windows_bytes[], windows_offset, const String:linux_bytes[], linux_offset);

[COLOR=Red]/**
 * Writes new bytes to a given address
 *
 * @param patchid            The returned patchid from Hacks_CreatePatch.
 * @noreturn
 */[/COLOR]
native Hacks_Patch(patchid);

[COLOR=Red]/**
 * Writes the original bytes to a given address
 *
 * @param patchid            The returned patchid from Hacks_CreatePatch.
 * @noreturn
 */[/COLOR]
native Hacks_Unpatch(patchid);
Спойлер

[COLOR=Red]// Args: 0, 0, 0, 0, 0[/COLOR]
Spawn()
[COLOR=Red]// Args: inflictor, attacker, damage, hitbox, hitgroup[/COLOR]
TraceAttack(CTakeDamageInfo const&, Vector const&, CGameTrace*)
[COLOR=Red]// Args: inflictor, attacker, damage, damagetype, ammotype[/COLOR]
OnTakeDamage(CTakeDamageInfo const&)
[COLOR=Red]// Args: inflictor, attacker, damage, damagetype, ammotype[/COLOR]
Event_Killed(CTakeDamageInfo const&)
[COLOR=Red]// Args: other, 0, 0, 0, 0[/COLOR]
StartTouch(CBaseEntity*)
[COLOR=Red]// Args: other, 0, 0, 0, 0[/COLOR]
Touch(CBaseEntity*)
[COLOR=Red]// Args: other, 0, 0, 0, 0[/COLOR]
EndTouch(CBaseEntity*)
[COLOR=Red]// Args: 0, 0, 0, 0, 0[/COLOR]
UpdateOnRemove()
[COLOR=Red]// Args: weapon, 0, 0, 0, 0[/COLOR]
Weapon_CanUse(CBaseCombatWeapon*)
[COLOR=Red]// Args: weapon, 0, 0, 0, 0[/COLOR]
Weapon_Drop(CBaseCombatWeapon*, Vector const*, Vector const*)
[COLOR=Red]// Args: weapon, 0, 0, 0, 0[/COLOR]
Weapon_CanSwitchTo(CBaseCombatWeapon*)
[COLOR=Red]// Args: 0, 0, 0, 0, 0[/COLOR]
CommitSuicide()
[COLOR=Red]// Args: impulse, 0, 0, 0, 0[/COLOR]
ImpulseCommands()
[COLOR=Red]// Args: buttons, weapon, forwardmove, sidemove, upmove[/COLOR]
PlayerRunCommand(CUserCmd *ucmd, IMoveHelper *moveHelper)
Спойлер

[COLOR=Green]#include <sourcemod>
#include <hacks>[/COLOR]

[COLOR=Red]new[/COLOR] g_iCreateEntityByName;
[COLOR=Red]new[/COLOR] g_iHooks[MAXPLAYERS + [COLOR=Blue]1[/COLOR]] = { [COLOR=Blue]-1[/COLOR], ... };


[COLOR=Red]public[/COLOR] Plugin:myinfo =
{
    name = "[COLOR=Purple]Hacks Test[/COLOR]",
    author = "[COLOR=Purple]Knagg0[/COLOR]",
    description = "",
    version = "[COLOR=Purple]1.0.0.0[/COLOR]",
    url = "[COLOR=Purple]http://www.mfzb.de[/COLOR]"
};


[COLOR=Red]public[/COLOR] OnPluginStart()
{
    [COLOR=Red]// As a wildcard, you can use 2A in the signature[/COLOR]
    g_iCreateEntityByName = Hacks_Find("[COLOR=Purple]CreateEntityByName[/COLOR]", "[COLOR=Purple]56 8B 74 24 0C 83 FE FF 57 8B 7C 24 0C 74 25 8B[/COLOR]", "[COLOR=Purple]_Z18CreateEntityByNamePKci[/COLOR]");
    
    RegConsoleCmd("[COLOR=Purple]give_awp[/COLOR]", GiveAWP, "", FCVAR_GAMEDLL);
}


[COLOR=Red]public[/COLOR] OnClientPutInServer(client)
{
    g_iHooks[client] = Hacks_Hook(client, HACKS_HTYPE_WEAPON_CANUSE, Weapon_CanUse, [COLOR=Blue]false[/COLOR]);
}


[COLOR=Red]public[/COLOR] OnClientDisconnect(client)
{
    Hacks_Unhook(g_iHooks[client]);
}


[COLOR=Red]public[/COLOR] Action:GiveAWP(client, args)
{
    [COLOR=Red]new[/COLOR] iEntity = GiveNamedItem(client, "[COLOR=Purple]weapon_awp[/COLOR]", [COLOR=Blue]0[/COLOR]);
    PrintToChat(client, "[COLOR=Purple]Entity index: %d[/COLOR]", iEntity);
    
    [COLOR=Red]return[/COLOR] Plugin_Continue;
}


[COLOR=Red]public[/COLOR] Weapon_CanUse(client, weapon, dummy1, dummy2, dummy3, dummy4)
{
    [COLOR=Red]new[/COLOR] String:sBuffer[50];
    
    if(weapon != 0 && GetEdictClassname(weapon, sBuffer, sizeof(sBuffer)))
    {
        [COLOR=Red]// Can't pickup deagle[/COLOR]
        if(StrEqual("[COLOR=Purple]weapon_deagle[/COLOR]", sBuffer))
            [COLOR=Red]return[/COLOR] [COLOR=Blue]0[/COLOR];
    }
    
    [COLOR=Red]return[/COLOR] Hacks_Continue;
}


[COLOR=Red]public[/COLOR] SomeFunction(client, args)
{
    [COLOR=Red]new[/COLOR] iEntity = CreateEntityByName("[COLOR=Purple]prop_physics[/COLOR]", [COLOR=Blue]-1[/COLOR]);
    
    if(iEntity != -1)
    {
[COLOR=Red]        // Set origin, angles, model, collision...
        // Spawn...[/COLOR]
    }
}


[COLOR=Red]public[/COLOR] GiveNamedItem(client, String:name[], subtype)
{
    [COLOR=Red]return[/COLOR] Hacks_Call_Offset(client, [COLOR=Blue]329[/COLOR], [COLOR=Blue]330[/COLOR], HACKS_RTYPE_ENTITY, HACKS_PARAM_STRING, name, HACKS_PARAM_INT, subtype);
}


[COLOR=Red]public[/COLOR] CreateEntityByName(String:name[], forceindex)
{
    [COLOR=Red]return[/COLOR] Hacks_Call_NoEntity(g_iCreateEntityByName, HACKS_RTYPE_ENTITY, HACKS_PARAM_STRING, name, HACKS_PARAM_INT, forceindex);
}

  • Добавил
  • Добавлено
    17.08.2018
  • Категория
  • Создатель
    Неизвестно
  • Совместимость
    All

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
Свободное место

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!

Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.

Войти
Авторизация  

×