SA-MP Forums Archive
[Tutorial] Simple anti money hack - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Simple anti money hack (/showthread.php?tid=292898)



Simple anti money hack - Elka_Blazer - 25.10.2011

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




Re: Simple anti money hack - Max_Coldheart - 25.10.2011

Looking good !


Re: Simple anti money hack - FireCat - 25.10.2011

Looks nice (:


Re: Simple anti money hack - System64 - 25.10.2011

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


Re: Simple anti money hack - |_ⒾⓇⓄN_ⒹⓄG_| - 25.10.2011

cool
very useful and easy to understand


Re: Simple anti money hack - Elka_Blazer - 25.10.2011

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


Re: Simple anti money hack - American - 27.10.2011

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

It's close to that one.


Re: Simple anti money hack - lolcake - 28.10.2011

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



Re: Simple anti money hack - Jeffry - 28.10.2011

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


Re: Simple anti money hack - Elka_Blazer - 28.10.2011

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 ....


Re: Simple anti money hack - DiamondGaming - 24.12.2017

ERROR


Re: Simple anti money hack - Logic_ - 24.12.2017

This is shit, develop your own.