Anti Weapon Hacks, Flooding Chat
#1

Hey guys, When someone weapon hacks, or false alarm. It sends messages, one after another.

Could you take a look at code, please, and fix?

pawn Код:
public PeterAC()
{
    new weaponid, ammo;
    new plname[64], string[256];
    new y, m, d;
    new h,mi,s;
    getdate(y,m,d);
    gettime(h,mi,s);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            GetPlayerName(i, plname, sizeof(plname));
            if(AntiWeaponHack == 1)
            {
                if (PlayerGotSpottedRecently[i] == 0)
                {
                    if(ScriptWeaponsUpdated[i] == 0)
                    {
                        for (new c = 0; c < 13; c++)
                        {
                            GetPlayerWeaponData(i, c, weaponid, ammo);
                            if (weaponid != 0 && ammo != 0)
                            {
                                if (ScriptWeapons[i][c] != weaponid)
                                {
                                    new weapon[24]; GetWeaponName(weaponid, weapon, 24);
                                    GetPlayerName(i, plname, sizeof(plname));

                                    format(string, sizeof(string), "[AC]: %s (%d) Is possibly Using Weapon Hacks; Use /spec and check him!", plname, i);
                                    SendAdminMessage(COLOR_YELLOW, string);
                                }
                            }
                        }
                    }
                }
            }
Reply
#2

Never send messages inside a loop.
Reply
#3

This is from ravens AC right?
Reply
#4

Yep, what best way am I to re do this?
Reply
#5

pawn Код:
public PeterAC()
{
    new weaponid, ammo;
    new plname[64], string[256];
    new y, m, d;
    new h,mi,s;
    getdate(y,m,d);
    gettime(h,mi,s);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            GetPlayerName(i, plname, sizeof(plname));
            if(AntiWeaponHack == 1)
            {
                if (PlayerGotSpottedRecently[i] == 0)
                {
                    if(ScriptWeaponsUpdated[i] == 0)
                    {
                        for (new c = 0; c < 13; c++)
                        {
                            GetPlayerWeaponData(i, c, weaponid, ammo);
                            if (weaponid != 0 && ammo != 0)
                            {
                                if (ScriptWeapons[i][c] != weaponid)
                                {
                                    new weapon[24]; GetWeaponName(weaponid, weapon, 24);
                                    GetPlayerName(i, plname, sizeof(plname));

                                    format(string, sizeof(string), "[AC]: %s (%d) Is possibly Using Weapon Hacks; Use /spec and check him!", plname, i);
                                    SendAdminMessage(COLOR_YELLOW, string);
                                    return 1;
                                }
                            }
                        }
                    }
                }
            }
Reply
#6

Quote:
Originally Posted by Randy More
Посмотреть сообщение
pawn Код:
public PeterAC()
{
    new weaponid, ammo;
    new plname[64], string[256];
    new y, m, d;
    new h,mi,s;
    getdate(y,m,d);
    gettime(h,mi,s);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            GetPlayerName(i, plname, sizeof(plname));
            if(AntiWeaponHack == 1)
            {
                if (PlayerGotSpottedRecently[i] == 0)
                {
                    if(ScriptWeaponsUpdated[i] == 0)
                    {
                        for (new c = 0; c < 13; c++)
                        {
                            GetPlayerWeaponData(i, c, weaponid, ammo);
                            if (weaponid != 0 && ammo != 0)
                            {
                                if (ScriptWeapons[i][c] != weaponid)
                                {
                                    new weapon[24]; GetWeaponName(weaponid, weapon, 24);
                                    GetPlayerName(i, plname, sizeof(plname));

                                    format(string, sizeof(string), "[AC]: %s (%d) Is possibly Using Weapon Hacks; Use /spec and check him!", plname, i);
                                    SendAdminMessage(COLOR_YELLOW, string);
                                    return 1;
                                }
                            }
                        }
                    }
                }
            }
Still spams chat :/
Reply
#7

You should just ditch this and rewrite a new anti cheat system from scratch by yourself. The stock ravens AC is just a mess.

We ended up writing our own on my server. No spam, and it works better.
Reply
#8

Quote:
Originally Posted by Kreyg
Посмотреть сообщение
You should just ditch this and rewrite a new anti cheat system from scratch by yourself. The stock ravens AC is just a mess.

We ended up writing our own on my server. No spam, and it works better.
Actually, I have just started that, I'm still having trouble with the 25-30 player mark, the server goes boom. If you know issue, could you inbox me it please?

+Rep.
Reply
#9

Quote:
Originally Posted by UnknownGamer
Посмотреть сообщение
Still spams chat :/
You could break the loop when you've found the cheater anyway, as there's no need to check through the rest of the weapons.


Like this:
pawn Код:
for (new c = 0; c < 13; c++)
{
    GetPlayerWeaponData(i, c, weaponid, ammo);
    if (weaponid != 0 && ammo != 0)
    {
        if (ScriptWeapons[i][c] != weaponid)
        {
            new weapon[24]; GetWeaponName(weaponid, weapon, 24);
            GetPlayerName(i, plname, sizeof(plname));

            format(string, sizeof(string), "[AC]: %s (%d) Is possibly Using Weapon Hacks; Use /spec and check him!", plname, i);
            SendAdminMessage(COLOR_YELLOW, string);
            break;
        }
    }
}
Reply
#10

Quote:
Originally Posted by LarzI
Посмотреть сообщение
You could break the loop when you've found the cheater anyway, as there's no need to check through the rest of the weapons.


Like this:
pawn Код:
for (new c = 0; c < 13; c++)
{
    GetPlayerWeaponData(i, c, weaponid, ammo);
    if (weaponid != 0 && ammo != 0)
    {
        if (ScriptWeapons[i][c] != weaponid)
        {
            new weapon[24]; GetWeaponName(weaponid, weapon, 24);
            GetPlayerName(i, plname, sizeof(plname));

            format(string, sizeof(string), "[AC]: %s (%d) Is possibly Using Weapon Hacks; Use /spec and check him!", plname, i);
            SendAdminMessage(COLOR_YELLOW, string);
            break;
        }
    }
}
That still spams....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)