+rep! Anti Money hack kicks innoncents!
#1

hi,

i use the include by BigEti. (source: https://sampforum.blast.hk/showthread.php?tid=280549)
But if i make the anti money hack like this it detects cheated money but it also kicks a lot of non cheaters!
Can someone tell me what to adjust here?
Or if u dont know then please tell me or link me to some other effective anti money hack codes.

thx in advance!

pawn Код:
enum AC_Infos
{
    AC_Money,
    bool:AC_MoneySync,
};
new AC_Info[MAX_PLAYERS][AC_Infos];


public OnPlayerDisconnect(playerid, reason)
{
    AC_Info[playerid][AC_Money] = 0;
    AC_Info[playerid][AC_MoneySync] = false;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    AC_Info[playerid][AC_MoneySync] = true;
    return 1;
}

public OnPlayerMoneyChange(playerid, oldmoney, newmoney)
{
    if(newmoney < 0)
    {
        ResetPlayerMoney(playerid);
        GiveMoney(playerid,oldmoney);
        SendClientMessageToAll(0xFF0000FF,"Kick due money hack!");
        Kick(playerid);
    }
    else if(AC_Info[playerid][AC_MoneySync])
    {
        if(AC_Info[playerid][AC_Money] > newmoney) AC_Info[playerid][AC_Money] = newmoney;
        else if(AC_Info[playerid][AC_Money] < newmoney)
        {
            ResetPlayerMoney(playerid);
            GiveMoney(playerid,oldmoney);
            SendClientMessageToAll(0xFF0000FF,"Kick due money hack!");
            Kick(playerid);
        }
    }
    else if(AC_Info[playerid][AC_Money] >= newmoney) AC_Info[playerid][AC_MoneySync] = true;
    return AC_Info[playerid][AC_MoneySync];
}

//I give the money like: GiveMoney(playerid,amount);

stock GiveMoney(playerid, amount)
{
    AC_Info[playerid][AC_MoneySync] = false;
    AC_Info[playerid][AC_Money] += amount;
    GivePlayerMoney(playerid,amount);
}
Hope someone can help me
Reply
#2

you have it set to kick if they loose any money?

edit nvm, well ill be looking one second and ill try to figure it out for you

where do you call onplayermoneychange?

All you need to do is

Код:
forward MoneyHackCheck(playerid);
public MoneyHackCheck(playerid)//maybe a timer every 5 seconds or 1 w.e u prefer
{
	if(AC_Info[playerid][AC_Money] != GetPlayerMoney(playerid))
	{
	    SendClientMessageToAll(0xFF0000FF,"Kicked due to money hack!");
	    GiveMoney(playerid,AC_Info[playerid][AC_Money]);
     	Kick(playerid);
	}
	return 1;
}
stock GiveMoney(playerid, amount)//use this when giving money 
{
    AC_Info[playerid][AC_MoneySync] = false;
    AC_Info[playerid][AC_Money] += amount;
    GivePlayerMoney(playerid,amount);
}
Reply
#3

its a callback defined in the include by BigEti. The source is mentioned on top of my first post.
Reply
#4

try what i just posted and tell me if it works, it should work fine.
Reply
#5

thx
but wouldnt a timer also cause sync problems?
Also a player could cheat the money and then use it quickly before it is detected and resetted...
Is there another method without using this timer?
Reply
#6

um
instead of using the timer just put it under

OnPlayerMoneyChange(playerid, oldmoney, newmoney)
Reply
#7

ah ok thx
I cant try it out right now but i will post the result as soon as i did
thx, +rep
Reply
#8

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)