31.08.2011, 06:29
So this is the first time I've ever made this type of command, and I tried doing all of it by myself so I could feel good but it didn't work out :P
Only error that shouldn't be there is undefined symbol "i".. because I've used foreach on every other command and it's worked fine, but yeah.
EDIT:
I fixed half the errors, "user" was meant to be "File", I knew that, just didn't realize xD Still, no idea why foreach isn't working.
EDIT2:
Fixed, had a ; at the end of the foreach, xD
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]);
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;
}
Код:
(1204) : error 036: empty statement (1206) : error 017: undefined symbol "i" (1209) : error 017: undefined symbol "i"
EDIT:
I fixed half the errors, "user" was meant to be "File", I knew that, just didn't realize xD Still, no idea why foreach isn't working.
EDIT2:
Fixed, had a ; at the end of the foreach, xD