Raised This Month: $51 Target: $400
 12% 

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
linuxvpsuser
Junior Member
Join Date: Jun 2015
Old 07-08-2015 , 19:38   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #341

this is for some one who extension not loading

create empty file

dhooks.autoload

and upload to addons/sourcemod/extensions

restart srv

sm exts list

and see working extension
linuxvpsuser is offline
Send a message via Skype™ to linuxvpsuser
psychonic

BAFFLED
Join Date: May 2008
Old 07-08-2015 , 20:00   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #342

Quote:
Originally Posted by linuxvpsuser View Post
this is for some one who extension not loading

create empty file

dhooks.autoload

and upload to addons/sourcemod/extensions

restart srv

sm exts list

and see working extension
There is absolutely no reason to create an autoload file for DHooks. If any plugin that uses it is loaded, the extension will load. If there are no plugins that use it, it won't load (because there is no reason for it to do so).
psychonic is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-10-2015 , 05:28   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #343

Drifter, do you mind if I package dhooks with my download for my give named item hook plugin?
__________________
Neuro Toxin is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 07-10-2015 , 15:31   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #344

Quote:
Originally Posted by Neuro Toxin View Post
Drifter, do you mind if I package dhooks with my download for my give named item hook plugin?
I dont really care, however packaging extensions into plugins is usually not great since then people that download the plugin arent guaranteed to have the latest version of the extension and you also then have the burden of making sure its the latest in the plugin zip. I would just direct link to the downloads page, but thats just me.
Dr!fter is offline
pcmaster
AlliedModders Donor
Join Date: Sep 2009
Old 07-25-2015 , 08:09   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #345

Not quite a plugin issue (afaik), but I got problems hooking CCSPlayer::RemoveAllItems(bool).

