Trying to fix anticheat.
#1

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?
Reply
#2

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
Reply
#3

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.
Reply
#4

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)
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)