Raised This Month: $7 Target: $400
 1% 

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 05-16-2016 , 14:29   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #451

Quote:
Originally Posted by kralkop View Post
How to install this to my cs go server?
https://wiki.alliedmods.net/Managing...g_an_extension
sneaK is offline
Despirator
Senior Member
Join Date: Jun 2011
Location: Kazakhstan ->Shymkent
Old 05-19-2016 , 14:15   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #452

How can I hook virtual function CGameMovement::OnJump(float). Please help. Should I use CreateInterface for that?
Despirator is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-19-2016 , 15:39   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #453

Quote:
Originally Posted by Despirator View Post
How can I hook virtual function CGameMovement::OnJump(float). Please help. Should I use CreateInterface for that?
The IGameMovement pointer isn't exposed as an interface. You'd need to use custom gamedata for it, using Address gamedata with "@g_pGameMovement" (?) symbol for OS's where symbols are available (usually Linux and Mac) and a byte signature with offset and a read to get it on others (Windows).
psychonic is offline
dz.
Junior Member
Join Date: May 2016
Old 05-20-2016 , 11:55   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #454

i have an error:

Quote:
[SM] Plugin encountered error 25: Call was aborted
[SM] Native "SetFailState" reported: Failed to get CreateInterface
[SM] Displaying call stack trace for plugin "dhooks-test.smx":
[SM] [0] Line 99, C:\Users\\Desktop\sourcemad\addons\sourcemod\ scripting\dhooks-test.sp::OnPluginStart()
I google it, but I didn't find any solution why this is happening. I use the latest DHooks Linux version. Tried to reinstall, but it didn't fix the problem.

(My server working great even with this error. I just want my logs were clean. )
dz. is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-20-2016 , 15:07   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #455

Quote:
Originally Posted by dz. View Post
i have an error:



I google it, but I didn't find any solution why this is happening. I use the latest DHooks Linux version. Tried to reinstall, but it didn't fix the problem.

(My server working great even with this error. I just want my logs were clean. )
Remove the test plugin. It's not required for the extension to function and does not have gamedata for your game.
psychonic is offline
dz.
Junior Member
Join Date: May 2016
Old 05-20-2016 , 15:31   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #456

Quote:
Originally Posted by psychonic View Post
Remove the test plugin. It's not required for the extension to function and does not have gamedata for your game.
It works, thanks!
dz. is offline
Despirator
Senior Member
Join Date: Jun 2011
Location: Kazakhstan ->Shymkent
Old 05-20-2016 , 16:30   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #457

Quote:
Originally Posted by psychonic View Post
The IGameMovement pointer isn't exposed as an interface. You'd need to use custom gamedata for it, using Address gamedata with "@g_pGameMovement" (?) symbol for OS's where symbols are available (usually Linux and Mac) and a byte signature with offset and a read to get it on others (Windows).
It's difficult for me so I did by another way using SetAnimation

Here's code if someone need it. It's for detecting player jump in HL2 MP


PHP Code:
enum PLAYER_ANIM
{
    
PLAYER_IDLE,
    
PLAYER_WALK,
    
PLAYER_JUMP,
    
PLAYER_SUPERJUMP,
    
PLAYER_DIE,
    
PLAYER_ATTACK1,
    
PLAYER_IN_VEHICLE,
    
PLAYER_RELOAD,
    
PLAYER_START_AIMING,
    
PLAYER_LEAVE_AIMING     
}

new 
Handle:g_hPlayerSetAnim;

public 
OnPluginStart()
{
    new 
Handle:g_hGameConfig LoadGameConfigFile("hl2_jump.games");
    new 
iOffset GameConfGetOffset(g_hGameConfig"SetAnimation");
    if (
iOffset == -1)
    {
        
SetFailState("Offset for SetAnimation is not found in the gamedata!");
        return;
    }
    
g_hPlayerSetAnim DHookCreate(iOffsetHookType_EntityReturnType_VoidThisPointer_CBaseEntityDHooks_OnPlayerSetAnimation);
    if (
g_hPlayerSetAnim == INVALID_HANDLE)
    {
        
SetFailState("[DHooks] Could not create SetAnimation hook function!");
        return;
    }
    
DHookAddParam(g_hPlayerSetAnimHookParamType_Int);
    
CloseHandle(g_hGameConfig);
}

public 
OnClientPutInServer(client)
{
    
DHookEntity(g_hPlayerSetAnimtrueclient);
}

public 
MRESReturn:DHooks_OnPlayerSetAnimation(clientHandle:hParams)
{
    new 
PLAYER_ANIM:animation DHookGetParam(hParams1);
    if (
animation == PLAYER_JUMP)
    {
        
// As this function is called before jump velocity apply we need a frame delay
        
CreateTimer(0.0Timer_PlayerJumpGetClientSerial(client));
    }
    return 
MRES_Ignored;
}

public 
Action:Timer_PlayerJump(Handle:timerany:serial)
{
    new 
client GetClientFromSerial(serial);
    if (!
client)
    {
        return;
    }
    
    
// Code stuff for the jumped player

Despirator is offline
Despirator
Senior Member
Join Date: Jun 2011
Location: Kazakhstan ->Shymkent
Old 05-21-2016 , 15:35   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #458

Quote:
Originally Posted by psychonic View Post
The IGameMovement pointer isn't exposed as an interface. You'd need to use custom gamedata for it, using Address gamedata with "@g_pGameMovement" (?) symbol for OS's where symbols are available (usually Linux and Mac) and a byte signature with offset and a read to get it on others (Windows).
Anyway I should know how to do this. So psychonic could you be so kind to make a thread about explanation of this or point to the thread if it exists?
Despirator is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 06-26-2016 , 13:39   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #459

Update. Fixed using thrownativeerror outside of natives. This is for SM 1.8 and thus any version newer than hg93 requires SM 1.8 or newer.
Dr!fter is offline
xXDeathreusXx
Veteran Member
Join Date: Mar 2013
Location: pPlayer->GetOrigin();
Old 06-29-2016 , 16:52   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #460

Quote:
Originally Posted by Despirator View Post
Anyway I should know how to do this. So psychonic could you be so kind to make a thread about explanation of this or point to the thread if it exists?
In the Snippet's and Tutorials section, everything you need is stickied
__________________
Plugins|Profile
Requests closed

I'm a smartass by nature, get used to it
xXDeathreusXx 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 03:39.


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