Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

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


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 476
  • Lokalizacja:AMXX.PL
Offline

Napisano 19.04.2012 21:51

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 Dołączona grafika gameruleshax.games.txt (641 Bytes) Dołączona grafika gameruleshax.inc (218 Bytes) Dołączona grafika Get Plugin or Get Source (gameruleshax.sp - 1.3 KB)

Wyświetl pełny artykuł




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych