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

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
Mitchell
~lick~
Join Date: Mar 2010
Old 08-26-2016 , 21:33   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #491

I have similar code for the player_weaponstrip fix, however i never finished it:
Attached Files
File Type: sp Get Plugin or Get Source (player_weaponstrip.sp - 161 views - 2.3 KB)
Mitchell is offline
lemonpzone
Junior Member
Join Date: Aug 2016
Old 08-28-2016 , 15:35   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #492

I installed this extenstion , i dont know if do it well , i donwloaded the last version from here http://users.alliedmods.net/~drifter/builds/dhooks/2.0/ than i uploaded the files in my server , and i got this error

L 08/28/2016 - 15:15:07: [SM] Unable to load extension "dhooks.ext": /home/servers/csgo/csgo-12/csgo/addons/sourcemod/extensions/dhooks.ext.so: cannot open shared object file: No such file or directory
lemonpzone is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 08-31-2016 , 12:01   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #493

Updated. I fixed a bunch of issues related to objects. You can now change parameters on functions that have objects before it would have very likely crashed. Updated the test plugin to use new flags that are sometimes needed for objects. As this required lots of changes, the version number is now 2.1.0.
https://users.alliedmods.net/~drifte...ds/dhooks/2.1/

Quote:
Originally Posted by lemonpzone View Post
I installed this extenstion , i dont know if do it well , i donwloaded the last version from here http://users.alliedmods.net/~drifter/builds/dhooks/2.0/ than i uploaded the files in my server , and i got this error

L 08/28/2016 - 15:15:07: [SM] Unable to load extension "dhooks.ext": /home/servers/csgo/csgo-12/csgo/addons/sourcemod/extensions/dhooks.ext.so: cannot open shared object file: No such file or directory
As it says no such file or directory make sure you actually uploaded the extension and the right version for your server.

Last edited by Dr!fter; 08-31-2016 at 12:02.
Dr!fter is offline
ImACow
AlliedModders Donor
Join Date: Feb 2015
Old 08-31-2016 , 13:38   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #494

Is there any knows issues with this ?
I'm able to hook a function, it works for a couple of maps and quits working after a while.

?
Cow.
__________________
ImACow is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 08-31-2016 , 13:43   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #495

What function. That has been reported before I remember looking into but could never reproduce the issue.

Edit:
There is a few things you can try. Removing the hook on map change for example, and then re hooking. Adding a removal callback and making sure its not getting removed somewhere.

Last edited by Dr!fter; 08-31-2016 at 13:45.
Dr!fter is offline
ImACow
AlliedModders Donor
Join Date: Feb 2015
Old 09-06-2016 , 10:08   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #496

