05.06.2015, 10:46
These two functions are for you to use when you want to ban someone.
It may be a command:
Also, I added a useless parameter to those functions, so change them to:
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;
}
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);
}