Autocheck if a person was banned previously
#6

These two functions are for you to use when you want to ban someone.

It may be a command:
pawn Код:
CMD:banplayername(playerid, params[])
{
    if(isnull(params))
       SendClientMessage(playerid, -1, "Usage /banplayername [ name ]");
   // You should also validate if the user used a valid player name.
    BanName(params);
    return 1;
}
Also, I added a useless parameter to those functions, so change them to:

pawn Код:
BanIp(name[])
{
    new File:file = fopen("bans_name.txt", io_append); // io_append will create the file it does not exist
    if(file)
    {
        fwrite(file, name);
        fwrite(file, "\r\n"); // a new line
    }
    fclose(file);
}

BanName(ip[])
{
    new File:file = fopen("bans_ip.txt", io_append); // io_append will create the file it does not exist
    if(file)
    {
        fwrite(file, ip);
        fwrite(file, "\r\n"); // a new line
    }
    fclose(file);
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)