My code:
Code:
public void OnPluginStart()
{
    [...]  
    // hooks
    Handle hConfig = LoadGameConfigFile("noknife.games");
    if(hConfig == null)
    {
        LogError("Unable to load gameconf: noknife.games");
        return;
    }
    
    int iOffset = GameConfGetOffset(hConfig, "CCSPlayer::RemoveAllItems");
    if(iOffset == -1)
    {
        CloseHandle(hConfig);
        LogError("Unable to get offset for CCSPlayer::RemoveAllItems");
        return;
    }
     
    CloseHandle(hConfig);
        
    g_hHook = DHookCreate(iOffset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, OnRemoveAllWeapons);
    
    if(g_hHook == INVALID_HANDLE)
    {
        LogError("Unable to hook CCSPlayer::RemoveAllItems(bool)");
        return;
    }
    
    DHookAddParam(g_hHook, HookParamType_Bool, 1, DHookPass_ByVal);
    
    for(int i = 0; i < MaxClients; i++)
    {
        if(!IsValidClient(i)) continue;
        DHookEntity(g_hHook, true, i);
    }
[...]

public MRESReturn OnRemoveAllWeapons(int pThis, Handle hParams)
{
    if(!IsValidClient(pThis)) return MRES_Ignored;
    LogMessage("OnRemoveAllWeapons() called | pThis: %d (%N) | hParams[1]: %d", pThis, pThis, DHookGetParam(hParams, 1));
    if(g_bHideKnife[pThis]) return MRES_Ignored;
    LogMessage("Stopping call of RemoveAllWeapons() for %N (%d)", pThis, pThis);
    return MRES_Supercede;
}

Hook is also activated in OnClientPutInServer.

Gamedata:
Code:
"Games"
{    
    "csgo"
    {
        "Offsets"
        {
            "CCSPlayer::RemoveAllItems"
            {
                "windows"    "382"
                "linux"        "383"
                "mac"        "383"
            }
        }
    }
}
It actually prints out this in the log:
Quote:
L 07/25/2015 - 14:04:09: [noknife.smx] OnRemoveAllWeapons() called | pThis: 29 (name1) | hParams[1]: 1
L 07/25/2015 - 14:04:28: [noknife.smx] OnRemoveAllWeapons() called | pThis: 18 (name2) | hParams[1]: 1
L 07/25/2015 - 14:04:28: [noknife.smx] Stopping call of RemoveAllWeapons() for name2(1
L 07/25/2015 - 14:04:29: [noknife.smx] OnRemoveAllWeapons() called | pThis: 4 (name3) | hParams[1]: 1
L 07/25/2015 - 14:04:29: [noknife.smx] Stopping call of RemoveAllWeapons() for name3 (4)
But knives/weapons are still missing. My aim is to have knives/pistols on every surf map, as some of them are stripping all your slots of.
Am I hooking the wrong function or something else wrong?
__________________
Stopped hosting servers as of November 2018, no longer active around here.
pcmaster is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 07-25-2015 , 15:58   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #346

Quote:
Originally Posted by pcmaster View Post
Not quite a plugin issue (afaik), but I got problems hooking CCSPlayer::RemoveAllItems(bool).

My code:
Code:
public void OnPluginStart()
{
    [...]  
    // hooks
    Handle hConfig = LoadGameConfigFile("noknife.games");
    if(hConfig == null)
    {
        LogError("Unable to load gameconf: noknife.games");
        return;
    }
    
    int iOffset = GameConfGetOffset(hConfig, "CCSPlayer::RemoveAllItems");
    if(iOffset == -1)
    {
        CloseHandle(hConfig);
        LogError("Unable to get offset for CCSPlayer::RemoveAllItems");
        return;
    }
     
    CloseHandle(hConfig);
        
    g_hHook = DHookCreate(iOffset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, OnRemoveAllWeapons);
    
    if(g_hHook == INVALID_HANDLE)
    {
        LogError("Unable to hook CCSPlayer::RemoveAllItems(bool)");
        return;
    }
    
    DHookAddParam(g_hHook, HookParamType_Bool, 1, DHookPass_ByVal);
    
    for(int i = 0; i < MaxClients; i++)
    {
        if(!IsValidClient(i)) continue;
        DHookEntity(g_hHook, true, i);
    }
[...]

public MRESReturn OnRemoveAllWeapons(int pThis, Handle hParams)
{
    if(!IsValidClient(pThis)) return MRES_Ignored;
    LogMessage("OnRemoveAllWeapons() called | pThis: %d (%N) | hParams[1]: %d", pThis, pThis, DHookGetParam(hParams, 1));
    if(g_bHideKnife[pThis]) return MRES_Ignored;
    LogMessage("Stopping call of RemoveAllWeapons() for %N (%d)", pThis, pThis);
    return MRES_Supercede;
}

Hook is also activated in OnClientPutInServer.

Gamedata:
Code:
"Games"
{    
    "csgo"
    {
        "Offsets"
        {
            "CCSPlayer::RemoveAllItems"
            {
                "windows"    "382"
                "linux"        "383"
                "mac"        "383"
            }
        }
    }
}
It actually prints out this in the log:


But knives/weapons are still missing. My aim is to have knives/pistols on every surf map, as some of them are stripping all your slots of.
Am I hooking the wrong function or something else wrong?
you are using a post hook
Dr!fter is offline
pcmaster
AlliedModders Donor
Join Date: Sep 2009
Old 07-26-2015 , 06:52   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #347

Sadly, even changing the second parameter to false (so it's a pre-hook), doesn't prevent the server from removing all items..
__________________
Stopped hosting servers as of November 2018, no longer active around here.
pcmaster is offline
SOBgaming
Senior Member
Join Date: Jul 2015
Old 07-26-2015 , 09:13   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #348

Can this work without GiveNamedItemEx since this plugin is not authorized by valve?
__________________
SOBgaming is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 07-26-2015 , 10:28   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #349

Quote:
Originally Posted by pcmaster View Post
Sadly, even changing the second parameter to false (so it's a pre-hook), doesn't prevent the server from removing all items..
Then you might be hooking the wrong function.

Quote:
Originally Posted by SOBgaming View Post
Can this work without GiveNamedItemEx since this plugin is not authorized by valve?
what?
Dr!fter is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-26-2015 , 17:14   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #350

Quote:
Originally Posted by SOBgaming View Post
Can this work without GiveNamedItemEx since this plugin is not authorized by valve?
Lol!!!

1st. You got it the wrong way around. GNI uses this extension.
2nd. GNI on it's own merit if fine. Does Valve authorise plugins now... lol
__________________

Last edited by Neuro Toxin; 07-26-2015 at 17:27.
Neuro Toxin is offline
Reply



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 05:07.


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