07.09.2012, 01:27
try:
pawn Код:
YCMD:offlineban(playerid, params[])
{
new playerb[32], string[128], file[32];
if(sscanf(params, "s[32]s[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /offlineban [playername] [reason]");
format(file, sizeof(file), "users/%s.ini", playerb);
if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
format(string, sizeof(string), "AdmCmd: %s has been offline-banned by %s, reason: %s", playerb, RPN(playerid), params);
SendClientMessageToAll(COLOR_LIGHTRED, string);
format(string, sizeof(string), "AdmCmd: %s has been offline-banned by %s (%s), reason: %s", playerb, GetPlayerName(playerid) , PIP(playerid), params);
// Banning
dini_IntSet(file, "pBanned", 1);
// BanList
new File:ban = fopen("ban.cfg", io_append);
format(string, sizeof(string), "%s\r\n", dini_Get(file, "IP"));
fwrite(ban, string);
fclose(ban);
return 1;
}
//and somewhere on the bottom of the script
stock PIP(playerid)
{
new ip[16];
GetPlayerIp(playerid, ip, sizeof(ip));
return ip;
}