SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 06/09/2009, 04:13 PM   #1
indy-greg
Little Clucker
 
Join Date: Jan 2009
Posts: 22
Reputation: 0
Default Anti-Cheat Bug Help

This anti cheat seems to have a bug that i need ironing out with the help from you guys/girls.

I dont get any errors and it does work when a player has any weapon they get banned.

BUT for some reason when a player joins when someone has cheated and got banned, they are banned. I'm still a beginner at scripting so im not sure whats wrong. Please help me out.

pawn Code:
forward timer();
public timer()
{
    for(new a=0; a<MAX_PLAYERS; a++)
    {
        if(IsPlayerConnected(a))
 {
    if(IsPlayerInAnyVehicle(a))
   {

            }
            else if(GetPlayerWeapon(a) >= 1)
            {
                GetPlayerName(a,pname,MAX_PLAYER_NAME);
                SendClientMessage(a,COLOR_RED,"You have been banned for weapon Cheats!");
                Ban(a);
                format(string,sizeof(string),"Player %s has been banned for using Cheats",pname);
                SendClientMessageToAll(COLOR_RED,string);
                return 1;
            }
            else
            {
                new Float:armour;
                GetPlayerArmour(a, armour);
                if(armour > 0.0)
                {
                  SendClientMessage(a, COLOR_RED, "Armour is not allowed on this server");
                    GetPlayerName(a, pname, MAX_PLAYER_NAME);
                    Ban(a);
                    format(string,sizeof(string),"Player %s has been banned for Armour Cheats",pname);
                    SendClientMessageToAll(COLOR_RED,string);
                }
            }
        }
    }
    return 1;
}
indy-greg is offline  
Old 06/09/2009, 04:16 PM   #2
indy-greg
Little Clucker
 
Join Date: Jan 2009
Posts: 22
Reputation: 0
Default Re: Anti-Cheat Bug Help

Sorry. forget this reply. Did it by accident. :@
indy-greg is offline  
Old 06/09/2009, 04:19 PM   #3
Joe Staff
High-roller
 
Joe Staff's Avatar
 
Join Date: Aug 2007
Posts: 2,821
Reputation: 344
Default Re: Anti-Cheat Bug Help

if(GetPlayerWeapon(a) >= 1)


If any player has a weapon that's on the WeaponID list higher than the brass knuckles (i.e. every weapon bust fists) the player gets banned?
__________________
Evil triumphs when good men do nothing.
Joe Staff is offline  
Old 06/09/2009, 04:33 PM   #4
indy-greg
Little Clucker
 
Join Date: Jan 2009
Posts: 22
Reputation: 0
Default Re: Anti-Cheat Bug Help

No thats not the problem. Ive had it before without >= 1 and it still did the same thing.

Player Cheats = Gets Banned

Player joins after someone got banned = Gets Banned

indy-greg is offline  
Old 06/09/2009, 08:36 PM   #5
yeswecanchange09
Little Clucker
 
Join Date: Sep 2009
Posts: 16
Reputation: 0
Default Re: Anti-Cheat Bug Help

pawn Code:
public timer()
{
    for(new a=0; a<MAX_PLAYERS; a++)
    {
        if(IsPlayerConnected(a))
        {
            new Float:armour;
            GetPlayerArmour(a, armour);
           
            if(IsPlayerInAnyVehicle(a))
            {

            }
            else if(GetPlayerWeapon(a) >= 1)
            {
                GetPlayerName(a,pname,MAX_PLAYER_NAME);
                SendClientMessage(a,COLOR_RED,"You have been banned for weapon Cheats!");
                Ban(a);

                format(string,sizeof(string),"Player %s has been banned for using Cheats",pname);
                SendClientMessageToAll(COLOR_RED,string);
                return 1;
            }
            else if(armour > 0.0)
            {
                SendClientMessage(a, COLOR_RED, "Armour is not allowed on this server");
                GetPlayerName(a, pname, MAX_PLAYER_NAME);
                Ban(a);
                   
                format(string,sizeof(string),"Player %s has been banned for Armour Cheats",pname);
                SendClientMessageToAll(COLOR_RED,string);
            }
        }
    }
    return 1;
}
yeswecanchange09 is offline  
Old 06/09/2009, 08:44 PM   #6
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,239
Reputation: 13
Default Re: Anti-Cheat Bug Help

A little more optimized

