[Tutorial] Simple anti money hack
#1

Hello ... in this tutorial im gonna teach you how to make a simple anti money cheat

Step 1 : Creating the variables



Well , we gotta define 2 variables.
1 that will hold the old money , the ammount of money before you got the money .
And 1 that will hold the new money , the ammount of money you had after you have been given by the function.

Then lets create them
On the top of your script
pawn Code:
new OldMoney[MAX_PLAYERS];
new NewMoney[MAX_PLAYERS];


Step 2 : Creating the custom function


We gotta create a function that will give they player money , without getting him banned.


pawn Code:
forward GivePlayerMoneyEx(playerid,ammount);//Forward - this is how you call a new public
public GivePlayerMoneyEx(playerid,ammount)
{
      //First the gonna have to set the OldMoney of the player , just in case .
      OldMoney[playerid] = GetPlayerMoney(playerid)//Get the money ( GetPlayerMoney ) they put it in the OldMoney var...
      //Now we gotta define the new ammount of money the player holds , we gotta do it before we give him the money , so he wont get banned / kicked .
      NewMoney[playerid] = ammount;//Putting the ammount in the NewMoney var
      //Now we gotta give the player some sweet cash
      GivePlayerMoney(playerid,ammount);//default function : )
     
      return 1;
}

Step 3 : Checking players money
Now we gotta know how much money the player has , and getting him kicked/banned.

We gotta create a timer/function, that will check every ( 2 seconds ? ) if the players money is bigger then his NewMoney

If it isnt bigger , then the player isnt hacking .
IF IT IS BIGGER , THEN THE PLAYER IS HACKING



pawn Code:
forward CheckMoney();
public CheckMoney()
{
      for(new i = 0; i < MAX_PLAYERS; I++)//This loop will check all players at one time
      {
               if(IsPlayerConnected(i))//Player is gotta be connected right ?
               {
                        if(GetPlayerMoney(i) > NewMoney[i])//Getting player's money , checking if its more then his NewMoney(means he is hacking)
                        {
                                  ResetPlayerMoney(i);//We gonna reset his money
                                  GivePlayerMoney(i,OldMoney[i]);//Give him his old money , as a punishment !
                                  Ban(i);//Kick/Ban the poor kid          
                        }
               }
      }
      return 1;
}
Step 4 : Setting the timer
Now we just gotta set a timer that will apply this public every 2 seconds ...


Under OnGameModeInIt() Or if ur using a FS its under OnFilterScriptInIt()
pawn Code:
SetTimer("CheckMoney",2000,true);//name of public,time,loop = true/yes !

And last thing you gotta do is set the NewMoney of the player when he connects the server
pawn Code:
OnPlayerConnect(playerid)
{
     NewMoney[playerid] = GetPlayerMoney(playerid);
     return 1;
}
Reputation would be GREAT !
My new easy release - SHS - Scripter Helper Script

Older releases :
URP Registration - *MODED+DIALOGS*
ADS - Advanced dialog system

Reply


Messages In This Thread
Simple anti money hack - by Elka_Blazer - 25.10.2011, 19:39
Re: Simple anti money hack - by Max_Coldheart - 25.10.2011, 19:41
Re: Simple anti money hack - by FireCat - 25.10.2011, 19:41
Re: Simple anti money hack - by System64 - 25.10.2011, 19:42
Re: Simple anti money hack - by |_ⒾⓇⓄN_ⒹⓄG_| - 25.10.2011, 19:43
Re: Simple anti money hack - by Elka_Blazer - 25.10.2011, 19:43
Re: Simple anti money hack - by American - 27.10.2011, 17:52
Re: Simple anti money hack - by lolcake - 28.10.2011, 10:02
Re: Simple anti money hack - by Jeffry - 28.10.2011, 10:07
Re: Simple anti money hack - by Elka_Blazer - 28.10.2011, 16:14
Re: Simple anti money hack - by DiamondGaming - 24.12.2017, 18:41
Re: Simple anti money hack - by Logic_ - 24.12.2017, 18:53

Forum Jump:


Users browsing this thread: 2 Guest(s)