SA-MP Forums Archive
+rep! Anti Money hack kicks innoncents! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: +rep! Anti Money hack kicks innoncents! (/showthread.php?tid=319917)



+rep! Anti Money hack kicks innoncents! - PawnoQ - 20.02.2012

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


Re: +rep! Anti Money hack kicks innoncents! - chrism11 - 20.02.2012

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);
}



Re: +rep! Anti Money hack kicks innoncents! - PawnoQ - 20.02.2012

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


Re: +rep! Anti Money hack kicks innoncents! - chrism11 - 20.02.2012

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


Re: +rep! Anti Money hack kicks innoncents! - PawnoQ - 20.02.2012

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?


Re: +rep! Anti Money hack kicks innoncents! - chrism11 - 20.02.2012

um
instead of using the timer just put it under

OnPlayerMoneyChange(playerid, oldmoney, newmoney)


Re: +rep! Anti Money hack kicks innoncents! - PawnoQ - 20.02.2012

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


Re: +rep! Anti Money hack kicks innoncents! - chrism11 - 20.02.2012

thanks