[DEV] Gamerules Hax
This is a very basic plugin that adds a native to get the pointer address for g_pGameRules. This allows you to load/store things to an arbitrary offset from that address.
Example usage (Thanks to GoD-Tony for finding it)
Changing score in CS:S
Spoiler
Currently this only supports DOD:S, GarrysMod (whatever version runs on OB engine) CS:S, TF2, and HL2MP. Other games can be added upon request. Just let me know which game.
Install:
gameruleshax.games.txt -> addons/sourcemod/gamedata
gameruleshax.smx -> addons/sourcemod/plugins
For compiling a seperate plugin gameruleshax.inc -> addons/sourcemod/scripting/include
Example usage (Thanks to GoD-Tony for finding it)
Changing score in CS:S
Spoiler
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <gameruleshax>
new Address:ctscoreaddr;
new Address:tscoreaddr;
public OnPluginStart()
{
RegConsoleCmd("setct", SetCtScore);
RegConsoleCmd("sett", SetTScore);
}
public OnMapStart()
{
new Address:addr = GetGameRulesPtr();
ctscoreaddr =&n bsp;addr+Address:656;//Hard coded offset since im lazy, but gamedata should be used
tscoreaddr = addr+Address:658;
}
public Action:SetCtScore(client, args)
{
if(args != 1)
{
ReplyToCommand(client, "Fix your command you");
}
new S tring:buffer[5];
GetCmdArgString(buffer, sizeof(buffer));
new value = StringToInt(buffer);
new old = LoadFromAddress(ctscoreaddr, NumberType_Int16); //Get the score
StoreToAddress(ctscoreaddr, value, NumberType_Int16); //Set the score
PrintToServer("Set team score for ct to %i was %i", value, old);
SetTeamScore(3, value); //Set the score here too so it takes effect now rather than after a scoreboard update.
}
public Action:SetTScore(client, args)
{
if(args != 1)
{
ReplyToCommand(client, "Fix your comman d you");
}
new String:buffer[5];
GetCmdArgString(buffer, sizeof(buffer));
new value = StringToInt(buffer);
new old = LoadFromAddress(tscoreaddr, NumberType_Int16);
StoreToAddress(tscoreaddr, value, NumberType_Int16);
Print ToServer("Set team score for t to %i was %i", value, old);
SetTeamScore(2, value);
}
Currently this only supports DOD:S, GarrysMod (whatever version runs on OB engine) CS:S, TF2, and HL2MP. Other games can be added upon request. Just let me know which game.
Install:
gameruleshax.games.txt -> addons/sourcemod/gamedata
gameruleshax.smx -> addons/sourcemod/plugins
For compiling a seperate plugin gameruleshax.inc -> addons/sourcemod/scripting/include
Orignal From: [DEV] Gamerules Hax
Post a Comment