SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 12/07/2015, 05:53 AM   #1
bartiss122
Little Clucker
 
Join Date: Mar 2015
Posts: 5
Reputation: 1
Default Anti Money Hack - bartiss122 aka Vortex

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
bartiss122 is offline   Reply With Quote
Old 12/07/2015, 06:02 AM   #2
Tamer
High-roller
 
Tamer's Avatar
 
Join Date: Nov 2011
Location: Turkey
Posts: 1,101
Reputation: 172
Default Re: Anti Money Hack - bartiss122 aka Vortex

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.
__________________
The three stages of truth:

- Ridicule.
- Violent opposition.
- Acceptance.


Quote:
The greatest hypnotist on the planet Earth is an oblong box in the corner of the room. It is constantly telling us what to believe is real. If you can persuade people that what they see with their eyes is what there is to see you've got them. you know because they'll laugh in your face of an explanation that portrays the biggest picture of what's happening... and they have.
Tamer is offline   Reply With Quote
Old 12/07/2015, 06:20 AM   #3
bartiss122
Little Clucker
 
Join Date: Mar 2015
Posts: 5
Reputation: 1
Default Re: Anti Money Hack - bartiss122 aka Vortex

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.
bartiss122 is offline   Reply With Quote
Old 12/07/2015, 06:25 AM   #4
Calgon
Banned
 
Join Date: Jan 2009
Posts: 6,134
Reputation: 1127
Default Re: Anti Money Hack - bartiss122 aka Vortex

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: http://forum.sa-mp.com/showthread.php?t=71136
Calgon is offline   Reply With Quote
Old 12/07/2015, 05:52 PM   #5
Tamer
High-roller
 
Tamer's Avatar
 
Join Date: Nov 2011
Location: Turkey
Posts: 1,101
Reputation: 172
Default Re: Anti Money Hack - bartiss122 aka Vortex

If you're coding an AC you can't just do it "basic".
__________________
The three stages of truth:

- Ridicule.
- Violent opposition.
- Acceptance.


Quote:
The greatest hypnotist on the planet Earth is an oblong box in the corner of the room. It is constantly telling us what to believe is real. If you can persuade people that what they see with their eyes is what there is to see you've got them. you know because they'll laugh in your face of an explanation that portrays the biggest picture of what's happening... and they have.
Tamer 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
Loading Money Messup by Norn's Anti Money Hack JaKe Elite Scripting Help 0 18/05/2012 11:23 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


All times are GMT. The time now is 09:35 PM.


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