Moneyhack - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Moneyhack (
/showthread.php?tid=371727)
Moneyhack -
Crazyboobs - 24.08.2012
Hello.
I got a anti moneyhack include and it is working fine but the problem is if the player get stunt bonus then anti money hack will work and it will kick the player.
This is the include
pawn Код:
/****
==========================
  Money Protect v1.1  Â
==========================
Author: Jones N. Sperandio
Release date: 26/02/2010
__________________________
Description/Descriзгo
PT:
Provк proteзгo contra money hack, sem que seja preciso alterar vбrias linhas de
um script.
EN:
Provides protection against money hacking, without having to change several lines
of code. Â Â Â Â Â Â Â Â
__________________________
Notes/Notas
PT:
Caso seja usado em um filterscript, o mesmo deve conter a diretiva
#define FILTERSCRIPT, antes da diretiva #include, e o gamemode precisa ter sido
compilado com o include tambйm.
EN:
In case of a filterscript, it must contain the directive #define FILTERSCRIPT
before the #include directive, and the gamemode script must be compiled with
the include, too.
****/
#if defined __MONEY_PROTECT__
  #endinput  Â
#endif
#define __MONEY_PROTECT__
#if defined FILTERSCRIPT
  #define FUNC::%1(%2) stock %1(%2)  Â
#else
  #define FUNC::%1(%2) forward %1(%2); public %1(%2)  Â
#endif
#if !defined FILTERSCRIPT
#if !defined foreach
  #tryinclude <foreach>
#endif
#if !defined foreach
  #define foreach(%1,%2) for(new %2; %2 < MAX_PLAYERS; %2++) if(IsPlayerConnected(%2))  Â
  #define __MP_FOREACH  Â
#endif
#if !defined MP_TIMER_INTERVAL
  #define MP_TIMER_INTERVAL 500  Â
#endif
forward MoneyProtectTimer();
new
  __MP_Money[MAX_PLAYERS];  Â
static
  bool:__MP_HAS_OPC,
  bool:__MP_HAS_OMCD;
public MoneyProtectTimer()
{
  foreach(Player, playerid)
  {
    if(GetPlayerMoney(playerid) > __MP_Money[playerid])
    {
      if(__MP_HAS_OMCD)
        CallLocalFunction("OnMoneyCheatDetect", "dd", playerid, GetPlayerMoney(playerid)-__MP_Money[playerid]);
      GivePlayerMoney(playerid, __MP_Money[playerid]-GetPlayerMoney(playerid));
    }
    else
    {
      __MP_Money[playerid] = GetPlayerMoney(playerid);
    }
  }
}
public OnGameModeInit()
{
  SetTimer("MoneyProtectTimer", MP_TIMER_INTERVAL, true);
  if(funcidx("__MP_OnGameModeInit") != -1)
    CallLocalFunction("__MP_OnGameModeInit", "");
  __MP_HAS_OPC = (funcidx("__MP_OnPlayerConnect") != -1);
  __MP_HAS_OMCD = (funcidx("OnMoneyCheatDetect") != -1); Â
}
public OnPlayerConnect(playerid)
{
  __MP_ResetPlayerMoney(playerid);  Â
  if(__MP_HAS_OPC)
    CallLocalFunction("__MP_OnPlayerConnect", "d", playerid);
}
#endif
           Â
FUNC::__MP_GivePlayerMoney(playerid, amount)
{
  #if defined FILTERSCRIPT  Â
    return CallRemoteFunction("__MP_GivePlayerMoney", "dd", playerid, amount);    Â
  #else
    __MP_Money[playerid] += amount;  Â
    return GivePlayerMoney(playerid, amount);    Â
  #endif
}
           Â
FUNC::__MP_ResetPlayerMoney(playerid)
{
  #if defined FILTERSCRIPT  Â
    return CallRemoteFunction("__MP_ResetPlayerMoney", "d", playerid);    Â
  #else
    __MP_Money[playerid] = 0;  Â
    return ResetPlayerMoney(playerid);    Â
  #endif
} Â
           Â
FUNC::__MP_GetPlayerMoney(playerid)
{
  #if defined FILTERSCRIPT  Â
    return CallRemoteFunction("__MP_GetPlayerMoney", "d", playerid);    Â
  #else
    return __MP_Money[playerid];
  #endif
}
#define GivePlayerMoney __MP_GivePlayerMoney
#define ResetPlayerMoney __MP_ResetPlayerMoney
#define GetPlayerMoney __MP_GetPlayerMoney
#if defined FILTERSCRIPT
  #endinput  Â
#endif
#if defined _ALS_OnGameModeInit
  #undef OnGameModeInit
#else
  #define _ALS_OnGameModeInit
#endif
#if defined _ALS_OnPlayerConnect
  #undef OnPlayerConnect
#else
  #define _ALS_OnPlayerConnect
#endif
#define OnGameModeInit __MP_OnGameModeInit  Â
#define OnPlayerConnect __MP_OnPlayerConnect
forward OnGameModeInit();
forward OnPlayerConnect(playerid);
forward OnMoneyCheatDetect(playerid, amount);
#if defined __MP_FOREACH
  #undef foreach
  #undef __MP_FOREACH  Â
#endif
Code is
pawn Код:
#define MP_TIMER_INTERVAL 200 //set a time of 200ms for the money check
#include <moneyprotect>
public OnMoneyCheatDetect(playerid, amount)
{
 new str[128], pname[MAX_PLAYER_NAME];
 GetPlayerName(playerid, pname, sizeof pname);
 format(str, sizeof str, "%s was detected with a money hack of $%d and kicked from the server.", pname, amount);
 SendClientMessageToAll(0xDC143CAA, str);
 Kick(playerid);
 return 1;
}
How can i fix if a player get stunt bonus then he should not get kick?
Re: Moneyhack -
RelaxCafe - 24.08.2012
Well, to be honest, it can be hard to detect when a player gets awesome stunt money. But it varies from 3-500? I am not sure. Go test what the highest value you can get. Well, now if a player gains $20,000.00, that is definitely hacking. So check how much is gained and check if the player is in a vehicle. Not in a plane, I don't know about boats though.. I don't think you can get stunt bonus with boats, unless you use speed boost and the boats can fly on land..
Re: Moneyhack -
Riddick94 - 24.08.2012
pawn Код:
EnableStuntBonusForAll(false);