06.01.2015, 12:54
This is my code for /unban [username].
I need to add a line that checks if that user is banned or not and if he is banned, then it returns a message SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This user is not banned.");
I don't know the y_ini function for it. Can anyone please tell me how to do it?
PHP код:
// /unban[dcmd]
dcmd_unban(playerid, params[])
{
new pName[128], string[128];
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_WHITE,"Server: Unrecognized command, type /commands to see the commands available for you.");
if(PlayerInfo[playerid][pAdmin]<4) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This command is unavailable for your admin rank.");
if(admduty[playerid]==0) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: You must be on duty to use this command.");
if(sscanf(params, "s", pName)) return SendClientMessage(playerid, COLOR_ADMINBLUE, "Correct usage: /unban [username]");
format(pName, sizeof(pName), "Users/%s.ini", pName);
if(!fexist(string)) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This user does not exists.");
new INI:File = INI_Open(string);
SetTag(File, "data");
INI_WriteInt(File, "Banned", 0);
INI_Close(File);
SendClientMessage(playerid, COLOR_ADMINBLUE, "User %s has been unbanned.", pName);
return 1;
}
I don't know the y_ini function for it. Can anyone please tell me how to do it?