"re"-define BasicFonction
#1

Hi all,

Today I've think about trying to make my own little anti-cheat. This Anticheat consist in, if player (for example) use SetPlayerHealth with a cheat system, ban him. So, I've thinking about redefine this fonction, such as:

pawn Код:
#define securemoney GivePlayerMoney
#define secureweapon GivePlayerWeapon
...
As you can see, this is call the same basic fonction but with an other name, should it work?
An Exemple for securemoney:

pawn Код:
if(GivePlayerMoney(playerid, > 0))
        {
            SendClientMessage(playerid, COLOR_RED, "Vous avez йtй banni pour cheat argent");
            SendClientMessage(playerid, COLOR_RED, "Si vous pensez qu'il s'agit d'une erreur, veuillez screener cette page et poster sur notre forum");
            SendClientMessage(playerid, COLOR_RED, "PS: Il est inutile de poster si vous avez rйellement cheat argent");
            Ban(playerid);
            format(string, sizeof(string), "[R2D2]: %s a йtй banni du serveur pour cheat argent", playerid);
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            PlayerInfo[playerid][pLocked] = 1;
            return 1;
        }
The code before will ban the player if he call the basic "GivePlayerMoney" fonction, but let's see this code:

pawn Код:
if(strcmp(cmd, "/moneytest", true)==0)
{
      securemoney(playerid, 10000);
      return 1;
}
Will this code, the player will be banned or not?

Sorry but I don't know how to explain it... I think player will be banned in all examples, but I prefer to ask.






Thank's,
Sreadon.
Reply
#2

That won't even work, and when the player is cheating money, he isn't calling GivePlayerMoney or any functions. The best way to avoid players cheating money, is to simply manage all of the players money server-sided, then it is simply not possible to cheat money.
Reply
#3

Yes, he will - you have to do a new function to manage the players' cash.
As well, don't first ban the player, and then send a message that is containing his name.
Reply
#4

Thank's for your help, and your explications.

Sreadon
Reply
#5

you can hook the functions and if a function is called you can save money in a verriable but the best think is if you use a include
Reply
#6

If you define them, it won't work. If you want to simplify "GivePlayerMoney" into " securemoney " and such, then you have to use macros but remeber it won't work as a anti-cheat. For more efficient anti-cheat you have to use for exemple Float detection while flying but is hardly to acurate specialy if someone is on a building roof.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)