16.05.2013, 21:08
Hi, i've been trying to find out how i am supposed to do this, but actually i am clueless. I have wrote down a banning command, but i don't know how could i write a command to remove the banned player from the sa-mp list. Here's my ban command and how i wrote it.
pawn Код:
CMD:ban(playerid, params[])
{
new pID, string[256], atext[256], aname[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME];
new pIP[16];
if(pInfo[playerid][Level] < 4) return 0;
if(sscanf(params, "us[256]", pID, atext)) return SendClientMessage(playerid, 0xFF0000AA, "[USAGE] /ban <playerid> <reason>");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xFF0000AA, "[ERROR] User is not connected.");
{
GetPlayerName(playerid, aname, sizeof(aname));
GetPlayerName(pID, pname, sizeof(pname));
format(string, sizeof(string), "[ADMIN] %s has banned %s from the server for: %s", aname, pname, atext);
SendClientMessageToAll(0xFF0000AA, string);
format(string, sizeof(string), "You've been banned from the server by %s for: %s", aname, atext);
SendClientMessage(pID, 0xFF0000AA, string);
new File:fi_log;
fi_log = fopen("Admin/Logs/Banlog.txt", io_append);
new cstring[256], day, year, month, hour, minute, second;
getdate(year, month, day); gettime(hour, minute, second);
GetPlayerIp(pID, pIP, sizeof(pIP));
format(cstring, sizeof(cstring), "[%d/%d/%d - %d:%d:%d][IP:%s]%s has banned %s from the server. reason: %s.\r\n", day, month, year, hour, minute, second, pIP, aname, pname, atext);
fwrite(fi_log, cstring);
fclose(fi_log);
Ban(pID);
}
return 1;
}