[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



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(clientargs)
{
    if(
args != 1)
    {
        
ReplyToCommand(client"Fix your command you");
    }
    new 
S tring:buffer[5];
    
GetCmdArgString(buffersizeof(buffer));
    new 
value StringToInt(buffer);
    new 
old LoadFromAddress(ctscoreaddrNumberType_Int16); //Get the score
    
StoreToAddress(ctscoreaddrvalueNumberType_Int16); //Set the score
    
PrintToServer("Set team score for ct to %i was %i"valueold);
    
SetTeamScore(3value); //Set the score here too so it takes effect now rather than after a scoreboard update.
}
public 
Action:SetTScore(clientargs)
{
    if(
args != 1)
    {
        
ReplyToCommand(client"Fix your comman d you");
    }
    new 
String:buffer[5];
    
GetCmdArgString(buffersizeof(buffer));
    new 
value StringToInt(buffer);
    new 
old LoadFromAddress(tscoreaddrNumberType_Int16);
    
StoreToAddress(tscoreaddrvalueNumberType_Int16);
    
Print ToServer("Set team score for t to %i was %i"valueold);
    
SetTeamScore(2value);
















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















Attached Files











File Type: txt


gameruleshax.games.txt (641 Bytes)


File Type: inc


gameruleshax.inc (218 Bytes)


File Type: sp


Get Plugin or
Get Source (gameruleshax.sp - 1.3 KB)








Orignal From: [DEV] Gamerules Hax

No comments

Not a single link is allowed to submit in comment :o