[Tutorial] Anti Money Hack - bartiss122 aka Vortex
#1

Welcome to this site bartiss122 aka Vortex. Certainly in the handbooks already noticed the kind of pseudo-tutorial on anti money hack.
Today I will try to explain it all to you.
So to do:

Table:
  • introduction
  • Variable and code
introduction
Anti Money Hack is very necessary for servers SA: MP. It is in order to protect our server from spawning money, it is usually made on the basis of saving money in some variable of type: New Cash [MAX_PLAYERS].

Variable and code
So, yes, we begin our work, for starters, you need to write at the top of the script a_samp include:

Code:
#include <a_samp> //The main Library SA:MP
Then the variable we include where the player will be safe in my case it will be Checkout:
Code:
new Cash[MAX_PLAYERS]; //We create a variable
I did variable now what? We have to somehow hack or something. To this should be the following code:
Code:
public OnPlayerUpdate(playerid)
{
    if(Cash[playerid] != GetPlayerMoney(playerid)) //Check if the variable Ticket has the same value as cash.
    {
        Kick(playerid); // Kick function that will be called when a player will not have as much cash.
    }
    return 1;
}
Okay, so the code looks like this:
Code:
#include <a_samp> //The main Library SA:MP

new Cash[MAX_PLAYERS]; //We create a variable

public OnPlayerUpdate(playerid)
{
    if(Cash[playerid] != GetPlayerMoney(playerid)) //Check if the variable Ticket has the same value as cash.
    {
        Kick(playerid); // Kick function that will be called when a player will not have as much cash.
    }
    return 1;
}
Of course I do not recommend giving cash now using GivePlayerMoney, only by:
Code:
GivePlayerMoney(playerid, amount);
Cash[playerid] += amount;
Here you have a function that will be the same as giveplayermoney, but under our script:
Code:
stock GivePlayerCash(playerid, amount)
{
	GivePlayerMoney(playerid, amount);
	Cash[playerid] += amount;
	return 1;
}
Application:
Code:
GivePlayerCash(playerid, 100);
I did Anti Money Hack
Reply
#2

Using OPU for money checks will give a lot of false positives.

You could have hooked GivePlayerMoney so people don't need to rename their functions.

If the server did ResetPlayerMoney then the player would get kicked, you didn't cover that part.

Using world objects such as sprunk etc. would get the player kicked even though the player wouldn't have hacked money to the game.
Reply
#3

This is a simple script. I wanted to help someone. I know there are sprunki like. But there is no function for this only allowed objects to do so. So this is the basic code.
Reply
#4

Quote:
Originally Posted by bartiss122
View Post
This is a simple script. I wanted to help someone. I know there are sprunki like. But there is no function for this only allowed objects to do so. So this is the basic code.
If it's basic code you shouldn't be punishing people for your code mistakes (kicking them), instead just resetting their money value instead.

Here's a better tutorial: https://sampforum.blast.hk/showthread.php?tid=71136
Reply
#5

If you're coding an AC you can't just do it "basic".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)