Problems in SafeGivePlayerMoney function
#1

I am using server - side money. When a player dies, I want to give him his $100 back but the code is detecting it as a hack. I want to restore the player's money on death.

My code:
PHP код:
public OnGameModeInit()
{
moneychecktimer SetTimer("MoneyHackChecker"10001);
return 
1;

PHP код:
public OnPlayerConnect(playerid)
{
SafeResetPlayerMoney(playerid);
    return 
1;

PHP код:
public OnGameModeExit()
{
    
KillTimer(moneychecktimer);
    return 
1;

PHP код:
public SafeGivePlayerMoney(playeridmoney)
{
    
Player[playerid][pCash] += money;
    
ResetPlayerMoney(playerid);
    
GivePlayerMoney(playeridPlayer[playerid][pCash]);
    return 
1;
}
public 
SafeSetPlayerMoney(playeridmoney)
{
    
Player[playerid][pCash] = money;
    
ResetPlayerMoney(playerid);
    
GivePlayerMoney(playeridPlayer[playerid][pCash]);
    return 
1;
}
public 
SafeResetPlayerMoney(playerid)
{
    
Player[playerid][pCash] = 0;
    
ResetPlayerMoney(playerid);
    
GivePlayerMoney(playeridPlayer[playerid][pCash]);
    return 
1;
}
public 
SafeGetPlayerMoney(playerid// Returns the server - side cash of the player
{
    return 
Player[playerid][pCash];

PHP код:
public MoneyHackChecker() // Checks for money hack: checks if server - side and client - side money is equal or not and warns the user
{
    new 
name[MAX_PLAYER_NAME];
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if((
SafeGetPlayerMoney(i) != GetPlayerMoney(i)))
            {
                new 
hackamount GetPlayerMoney(i) - SafeGetPlayerMoney(i);
                
                
name GetName(i);
                
printf("%s has used money hack for $%d."namehackamount);
                
ResetPlayerMoney(i); // Resets the money in the original moneybar, Do not remove!
                
GivePlayerMoney(iSafeGetPlayerMoney(i)); // Sets the money in the moneybar to the serverside cash, Do not remove!
                
GameTextForPlayer(i"~r~Hacking is not allowed. It may result in permanent ban."8001);
            }
        }
    }
    return 
1;

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
SafeGivePlayerMoney(playerid100);
    return 
1;

Reply
#2

you don't need anti money hacking systems, you have a server sided variable as a player's cash, so it cannot be changed by client.
Reply
#3

Do you know any way to check that? I mean how can I check that a player cannot use money hack?
Reply
#4

Quote:
Originally Posted by JaskaranSingh
Посмотреть сообщение
Do you know any way to check that? I mean how can I check that a player cannot use money hack?
Then try to hack it yourself !

Year ago or so, i was active on server where money hackers sometimes gave away 999999999, but i like to collect money as I do.
Few times i asked some admin to delete dirty cash but sometimes i didnt find any admins online so i needed to do admin work for myself and I created a money hack program to zero my cash
Strange is that the money value is always on the same memory address...
Reply
#5

Quote:
Originally Posted by JaskaranSingh
Посмотреть сообщение
Do you know any way to check that? I mean how can I check that a player cannot use money hack?
get one of these hacks players never can change server's variables and you're using one of these server variables as player's cash. so it never gonna be hacked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)