Added removal callback & rehooking on those.
PHP Code:
public void OnMapStart()
{
    
//Hook Gamerules function in map start
    
DHookGamerules(g_hCanEntityBeUsePushedfalse,Hook_Removed);

PHP Code:
public void Hook_Removed(int hookid)
{
    
LogFile("Hook %i got removed",hookid);
    
LogFile("reHooked %i",DHookGamerules(g_hCanEntityBeUsePushedfalse,Hook_Removed));

its "rehooking" them, but still quits working after some time until I reload the plugin.

HTML Code:
06/09/2016 - 14:21:44 [CanEntityBePushed] Hook 91 got removed
06/09/2016 - 14:21:44 [CanEntityBePushed] reHooked 73
06/09/2016 - 14:42:56 [CanEntityBePushed] Hook 73 got removed
06/09/2016 - 14:42:56 [CanEntityBePushed] reHooked 73
06/09/2016 - 15:04:43 [CanEntityBePushed] Hook 72 got removed
06/09/2016 - 15:04:43 [CanEntityBePushed] reHooked 72
06/09/2016 - 15:04:48 [CanEntityBePushed] Hook 73 got removed
06/09/2016 - 15:04:48 [CanEntityBePushed] reHooked 73
06/09/2016 - 15:41:28 [CanEntityBePushed] Hook 73 got removed
06/09/2016 - 15:41:28 [CanEntityBePushed] reHooked 73
__________________
ImACow is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 09-06-2016 , 11:09   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #497

This doesn't really make sense since all this does is forward the hook to plugins. The actual hooking is handled by sourcehook. The only way this doesn't work is if the hook isn't being fired by sourcehook or the callback isn't called, but i don't see how that is possible. Does it start to work after again? like one map it doesn't next it works again? Also i need code to see/test. How many map changes till it stops working?

Edit:
I actually finally remembered what the issue was before and fixed the issue when someone else reported it. What version are you running?

Also looking at the log, something weird happened

06/09/2016 - 14:21:44 [CanEntityBePushed] reHooked 73
06/09/2016 - 14:42:56 [CanEntityBePushed] Hook 73 got removed
06/09/2016 - 14:42:56 [CanEntityBePushed] reHooked 73
06/09/2016 - 15:04:43 [CanEntityBePushed] Hook 72 got removed
06/09/2016 - 15:04:43 [CanEntityBePushed] reHooked 72

the id was 73 then it removed 72...

Last edited by Dr!fter; 09-06-2016 at 11:19.
Dr!fter is offline
Crowii
Member
Join Date: Nov 2015
Location: England.
Old 09-11-2016 , 17:20   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #498

alwaysweaponskins.smx (Always Weapon Skins): Required extension "dhooks" file("dhooks.ext") not running

Any advice?

Last edited by Crowii; 09-12-2016 at 11:23.
Crowii is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 09-15-2016 , 08:48   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #499

Install the extension?
Potato Uno is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 09-18-2016 , 11:23   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #500

I've tried to recreate this MetaMod: Source plugin in SourcePawn with the use of DHooks, this is my attempt:

Code:
#include <sourcemod>
#include <dhooks>

#pragma newdecls required
#pragma semicolon 1

#define PLUGIN_VERSION "1.0"

// dhooks
Handle gH_SetDataRate = null;

// convars
ConVar gCV_Rate = null;
float gF_Rate = 224000.0;

public Plugin myinfo =
{
	name = "CS:GO Rate Forcer",
	author = "shavit",
	description = "Supposedly fixes high choke%% for CS:GO.",
	version = PLUGIN_VERSION,
	url = "https://github.com/shavitush"
}

public void OnPluginStart()
{
	Handle hGameData = LoadGameConfigFile("csgorates.games");

	if(hGameData != null)
	{
		gH_SetDataRate = DHookCreate(GameConfGetOffset(hGameData, "SetDataRate"), HookType_Entity, ReturnType_Float, ThisPointer_Ignore, DHook_SetDataRate);
	}

	else
	{
		SetFailState("Can't load gamedata/csgorates.games.txt");
	}

	delete hGameData;

	ConVar cvMinrate = FindConVar("sv_minrate");
	cvMinrate.SetBounds(ConVarBound_Upper, false);
	cvMinrate.FloatValue = 140800.0;

	ConVar cvMaxrate = FindConVar("sv_maxrate");
	cvMaxrate.SetBounds(ConVarBound_Upper, false);
	cvMaxrate.FloatValue = 307200.0;

	CreateConVar("csgorates_version", PLUGIN_VERSION, "Plugin version.", FCVAR_DONTRECORD|FCVAR_NOTIFY);

	gCV_Rate = CreateConVar("csgorates_rate", "224000.0", "Rates to force on players.\nDecrease this value if internet usage is very high!", 0, true, 140800.0, true, 307200.0);
	gCV_Rate.AddChangeHook(OnConVarChanged);

	AutoExecConfig();

	for(int i = 1; i <= MaxClients; i++)
	{
		if(IsClientConnected(i) && IsClientInGame(i))
		{
			OnClientPutInServer(i);
		}
	}
}

public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
	gF_Rate = StringToFloat(newValue);
}

public void OnClientPutInServer(int client)
{
	if(IsFakeClient(client))
	{
		return;
	}

	if(gH_SetDataRate != null)
	{
		DHookEntity(gH_SetDataRate, true, client);

		PrintToServer("hooked %N", client);
	}
}

public MRESReturn DHook_SetDataRate(Handle hReturn)
{
	DHookSetReturn(hReturn, view_as<float>(gF_Rate));
	PrintToServer("rate %f", gF_Rate);

	return MRES_Override;
}
Gamedata:
Code:
"Games"
{
	"csgo"
	{
		"Offsets"
		{
			"SetDataRate"
			{
				"windows"	"28"
				"linux"		"29"
				"mac"		"29"
			}
		}
	}
}
This gets called:
Code:
PrintToServer("hooked %N", client);
But this never gets called:
Code:
PrintToServer("rate %f", gF_Rate);
And I noticed that the changes I tried to apply didn't take effect at all as status still reports 128000 rate.

Am I not using hooking correctly? Can anyone guide me please or at least tell me what's wrong?
__________________
retired

Last edited by shavit; 09-18-2016 at 11:35. Reason: accidentally removed gamedata, added back
shavit 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 15:31.


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