Changing Weapons
#1

Alright basically my Anti-Weapon Hack has been working these days, but i have noticed some problem, When i ride a vehicle and exit the vehicle (The weapon was taken / switch somehow for no reason ) and the Anticheat bans me with the reason "" (blank). I thought this was a confliction on my other scripts, But it happened the 3rd time to me and it sucks.

Is there anyway to detect changing weapons / weapons taken away (Bullet empty) ?

EDIT:

pawn Код:
public Anticheat()
{
    new
        string[150],
        string2[150],
        weapon[13][2],
        weaponName[32]
    ;

    new ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years;

    gettime(ban_hr, ban_min, ban_sec);
    getdate(ban_years, ban_month, ban_days);
    new when[128];
    format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);

    foreach(new i : Player)
    {
        if(money_anti[i] != GetPlayerMoney(i))
        {
            ResetPlayerMoney(i);
            GivePlayerMoney(i, money_anti[i]);
        }
       
        for(new a = 0; a < 13; a++)
        {
            GetPlayerWeaponData(i, a, weapon[a][0], weapon[a][1]);
            GetWeaponName(weapon[a][0], weaponName, sizeof(weaponName));

            if(wInfo[i][wslot][a] != weapon[a][0])
            {
                format(string, sizeof(string), "[ANTICHEAT] "white"%s has been banned for Weapon Hacking: '"grey"%s"white"' by Finn (Anticheat)", GetName(i), weaponName);
                SendClientMessageToAll(COLOR_RED, string);
                format(string, sizeof(string), "» "red"Player %s (ID: %d) has been banned for Weapon Hacking %s by Finn The Anticheat, IP %s.", GetName(i), i, weaponName, User[i][accountIP]);
                if(User[i][accountLogged] == true)
                {
                    if(User[i][accountAdmin] >= 1)
                    {
                        SendClientMessage(i, COLOR_RED, string);
                    }
                }
                format(string2, sizeof(string2), "[ANTICHEAT] %s has been banned for Weapon Hacking: '%s' by Finn (Anticheat) - (BannedPlayer IP %s)", GetName(i), weaponName, User[i][accountIP]);
                Log("finn.txt", string2);
               
                ResetPlayerWeaponsEx(i);

                if(detected[i] == 0)
                {
                    format(sInfo[last_bperson], 256, "%s", GetName(i));
                    format(sInfo[last_bwho], 256, "Finn (Anticheat)");
                    sInfo[bannedac] ++;
                    savestatistics();
               
                    format(string, sizeof(string), "Weapon Hacking: %s", weaponName);
                    BanAcc(i, "Finn (AC)", string);
                    AddBan(User[i][accountIP], 1);
                    ShowBan(i, "Finn (AC)", string);
                    detected[i] = 1;
                }
                KickDelay(i);
            }
        }
    }
    return 1;
}

stock GivePlayerWeaponEx(playerid, weaponid, ammo)
{
    switch(weaponid)
    {
        case 0, 1: wInfo[playerid][wslot][0] = weaponid;
        case 2, 3, 4, 5, 6, 7, 8, 9: wInfo[playerid][wslot][1] = weaponid;
        case 22, 23, 24: wInfo[playerid][wslot][2] = weaponid;
        case 25, 26, 27: wInfo[playerid][wslot][3] = weaponid;
        case 28, 29, 32: wInfo[playerid][wslot][4] = weaponid;
        case 30, 31: wInfo[playerid][wslot][5] = weaponid;
        case 33, 34: wInfo[playerid][wslot][6] = weaponid;
        case 35, 36, 37, 38: wInfo[playerid][wslot][7] = weaponid;
        case 16, 17, 18, 39, 40: wInfo[playerid][wslot][8] = weaponid;
        case 41, 42, 43: wInfo[playerid][wslot][9] = weaponid;
        case 10, 11, 12, 13, 14, 15: wInfo[playerid][wslot][10] = weaponid;
        case 44, 45, 46: wInfo[playerid][wslot][11] = weaponid;
    }
    return GivePlayerWeapon(playerid, weaponid, ammo);
}

stock ResetPlayerWeaponsEx(playerid)
{
    for(new i=0; i<12; i++)
    {
        wInfo[playerid][wslot][i] = 0;
        wInfo[playerid][wammo][i] = 0;
    }
    ResetPlayerWeapons(playerid);
    return 1;
}
Reply
#2

Sorry if this is a few days old, but you can check if the ammo is equal to 1, and if they no longer have the weapon, then they lost it due to a bullet shortage. Such a check can go somewhere like OnPlayerWeaponShot, or OnPlayerUpdate(though not recommended).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)