How is it possible ?
#1

PHP Code:
stock giveMoney(playeridamount)
{
    
Player[playerid][playerMoney] += amount;
    
ResetPlayerMoney(playerid);
    return 
GivePlayerMoney(playeridPlayer[playerid][playerMoney]);

This is my code for giving money to players. but still they can hack money like i saw one player getting $200m
in 5 or 6 scores. how is it possible and how can i prevent it ??

Helps appreciated.
Thank you.
Reply
#2

The only way to prevent that is to add a listener. If the money isn't server-sided, its money will return to the variable assigned to the player.
Reply
#3

Set a timer which checks if the value of the server-sided money matches with the GetPlayerMoney ();
Reply
#4

You may have a new function that gives server-side money but how do you get the money a player has? If you use `GetPlayerMoney`, it can return money from cheats. Use:
pawn Code:
stock getMoney(playerid)
{
    return Player[playerid][playerMoney];
}
Reply
#5

https://sampforum.blast.hk/showthread.php?tid=71136

Use this tutorial.

And import this to time like for every 5 sec..

Code:
public MoneyTimer()
{
    new username[MAX_PLAYER_NAME];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerCash(i) != GetPlayerMoney(i))
            {
                ResetMoneyBar(i);//Resets the money in the original moneybar, Do not remove!
                UpdateMoneyBar(i,GetPlayerCash(i));//Sets the money in the moneybar to the serverside cash, Do not remove!
                new hack = GetPlayerMoney(i) - GetPlayerCash(i);
                GetPlayerName(i,username,sizeof(username));
                printf("%s has picked up/attempted to spawn $%d.", username,hack);
            }
        }
    }
}
This is theme from 2009, you can improve code with foreach etc etc...
This is most importnant.
Reply
#6

I had checked every stuffs in the code and i have the things that u guys told.
Its a gamemode from scratch which is available in forums. So if hackers gets the variable i am using for giving money can they hack using that ?

Anyway its server sided money in the script and i am sure about that.
Reply
#7

Quote:
Originally Posted by Shaheen
View Post
I had checked every stuffs in the code and i have the things that u guys told.
Its a gamemode from scratch which is available in forums. So if hackers gets the variable i am using for giving money can they hack using that ?

Anyway its server sided money in the script and i am sure about that.
Do you even read my post?

if(GetPlayerCash(i) != GetPlayerMoney(i)) this is for reset
Reply
#8

dont to those stupid checks
just create variable
PHP Code:
new PlayerMoney[MAX_PLAYERS];
PlayerMoney[playerid] += 100// for adding money to player
PlayerMoney[playerid] -= 100// for taking money from player
if(PlayerMoney[playerid] < 100){ // for checking if player has enough money
     
SendClientMessage(playerid, -1"You don't have enough money for this item!");

Player doesn't have any way to change this money amount, its that simple.
And dont use GetPlayerMoney and GivePlayerMoney, because playerside can change those values.
Less timers checking every player on server, the better it is for playerbase.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)