SA-MP Forums Archive
Trying to fix anticheat. - 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: Trying to fix anticheat. (/showthread.php?tid=463222)



Trying to fix anticheat. - Don_Cage - 10.09.2013

Hello. I'm trying to fix the anticheat for my server and on the anti money hack part I found this line.
To make it easier to explain lets say GetPlayerMoney is 'O'
pawn Код:
if((GetPlayerMoney(i) - ScriptMoney[i]) >= 500 && (GetPlayerMoney(i) - ScriptMoney[i]) != 0)
If I'm correct now, this means :
if 'O' , minus the scriptmoney is equal or over 500 AND if 'O' minus scriptmoney is NOT 0.
Am I right?

If I am then can someone please explain what the he** it means cuz I got pretty confused when reading it.
I hope you can understand my explination.

EDIT: If it's called here
pawn Код:
if((GetPlayerMoney(i) - ScriptMoney[i]) >= 500 && (GetPlayerMoney(i) - ScriptMoney[i]) != 0)
                                {
                                    if(admins == 0)
                                    {
                                        format(string, sizeof(string), "%s (%d), Has been kicked by Anticheat for Possible Money Hacking.", plname, i);
                                        SendClientMessageToAll(COLOR_NICERED, string);
                                        format(string, sizeof(string), "You have Been Kicked by The Anticheat For Possible Weapon Money Hacking ($%d)",(GetPlayerMoney(i) - ScriptMoney[i]));
                                        SendClientMessage(i,COLOR_LIGHTBLUE, string);
                                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Anticheat Has Kicked %s for: Money Hacking ($%d)",d,m,y,h,mi,s,plname,(GetPlayerMoney(i) - ScriptMoney[i]));
                                        KickLog(string);
                                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Kicked by the Anticheat - Money Hacking.",d,m,y,h,mi,s,plname);
                                        AddPunishment(i, string);
                                        Kick(i);
                                    }
                                    format(string, sizeof(string), "|ERP-AC|: %s (%d) Is possibly Using Money Hacks; Use /spec and check him!", plname, i);
                                    SendAdminMessage(COLOR_YELLOW, string);
                                    PlayerSuspicious[i] = 1;
                                    PlayerMoneyHacking[i] = 1;
                                    PlayerSuspiciousMoney[i] = (GetPlayerMoney(i) - ScriptMoney[i]);
                                    PlayerGotSpottedRecently[i] = 1;
                                    SetTimerEx("ResetAcWarn", 300000, 0, "i", i);
                                }
Then shouldnt the line be
pawn Код:
if((GetPlayerMoney(i) - ScriptMoney[i]) >= 500 || (GetPlayerMoney(i) - ScriptMoney[i]) != 0)

Or am I'm just far of the wheels here?


Re: Trying to fix anticheat. - Vince - 10.09.2013

Logic works best if you substitute variables with arbitrary data.
Код:
Let GetPlayerMoney be 8000.
Let ScriptMoney be 5000

if((8000 - 5000) >= 500 && (8000 - 5000) != 0)

if(3000 >= 500 && 3000 != 0)

if(true && true)

true



Re: Trying to fix anticheat. - Don_Cage - 11.09.2013

Well I was right about that this
pawn Код:
if((GetPlayerMoney(i) - ScriptMoney[i]) >= 500 && (GetPlayerMoney(i) - ScriptMoney[i]) != 0)
Should be this
pawn Код:
if((GetPlayerMoney(i) - ScriptMoney[i]) >= 500 || (GetPlayerMoney(i) - ScriptMoney[i]) != 0)
Now my anti money cheat works.


Re: Trying to fix anticheat. - RobertK - 11.09.2013

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
pawn Код:
if((GetPlayerMoney(i) - ScriptMoney[i]) >= 500 || (GetPlayerMoney(i) - ScriptMoney[i]) != 0)
Well, there is no difference between the codes. Regardless, the player will be kicked. If it's (getPlayerMoney - ScriptMoney) is less then 500 but not 0, he will still be kicked. Might as well make it

pawn Код:
if((GetPlayerMoney(i) - ScriptMoney[i]) > 0)
OR
pawn Код:
if((GetPlayerMoney(i) - ScriptMoney[i]) != 0)



Re: Trying to fix anticheat. - Don_Cage - 11.09.2013

Yes, the code should be the same but it made a BIG differance. Thats why I was so confused when I made the topic.