←  [RSS] Pluginy

AMXX.pl: Support AMX Mod X i SourceMod

»

[forums.alliedmods.net] [DEV] Gamerules Hax

Adminek AMXX.PL's Photo Adminek AMXX.PL 19.04.2012

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 = 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
String: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 t 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 command you");
}
new
String:buffer[5];
GetCmdArgString(buffer, sizeof(buffer));
new
value = StringToInt(buffer);
new
old = LoadFromAddress(tscoreaddr, NumberType_Int16);
StoreToAddress(tscoreaddr, value, NumberType_Int16);
PrintToServer("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

Attached Files Posted Image gameruleshax.games.txt (641 Bytes) Posted Image gameruleshax.inc (218 Bytes) Posted Image Get Plugin or Get Source (gameruleshax.sp - 1.3 KB)

Wyświetl pełny artykuł
Quote