25.10.2011, 19:39
Hello ... in this tutorial im gonna teach you how to make a simple anti money cheat ![Cheesy](images/smilies/biggrin.png)
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![Huh?](images/smilies/confused.gif)
On the top of your script
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
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()
And last thing you gotta do is set the NewMoney of the player when he connects the server
Reputation would be GREAT !
My new easy release - SHS - Scripter Helper Script
Older releases :
URP Registration - *MODED+DIALOGS*
ADS - Advanced dialog system
![Cheesy](images/smilies/biggrin.png)
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
![Huh?](images/smilies/confused.gif)
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.
Step 3 : Checking players moneyWe 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;
}
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;
}
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;
}
My new easy release - SHS - Scripter Helper Script
Older releases :
URP Registration - *MODED+DIALOGS*
ADS - Advanced dialog system