[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
#2

Looking good !
Reply
#3

Looks nice (:
Reply
#4

if(GetPlayerMoney(i) > NewMoney[i])//Getting player's money , checking if it equals to his NewMoney

I don't think that > is equal?

There is one better here :P
Reply
#5

cool
very useful and easy to understand
Reply
#6

Quote:
Originally Posted by System64
View Post
if(GetPlayerMoney(i) > NewMoney[i])//Getting player's money , checking if it equals to his NewMoney

I don't think that > is equal?

There is one better here :P

Ohh will edit that TY
Reply
#7

http://forum.sa-mp.com/showthread.ph...er+Sided+Money

It's close to that one.
Reply
#8

Code:
new Cash[MAX_PLAYERS];
if (GetPlayerMoney(playerid) > Cash[playerid])
{
SetPlayerMoney(playerid,Cash[playerid]);
}
Reply
#9

You know that you won't be able to gamble in the casino?
Winning any money will get you banned.

Also the stunting bonuses have to be disabled then, else you get banned after stunting.

But the TUT has a good structure. You might think about these problems.

Jeffry
Reply
#10

Quote:
Originally Posted by Jeffry
View Post
You know that you won't be able to gamble in the casino?
Winning any money will get you banned.

Also the stunting bonuses have to be disabled then, else you get banned after stunting.

But the TUT has a good structure. You might think about these problems.

Jeffry
Hmm true but thats why i called it simple .
Also sorry for that cuz im use to RP servers ....
Reply
#11

ERROR
Reply
#12

This is shit, develop your own.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)