Weapon anticheat.
#5

Easy, look you use OnPlayerUpdate(playerid)
So mine is like this, It's kinda simple and easy

pawn Код:
new WeaponHacking[MAX_PLAYERS];

    //Under OnPlayerUpdate
    //Anti Weapon Hack
    if(GetPlayerWeapon(playerid) == 1 || GetPlayerWeapon(playerid) == 2 || GetPlayerWeapon(playerid) == 5 || GetPlayerWeapon(playerid) == 6 || GetPlayerWeapon(playerid) == 7 || GetPlayerWeapon(playerid) == 8 || GetPlayerWeapon(playerid) == 10 || GetPlayerWeapon(playerid) == 11 || GetPlayerWeapon(playerid) == 12 || GetPlayerWeapon(playerid) == 13 ) //Put here the IDs of weapons you want, I'll post link after pawn.
    {
      if(PlayerInfo[playerid][pAdmin] < 10)
      {
           WeaponHacking[playerid] =1;
           CheatsDetected(playerid);
           return 1;
        }
    }
    if(GetPlayerWeapon(playerid) == 14 || GetPlayerWeapon(playerid) == 15 || GetPlayerWeapon(playerid) == 17 || GetPlayerWeapon(playerid) == 35 || GetPlayerWeapon(playerid) == 38 || GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 41 || GetPlayerWeapon(playerid) == 42 || GetPlayerWeapon(playerid) == 43 || GetPlayerWeapon(playerid) == 44 || GetPlayerWeapon(playerid) == 45)
    {
      if(PlayerInfo[playerid][pAdmin] < 10)
      {
           WeaponHacking[playerid] =1;
           CheatsDetected(playerid);
           return 1;
        }
    }
    //OTHER CODES

//Now lets go to the stock CheatsDetected
//Stock CheatsDeteceed
stock CheatsDetected(playerid)
{
   new string[128];
   if(WeaponHacking[playerid] == 1)
   {
      new pName[MAX_PLAYER_NAME];
      GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
      format(string,sizeof(string),"[ANTI CHEAT] Anti-Cheat has banned %s(%d). [Reason: Cheats Detected]",pName,playerid);
      SendClientMessageToAll(COLOR_PINK,string);

      format(string,sizeof(string),"1[ANTI CHEAT] Anti-Cheat has banned %s(%d). [Reason: Cheats Detected]",pName,playerid);
      IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
      IRC_GroupSay(gGroupID,IRC_ADMINCHANNEL,string);

      format(string, sizeof(string), "~r~BANNED!");
      GameTextForPlayer(playerid, string, 3000, 1);

      new INI:File = INI_Open(UserPath(playerid));
      INI_SetTag(File,"Player's Data");
      INI_WriteString(File,"BanReason","Cheats Detected");
      INI_WriteString(File,"Reason","Weapon Hacks");
      INI_Close(File);
      PlayerInfo[playerid][pBanned] =1;

      SetTimerEx("KickPlayer",1000,false,"i",playerid);
      return 1;
  }
 return 1;
}

//In o.3x Kick(playerid); has proirity over all codes, so you have to make a timer for it
//like this so it posts all the codes needed before the kick

forward KickPlayer(ID);
public KickPlayer(ID)
{
     Kick(ID);
     return 1;
}

//Now lets come to OnPlayerConnect part
//So I'm using Y_INI as you see
if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        if(PlayerInfo[playerid][pBanned] == 1)
        {
          format(string,sizeof(string),"[BANNED] You are currently banned from the server. [Reason: %s]",PlayerInfo[playerid][pBanReason]);
          SendClientMessage(playerid, COLOR_RED,string);
          SendClientMessage(playerid, COLOR_RED,"[BANNED] Please Ban Appeal on our forums at www.SERVER.net");
          SetTimerEx("KickPlayer",1000,false,"i",playerid);
          return 1;
        }
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{FF0000}SERVER","{FFFFFF}Welcome back to the server! \n Type your password below to login.","Login","Quit");
    }
Here you go, Weapons IDs: https://sampwiki.blast.hk/wiki/Weapons
If I helped please +rep
Reply


Messages In This Thread
Weapon anticheat. - by lQs - 09.07.2013, 13:45
Re: Weapon anticheat. - by Jimmy0wns - 09.07.2013, 13:47
Re: Weapon anticheat. - by Cjgogo - 09.07.2013, 13:55
Re: Weapon anticheat. - by lQs - 09.07.2013, 14:02
Re: Weapon anticheat. - by Vanter - 09.07.2013, 15:10

Forum Jump:


Users browsing this thread: 1 Guest(s)