31.08.2011, 07:38
So I had a problem before but then got it solved but now there's a completely different problem. The command now executes, and before I posted this I done a debug and the problem is that it replies "SERVER: Unknown command" but the debug says that it did what it was meant to (Open the players file, set the banned to 0 and the banreason to None and then close the file), but it doesn't do that, except the debug says it did. Here's the code:
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];
if(sscanf(params, "s[128]", user)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /unban [Full Player Name]");
format(user, sizeof(user), "%s.ini", user);
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), user);
SendClientMessage(i, COLOR_LIGHTRED, string);
}
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "User not found!");
return 1;
}
return 1;
}