pawn Code:
forward timer();
public timer()
{
    for(new a=0; a<MAX_PLAYERS; a++)
    {
        if(!IsPlayerConnected(a)) continue;
        if(!IsPlayerInAnyVehicle(a)) continue;

        if(GetPlayerWeapon(a) >= 1)
        {
            GetPlayerName(a,pname,MAX_PLAYER_NAME);
            SendClientMessage(a,COLOR_RED,"You have been banned for weapon Cheats!");
            Ban(a);

            format(string,sizeof(string),"Player %s has been banned for using Cheats",pname);
            SendClientMessageToAll(COLOR_RED,string);
            continue;
        }
       
        new Float:armour;
        GetPlayerArmour(a, armour);
       
        if(armour > 0.0)
        {
            SendClientMessage(a, COLOR_RED, "Armour is not allowed on this server");
            GetPlayerName(a, pname, MAX_PLAYER_NAME);
            Ban(a);

            format(string,sizeof(string),"Player %s has been banned for Armour Cheats",pname);
            SendClientMessageToAll(COLOR_RED,string);
        }
    }
    return 1;
}
dice7 is offline  
Old 07/09/2009, 03:25 AM   #7
Joe Staff
High-roller
 
Joe Staff's Avatar
 
Join Date: Aug 2007
Posts: 2,821
Reputation: 344
Default Re: Anti-Cheat Bug Help

You guys don't seem to understand
pawn Code:
if(GetPlayerWeapon(a) >= 1)
{
  //ban code
}

GetPlayerWeapon gives you the weapon's ID, the only weapon that is weaponid '0' is the 'fists' weapon, or no weapon. So if you have ANY weapon, that above code will succeed and perform the ban code.
__________________
Evil triumphs when good men do nothing.
Joe Staff is offline  
Old 07/09/2009, 05:11 PM   #8
indy-greg
Little Clucker
 
Join Date: Jan 2009
Posts: 22
Reputation: 0
Default Re: Anti-Cheat Bug Help

Quote:
Originally Posted by dice7
A little more optimized

pawn Code:
forward timer();
public timer()
{
    for(new a=0; a<MAX_PLAYERS; a++)
    {
        if(!IsPlayerConnected(a)) continue;
        if(!IsPlayerInAnyVehicle(a)) continue;

        if(GetPlayerWeapon(a) >= 1)
        {
            GetPlayerName(a,pname,MAX_PLAYER_NAME);
            SendClientMessage(a,COLOR_RED,"You have been banned for weapon Cheats!");
            Ban(a);

            format(string,sizeof(string),"Player %s has been banned for using Cheats",pname);
            SendClientMessageToAll(COLOR_RED,string);
            continue;
        }
       
        new Float:armour;
        GetPlayerArmour(a, armour);
       
        if(armour > 0.0)
        {
            SendClientMessage(a, COLOR_RED, "Armour is not allowed on this server");
            GetPlayerName(a, pname, MAX_PLAYER_NAME);
            Ban(a);

            format(string,sizeof(string),"Player %s has been banned for Armour Cheats",pname);
            SendClientMessageToAll(COLOR_RED,string);
        }
    }
    return 1;
}
That one doesnt seem to work at all now
indy-greg is offline  
Old 07/09/2009, 05:35 PM   #9
indy-greg
Little Clucker
 
Join Date: Jan 2009
Posts: 22
Reputation: 0
Default Re: Anti-Cheat Bug Help

Quote:
Originally Posted by Joe Staff
You guys don't seem to understand
pawn Code:
if(GetPlayerWeapon(a) >= 1)
{
  //ban code
}

GetPlayerWeapon gives you the weapon's ID, the only weapon that is weaponid '0' is the 'fists' weapon, or no weapon. So if you have ANY weapon, that above code will succeed and perform the ban code.
I dont get you. Are you saying thats a good thing or a bad thing?
indy-greg is offline  
Old 07/09/2009, 06:43 PM   #10
Ironboy500
Huge Clucker
 
Join Date: Jul 2009
Posts: 289
Reputation: 0
Default Re: Anti-Cheat Bug Help

Nice anti cheats, I will try to work on my server too.
Ironboy500 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [INC] Anti Money Cheat, Anti Ban Weapon FreshKilla Includes 28 11/08/2014 03:05 PM
[FilterScript] [FS] Gun Anti-Cheat by me DizeL-ZR- Filterscripts 5 14/02/2010 10:07 AM
Anti Cheat bluray Help Archive 1 19/01/2010 11:38 AM
Help|Anti Cheat Fredy_Cole Help Archive 2 27/09/2009 07:20 PM


All times are GMT. The time now is 04:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.