What's wrong?
#1

With this code:

Код:
#include <a_samp>
#include <dini>

//AntiCheat
new timer1;

public OnGameModeInit()
{
    timer1 = SetTimer("AntiCheat",5000,true);
    return 1;
}

forward AntiCheat();
public AntiCheat()
{
                new weap, ammo;
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                if(IsPlayerConnected(i))
                {
                GetPlayerWeaponData(i, 7, weap, ammo);
                if(weap == 38)
                {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "%s has been banned. (Reason: AUTO BAN Minigun Cheat)", pName);
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "Auto Ban - Minigun");
                new File:bFile = fopen("autobans.log", io_append);
                if(bFile)
                {
                fwrite(bFile, "AUTOBANS");
                }
                fclose(bFile);
                }
                break;
                }
                GetPlayerWeaponData(i, 7, weap, ammo);
                if(weap == 35)
                {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "%s has been banned (Reason: AUTO BAN Rocket launcher Cheat)", pName);
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "Auto Ban - Rocket Launcher");
                new File:bFile = fopen("autobans.log", io_append);
                if(bFile)
                {
                fwrite(bFile, "AUTOBANS");
                }
                fclose(bFile);
                }
                break;
                }

                public OnGameModeExit()
                {
                KillTimer(timer1);
                return 1;
                }
Reply
#2

Why don't you tell us?

What errors/warnings are you getting? Is it not working?

You cannot honestly expect us to instantly understand what you are talking about.
Reply
#3

This are the errors:

Код:
C:\Documents and Settings\Symone\Desktop\anrpg.pwn(58) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Symone\Desktop\anrpg.pwn(58) : error 004: function "OnGameModeExit" is not implemented
C:\Documents and Settings\Symone\Desktop\anrpg.pwn(63) : error 030: compound statement not closed at the end of file (started at line 16)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
This small anticheat autoban who have rpg/minigun and write bans in autobans.log file.
Reply
#4

If I told you indenting wouldn't hurt, would you believe me?

pawn Код:
#include <a_samp>
#include <dini>

//AntiCheat
new timer1;

public OnGameModeInit()
{
    timer1 = SetTimer("AntiCheat",5000,true);
    return 1;
}

forward AntiCheat();
public AntiCheat()
{
    new weap, ammo;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerWeaponData(i, 7, weap, ammo);
            if(weap == 38)
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "%s has been banned. (Reason: AUTO BAN Minigun Cheat)", pName);
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "Auto Ban - Minigun");
                new File:bFile = fopen("autobans.log", io_append);
                if(bFile)
                {
                    fwrite(bFile, "AUTOBANS");
                }
                fclose(bFile);
            }
            break;
        }
        GetPlayerWeaponData(i, 7, weap, ammo);
        if(weap == 35)
        {
            new string [128];
            new pName[MAX_PLAYER_NAME];
            GetPlayerName(i, pName, sizeof(pName));
            format(string, sizeof(string), "%s has been banned (Reason: AUTO BAN Rocket launcher Cheat)", pName);
            SendClientMessageToAll(0xFF0000FF, string);
            BanEx(i, "Auto Ban - Rocket Launcher");
            new File:bFile = fopen("autobans.log", io_append);
            if(bFile)
            {
                fwrite(bFile, "AUTOBANS");
            }
            fclose(bFile);
        }
        break;
    }
}

public OnGameModeExit()
{
    KillTimer(timer1);
    return 1;
}
You didn't end your timer function before starting the OnGameModeExit callback.
Reply
#5

OMG :/ ROFL

Ty man.
Reply
#6

mmmm yes it's compiled now,but...why doesnt work anymore the autoban?
Reply
#7

Please try this, little better optimized.
pawn Код:
#include <a_samp>

//AntiCheat
new timer1;

public OnGameModeInit()
{
    timer1 = SetTimer("AntiCheat",5000,true);
    return 1;
}

forward AntiCheat();
public AntiCheat()
{
    new weapon;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            weapon = GetPlayerWeapon( i );
            if( weapon == 38 || weapon == 35 )
            {
                new string[ 80 ];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                if( weapon == 38 )
                    format(string, sizeof(string), "%s has been banned. (Reason: AUTO BAN Minigun Cheat)", pName);
                else if( weapon == 35 )
                    format(string, sizeof(string), "%s has been banned (Reason: AUTO BAN Rocket launcher Cheat)", pName);
                   
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "Auto Ban - Minigun");
                new File:bFile = fopen("autobans.log", io_append);
                if(bFile)
                {
                    fwrite(bFile, "AUTOBANS");
                }
                fclose(bFile);
            }
        }
    }
    return 1;
}

public OnGameModeExit()
{
    KillTimer(timer1);
    return 1;
}
Reply
#8

Umh k this is better but...autoban dont work
Reply
#9

What do you mean? Make sure you have put the script inside your filterscripts folder and have added it to your server.cfg .

I just tested it and can confirm that it does in fact work.
Reply
#10

Yes i already do it all this things.

I mean,i tried to give a test player a rpg but filterscript doesnt ban..same with minigun
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)