01.06.2013, 05:44
Alright here you go:
-Put this in the top of your script:
Where the commands are:
-Put this in the top of your script:
pawn Код:
#define COLOR_DARKRED 0xAA3333FF
pawn Код:
CMD:unban(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); // Logging in, maybe you have it as [!IsPlayerConnected]
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); // Change it to whatever you want.
new string[128];
if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /unban [name]");
new file[64], IP[16];
format(file, sizeof(file), "users/%s.ini", params); // Change it to the directory of the accounts.
if(dini_Exists(file))
{
if(dini_Int(file, "pBanned") == 0) return SendClientMessage(playerid, COLOR_GREY, "Player is not banned.");
format(IP, sizeof(IP), "%s", dini_Get(file, "IP"));
// Userfile
dini_IntSet(file, "pBanned", 0);
dini_IntSet(file, "Warns", 0);
dini_Set(file, "Warn1", "");
dini_Set(file, "Warn2", "");
dini_Set(file, "Warn3", "");
dini_Set(file, "BanReason", ""); // You've the rights to remove those if you don't have the system like that, Just comment them.
dini_Set(file, "BannedBy", "");
UnbanPlayer(ip[]); // The stock that was given.
format(string, sizeof(string), "AdmWarn: %s has unbanned %s.", RPN(playerid), params);
SendAdminMessage(COLOR_DARKRED, 1, string);
format(string, sizeof(string), "AdmWarn: %s (%s) has unbanned %s (%s).", RPN(playerid), RPIP(playerid), params, IP);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
}
return 1;
}