/unban command help
#4

pawn Код:
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(string, sizeof(string), "/Users/%s.ini", pName);//use string instead of pName to store the whole value!

    if(!fexist(string)) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This user does not exists.");
    SetPVarString(playerid, "UnbanName", pName);
    SetPVarInt(playerid, "BanCheck", 0);
    INI_ParseFile(string, "LoadBan_%s", .bExtra = true, .extra = playerid);
    if(GetPVarInt(playerid, "BanCheck")==0) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This user is not banned.");
    new INI:File = INI_Open(string);
    INI_SetTag(File, "data");
    INI_WriteInt(File, "Banned", 0);
    INI_Close(File);
    format(string, sizeof(string), "User %s has been unbanned.", pName);
    SendClientMessage(playerid, COLOR_ADMINBLUE, string);
    return 1;
}
Maybe this!
Reply


Messages In This Thread
/unban command help - by ATGOggy - 10.01.2015, 11:51
Re: /unban command help - by Gammix - 10.01.2015, 11:55
Re: /unban command help - by ATGOggy - 10.01.2015, 12:03
Re: /unban command help - by Gammix - 10.01.2015, 12:08
Re: /unban command help - by ATGOggy - 10.01.2015, 12:08

Forum Jump:


Users browsing this thread: 3 Guest(s)