help admin system
#3

this is command /setlevel :

Код:
CMD:setlevel(playerid, params[])
{
	new targetid, level, string[100];
	if(PlayerInfo[playerid][pAdmin] < 5 && !IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_RED, "[ERROR] You are not authorised to use this command");
	if(sscanf(params, "ud", targetid, level)) return SCM(playerid, COLOR_RED, "[USAGE] /setlevel <playerid/part of name> <level>");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected");
    PlayerInfo[targetid][pAdmin] = level;
    format(string, sizeof(string), "Admin %s has set your admin level to %d", GetName(playerid), level);
    SCM(targetid, COLOR_GREEN, string);
    format(string, sizeof(string), "You have successfully set %s's level to %d", GetName(targetid), level);
    SCM(playerid, COLOR_GREEN, string);
    return 1;
Код:
enum pInfo
{
    pPass,
    pScore,
    pCash,
    pKills,
    pDeaths,
    pAdmin,
    pMute
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward ClearMute();
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("AdminLevel",PlayerInfo[playerid][pAdmin]);
    return 1;
}
and OnDialogResponse:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"AdminLevel",0);
                INI_Close(File);

                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Welcome to  Knights Of Glory-TDM server\nEnjoy your stay and have Fun , our Website: {FFFFFF}www.KoG.Xobor.de","Ok","");
                        }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    new targetid;
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid,  PlayerInfo[playerid][pScore]);
                    PlayerInfo[targetid][pAdmin] = PlayerInfo[playerid][pAdmin];
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                 }
                return 1;
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
help admin system - by IronMan006 - 20.04.2014, 09:22
Re: help admin system - by Flake. - 20.04.2014, 09:25
Re : help admin system - by IronMan006 - 20.04.2014, 09:36
Re: help admin system - by ChuckyBabe - 20.04.2014, 10:18
Re : help admin system - by IronMan006 - 20.04.2014, 10:53
Re: help admin system - by SyntaxQ - 20.04.2014, 11:18
Re : help admin system - by IronMan006 - 20.04.2014, 13:15

Forum Jump:


Users browsing this thread: 1 Guest(s)