Making auto reading a file?
#1

Hai all,i need little help.

I've this small anti cheat:

Код:
#include <a_samp>

//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");
                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");
                break;
            }
        }
    }
    return 1;
}

public OnGameModeExit()
{
    KillTimer(timer1);
    return 1;
}
I need to write this AUTOBANS in a autobans.log file

Is there any way?
Reply
#2

Check this: https://sampwiki.blast.hk/wiki/File_Functions
Reply
#3

Umh yes i know that,but u can say me how to do it?
Reply
#4

You could add this code to it after it bans someone.
pawn Код:
new File:bFile = fopen("autobans.log", io_append);
if(bFile)
{
   fwrite(bFile, "AUTOBANS");
}
fclose(bFile);
Make sure the file exists on start of the server or it will crash.
Reply
#5

Thank u!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)