31.08.2011, 07:58
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 user[128], string[128],PlayerName2[24];
if(sscanf(params, "s[128]", PlayerName2)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /unban [Full Player Name]");
format(user, sizeof(user), "%s.ini", PlayerName2);
if(INI_Exists(user))
{
new INI:File = INI_Open(user);
printf(user);
printf("User file opened");
INI_SetTag(File,"Main");
INI_WriteInt(File, "Banned", 0);
printf("User file unbanned");
format(string, sizeof(string), "None");
INI_WriteString(File, "BanReason", string);
printf("Banned reason changed");
INI_Close(File);
printf("File closed");
foreach(Player ,i)
{
if(PlayerInfo[i][pAdmin] >= 1)
{
format(string, sizeof(string), "Admin %s has unbanned the account '%s'", PlayerName(playerid), PlayerName2);
SendClientMessage(i, COLOR_LIGHTRED, string);
}
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "User not found!");
return 1;
}
return 1;
}