How can I make this /setadmin command?
#5

Thanks for the help guys. I've managed to create this.
pawn Код:
CMD:setadmin(playerid,params[])
{
    new level, Pname, targetid; /* Defines two variables, one is the variable that will hold the desired admin level.
                                The second one holds the variable for the playerid who's admin level you want to set.*/

    if(sscanf(params,"ui",targetid,level)) return SendClientMessage(playerid,-1,"USAGE: /setadmin [playerid] [level]");
    if(level > 4) return SendClientMessage(playerid, COLOR_BRIGHTRED, "SERVER: Maximum Administrator level is 4.");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_BRIGHTRED, "That player is not connected!");
    new MyString[128];
    new TargetString[128];
    format(MyString,sizeof MyString, "You have set %s Admin Level to %i!", targetid, level);
    format(TargetString,sizeof TargetString, "You are now Admin Level %i, thanks to %s!", level, Pname);
    SendClientMessage(targetid, COLOR_RED, TargetString );
    SendClientMessage(playerid, COLOR_GREEN, MyString);
    if(!IsPlayerAdmin(playerid)) // Checks if the player is logged into RCON. The ! is if IsPlayerAdmin returns false, or he is not logged into RCON
    {
        return SendClientMessage(playerid,-1,"You are not authorized to use that command."); // If he isnt admin then it returns a message which also stops processing the command.
    }
    else // If all of the above has passed
    {
        // The code below makes their admin level equivalent to what the admin typed.
        PlayerInfo[targetid][pAdmin] = level; // Notice how in the playerid parameter we put targetid since that is the desired playerid to turn admin.
    }
    return 1;
}
But how could I get these to save at my "UserPath"?
Here's this, if it helps any.
pawn Код:
forward LoadUser_data(playerid,name[],value[]); //Register system, load user data
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}

stock UserPath(playerid) // Stock function, for the register system
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
Reply


Messages In This Thread
How can I make this /setadmin command? - by rangerxxll - 05.03.2012, 05:03
Re: How can I make this /setadmin command? - by Faisal_khan - 05.03.2012, 05:11
Re: How can I make this /setadmin command? - by Walsh - 05.03.2012, 05:17
Re: How can I make this /setadmin command? - by Bogdan1992 - 05.03.2012, 05:20
Re: How can I make this /setadmin command? - by rangerxxll - 05.03.2012, 05:39

Forum Jump:


Users browsing this thread: 1 Guest(s)