SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 25/10/2011, 07:39 PM   #1
Elka_Blazer
Big Clucker
 
Elka_Blazer's Avatar
 
Join Date: Apr 2011
Posts: 160
Reputation: 1
Default Simple anti money hack

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

__________________
Did I help you ? well you can help me too by pressing this star(on my post)


[/COLOR]
Elka_Blazer is offline   Reply With Quote
Old 25/10/2011, 07:41 PM   #2
Max_Coldheart
Guest
 
Posts: n/a
Default Re: Simple anti money hack

Looking good !
  Reply With Quote
Old 25/10/2011, 07:41 PM   #3
FireCat
High-roller
 
FireCat's Avatar
 
Join Date: Jul 2010
Posts: 2,321
Reputation: 596
Default Re: Simple anti money hack

Looks nice (:
FireCat is offline   Reply With Quote
Old 25/10/2011, 07:42 PM   #4
System64
Gangsta
 
System64's Avatar
 
Join Date: May 2011
Location: Zadar, Croatia
Posts: 933
Reputation: 143
Default Re: Simple anti money hack

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
__________________
All my works
I left SA:MP! Maybe once I start scripting again but now I'm based on web programming
Soon, I'll buy domain system32.com.hr but for now you can contact me on LogoOff or on my ******* channel!
System64 is offline   Reply With Quote
Old 25/10/2011, 07:43 PM   #5
|_ⒾⓇⓄN_ⒹⓄG_|
Huge Clucker
 
|_ⒾⓇⓄN_ⒹⓄG_|'s Avatar
 
Join Date: Sep 2011
Posts: 318
Reputation: 27
Default Re: Simple anti money hack

cool
very useful and easy to understand
__________________
IronDog, better than a firecat.
Enjoying my ban.
|_ⒾⓇⓄN_ⒹⓄG_| is offline   Reply With Quote
Old 25/10/2011, 07:43 PM   #6
Elka_Blazer
Big Clucker
 
Elka_Blazer's Avatar
 
Join Date: Apr 2011
Posts: 160
Reputation: 1
Default Re: Simple anti money hack

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
__________________
Did I help you ? well you can help me too by pressing this star(on my post)


[/COLOR]
Elka_Blazer is offline   Reply With Quote
Old 27/10/2011, 05:52 PM   #7
American
Little Clucker
 
American's Avatar
 
Join Date: Oct 2011
Location: Bethlehem, Palestine
Posts: 27
Reputation: 0
Default Re: Simple anti money hack

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

It's close to that one.
American is offline   Reply With Quote
Old 28/10/2011, 10:02 AM   #8
lolcake
Little Clucker
 
Join Date: Jul 2011
Posts: 6
Reputation: 0
Default Re: Simple anti money hack

Code:
new Cash[MAX_PLAYERS];
if (GetPlayerMoney(playerid) > Cash[playerid])
{
SetPlayerMoney(playerid,Cash[playerid]);
}
lolcake is offline   Reply With Quote
Old 28/10/2011, 10:07 AM   #9
Jeffry
High-roller
 
Jeffry's Avatar
 
Join Date: Oct 2009
Location: Germany
Posts: 1,599
Reputation: 69
Default Re: Simple anti money hack

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
__________________
Jeffry is offline   Reply With Quote
Old 28/10/2011, 04:14 PM   #10
Elka_Blazer
Big Clucker
 
Elka_Blazer's Avatar
 
Join Date: Apr 2011
Posts: 160
Reputation: 1
Default Re: Simple anti money hack

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 ....
__________________
Did I help you ? well you can help me too by pressing this star(on my post)


[/COLOR]
Elka_Blazer is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Simple,Fast Anti-Money Hack with FilterScript support wups Includes 45 16/12/2015 10:45 AM
[FilterScript] [K.A.S] Knight's Anti Cheat (Anti: Armas, Spam, DB, MaxPing, Palavrões, Money Hack) The Knight Lançamentos/Releases 5 05/05/2011 03:41 AM
[FilterScript] [GM-ADDON] Anti Money Hack (No-Alternative-Money) ipsBruno Filterscripts 16 21/02/2011 12:36 AM
anti-money hack versus money hack impossibility(?) maij Help Archive 6 11/08/2010 01:58 AM
[Include] [INC] Money Protect v1.1 (Anti Money Hack) ashiuashiu Includes 13 15/03/2010 02:37 AM


All times are GMT. The time now is 10:07 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.