31.08.2011, 06:36
pawn Код:
dcmd_unban(playerid, params[]) // Level 1
{
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not authorized to use this command!");
new target, user[128], string[128];
if(sscanf(params, "s", target)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /unban [Full Player Name]");
format(user, sizeof(user), "%s.ini", target);
if(INI_Exists(user))
{
new INI:File = INI_Open(user);
INI_SetTag(user,"Main");
INI_WriteInt(user, "Banned", 0);
format(string, sizeof(string), "None");
strmid(PlayerInfo[target][pBanReason], string, 0, strlen(string), 255);
INI_WriteString(user, "BanReason", PlayerInfo[target][pBanReason]);
for(new i = 0; i < MAX_PLAYERS; i++)
foreach(Player, i);
{
if(PlayerInfo[i][pAdmin] >= 1)
{
format(string, sizeof(string), "Admin %s has unbanned the account '%s'", PlayerName(playerid), target);
SendClientMessage(i, COLOR_LIGHTRED, string);
return 1;
}
}
INI_Close(target);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "User not found!");
return 1;
}
return 1;
}