SA-MP Forums Archive
Anti Cheat System - 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: Anti Cheat System (/showthread.php?tid=379655)



Anti Cheat System - Blackazur - 22.09.2012

How can i add a anti Heath/Armor/Godmode/Money/Airbreak System? Because my Anticheat System have only Anti-Weaponhacks.


Re: Anti Cheat System - Kyle - 22.09.2012

Search for the user cessil and check out his thread on anticheat tips.


Re: Anti Cheat System - Grimrandomer - 22.09.2012

For anti money hack, use Server Sided money.

Here is how i did it:
pawn Код:
stock ac_GivePlayerMoney(playerid, money) {
    new newmoney = (GetPVarInt(playerid, "acMoney")+money);
    SetPVarInt(playerid, "acMoney",newmoney);
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid,newmoney);
}
stock ac_GetPlayerMoney(playerid) {
    return GetPVarInt(playerid, "acMoney");
}
stock ac_SetPlayerMoney(playerid,money) {
    SetPVarInt(playerid, "acMoney", money);
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid,money);   
}
stock ac_ResetPlayerMoney(playerid) {
    SetPVarInt(playerid, "acMoney",0);
    ResetPlayerMoney(playerid);
}
stock ac_UpdatePlayerMoney(playerid) {
    if (GetPlayerMoney(playerid)!=GetPVarInt(playerid, "acMoney")) {
        ResetPlayerMoney(playerid);
        GivePlayerMoney(playerid,GetPVarInt(playerid, "acMoney")); 
    }
}
You can make:
pawn Код:
ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid,newmoney);
more efficient by giving them the difference *-1 but this works too

The only problem with server sided money is you need to make it so if they buy a car mod, their money is subtracted:

pawn Код:
new modCosts[] = {
    400,550,200,250,100,150,80,500,500,200,1000,220,250,100,400,500,200,0,350,300,250,200,150,350,50,1000,480,0,770,
    680,0,370,170,120,790,150,500,690,190,390,0,0,1000,500,500,510,710,670,530,810,620,0,0,130,210,230,520,430,620,
    720,530,180,0,0,830,850,750,250,200,550,450,0,0,1100,1030,980,1560,1620,1200,1030,900,1230,820,1560,1350,770,100,1500,150,
    650,450,100,750,350,0,0,1000,620,1140,0,940,0,0,3250,500,500,780,0,780,1610,1540,0,0,500,500,2130,2050,1000,780,
    940,0,0,780,860,0,1120,500,500,3340,500,3380,3290,500,830,800,500,500,0,580,470,870,980,150,150,100,100,490,600,890,
    1000,1090,840,910,1200,1030,1030,920,930,550,1050,1050,950,650,450,550,850,950,850,950,970,880,990,900,950,1000,900,500,500,500,
    1000,500,900,1000,2095,500,900,500,500,900,1000,900,1000,500,500
};
public OnVehicleMod(playerid, vehicleid, componentid){
  new slot = GetVehicleComponentType(componentid);
  if (slot != -1) {
    ac_GivePlayerMoney(playerid,(modCosts[componentid-1000]*-1));
  }
  return 1;
}
Casino's wont work with server sided money, and if you want to charge players for Pay 'N' Sprays, you need to check onplayerupdate if their car's health has increased, if it has and they are not in a pay 'N' spray (possible cheating) and if they are in a pay 'N' spray then charge them $100