Can the milliseconds difference between timers affect something?
#1

So, My question is:

I have this anti cheat for moneyhack, jetpack, etc..
It checks every 30 seconds,

It works like this:

/giveplayermoney is now in a public called giveplayercash

public giveplayercash looks like this:

pawn Код:
forward GivePlayerCash(playerid, Amoney);
public GivePlayerCash(playerid, Amoney)
{
    realmoney[playerid] = realmoney[playerid] + Amoney;
    GivePlayerMoney(playerid, Amoney);
    return 1;
}
The public CheckMoney checks if realmoney[playerid] is equel to GetPlayerMoney

If it is, there is no problem.. but.
WHAT if it checks in the middle of the give player money?

so like this:

pawn Код:
forward GivePlayerCash(playerid, Amoney);
public GivePlayerCash(playerid, Amoney)
{
    money[playerid] = money[playerid] + Amoney;
       //PUBLIC CHECKMONEY STARTS CHECKING HERE BY BAD LUCK?
    GivePlayerMoney(playerid, Amoney);
    return 1;
}
Will that give false warnings/bans?
or is the time between
pawn Код:
money[playerid] = balbalba
and
pawn Код:
GivePlayerMoney
too small for this?
just curious
Reply
#2

God, all those things you're worrying about for nothing. It takes less than a nanosecond to execute a statement.
Reply
#3

PAWN is single threaded, but I'm not sure if that affects whole callbacks. If someone could clarify for me that'd be appreciated.

Also, use

money[playerid] += Amoney;

And convert the public to a stock function or macro.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
God, all those things you're worrying about for nothing. It takes less than a nanosecond to execute a statement.
well not for nothing, I did not know how long it took and I don't want false bans etc.

anyway thanks...

about this:

[pawn]
realmoney[playerid] += Amoney;

And convert the public to a stock function or macro.


1. why += and not ==


2. Why convert it to a stock?
Reply
#5

+= means 'add x to the variable'. It just looks better than "var = var + 1". I'm not sure if there's any performance difference.

Because 'public' is generally used for callbacks, not functions. Unless you want to call it from filterscripts.
Reply
#6

Quote:
Originally Posted by MP2
Посмотреть сообщение
PAWN is single threaded, but I'm not sure if that affects whole callbacks. If someone could clarify for me that'd be appreciated.
PAWN is single threaded, this means that only one thing is executed at each given time.
If your money check timer runs out while something else is executing it is delayed until the previous action is completed.

In short (answer to your question): "No"
Reply
#7

So, there's absolutley no chance of it? Are you sure the threading isn't just per-function?
Reply
#8

Quote:
Originally Posted by MP2
Посмотреть сообщение
So, there's absolutley no chance of it? Are you sure the threading isn't just per-function?
I am 100% sure.
Reply
#9

Yep, script is executed line by line, a timer is only executed after the currently running function is finished. No chance that a function is suspended for a timer.
Reply
#10

Okay. It's just that I used to have a problem with my AC, with it wrongfully banning players, guess it was another problem though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)