Transfering From SendClientMessage To Dialog
#4

pawn Код:
#define DIALOG_ID   1000 //Change this to a dialog id that is NOT being used.

dcmd_level(playerid,params[])
{
    if(!AccInfo[playerid][Level]) return ErrorMessages(playerid, 1);
    if(!strlen(params))
    {
        SendClientMessage(playerid, yellow, "Usage: /level [1/2/3/4/5]");
        return SendClientMessage(playerid, orange, "Function: Will see commands of specified level");
    }
    new var = strval(params);
    if(AccInfo[playerid][Level] < var) return ErrorMessages(playerid, (var == 5) ? (9) : (9 - var));
    switch(var)
    {
        //======================================================================
        // Level 1
        //======================================================================
        case 1:
        {
            new dstr[320];
            strcat(dstr, "{FFFFFF}___________ |- Trial Moderator (Level 1) -| ___________\n");
            strcat(dstr, "{53D212}Player: getinfo, weaps, ping, ip\n{33F666}Vehicle: fix, repair, addnos, tcar\n");
            strcat(dstr, "{53D212}Tele: saveplacae, gotoplace\n{33F666}Adm: saveskin, useskin, dontuseskin, setmytime, adminarea\n");
            strcat(dstr, "{53D212}Other: lconfig, morning, reports, richlist, miniguns");
            ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Admin Commands", dstr, "Okay", "");
        }
        //======================================================================
        // Level 2
        //======================================================================
        case 2:
        {
            new dstr[470];
            strcat(dstr, "{FFFFFF}___________ |- Moderator (Level 2) -| ___________\n");
            strcat(dstr, "+ Level 1 commands.\n{53D212}Player: giveweapon, setcolour, burn, spawn, disarm, highlight, jetpack, flip, fu\n");
            strcat(dstr, "{33F666}Player: warn, slap, (un)mute, laston, lspec, lspecoff\n{53D212}Vehicle: acar, abike, aheli, aboat, aplane, lspecvehicle\n{33F666}Tele: goto, vgoto, lgoto\n");
            strcat(dstr, "{53D212}Adm: lmenu, clearchat, write, announce, announce2, screen, (un)lockcar\n{33F666}Other: wanted, jailed, frozen, muted, fstyles");
            ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Admin Commands", dstr, "Okay", "");
        }
        //======================================================================
        // Level 3
        //======================================================================
        case 3:
        {
            new dstr[725];
            strcat(dstr, "{FFFFFF}___________ |- Junior Administrator (Level 3) -| ___________\n");
            strcat(dstr, "+ Level 1 and 2 commands.\n{53D212}Set: set(health/armour/cash/score/skin/wanted/name/weather/time/world/interior/ping/gravity)\n");
            strcat(dstr, "{33F666}All: setallskin, armourall, setallskin, setallwanted, setallweather, setalltime, setallworld\n");
            strcat(dstr, "{53D212}All: setallscore, setallcash, giveallcash, giveallweapon, clearallchat, healall, disablechat\n");
            strcat(dstr, "{33F666}Player: ubound, duel, akill, aka, caps,(un)freeze, kick, explode,(un)jail, force, eject, (s)removecash\n");
            strcat(dstr, "{53D212}Vehicle: car, carhealth, carcolour, destroycar, vget, givecar\n{33F666}Tele: teleplayer, gethere, get, move, moveplayer\n");
            strcat(dstr, "{53D212}Other: gps, setpass, lammo, countdown, aweaps, invisible, visible");
            ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Admin Commands", dstr, "Okay", "");
        }
        //======================================================================
        // Level 4
        //======================================================================
        case 4:
        {
            new dstr[465];
            strcat(dstr, "{FFFFFF}___________ |- Administrator (Level 4) -| ___________\n");
            strcat(dstr, "+ Level 1,2 and 3 commands.\n{53D212}All: spawnall, muteall, unmuteall, getall, killall, freezeall, unfreezeall\n");
            strcat(dstr, "{33F666}All: kickall, slapalll, explodeall, disarmall, ejectall\n{53D212}Player: cage, ban, rban, tempban, settemplevel, crash\n");
            strcat(dstr, "{33F666}Adm: ctele, lockserver, enable, disable, spam, god, godcar, botcheck, forbidname, forbidword, fakedeath\n");
            strcat(dstr, "{53D212}Other: uconfig, die, hide, unhide");
            ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Admin Commands", dstr, "Okay", "");
        }
        //======================================================================
        // Level 5
        //======================================================================
        case 5:
        {
            new dstr[360];
            strcat(dstr, "{FFFFFF}___________ |- Head Administrator (Level 5) -| ___________\n");
            strcat(dstr, "+ Level 1,2,3 and 4 commands.\n+ Level 5 is Immune for all commands\n");
            strcat(dstr, "{53D212}Player: setlevel, fakechat, fakedeath, fakecmd\n{33F666}Adm: god, sgod, console\n");
            strcat(dstr, "{33F666}Adm: god, sgod, console\n{53D212}Other: pickup, object, respawncars\nRcon: lrcon (Only Rcon Admins) (Use: /rcon lrcon)");
            ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Admin Commands", dstr, "Okay", "");
        }
        //======================================================================
        default: SendClientMessage(playerid, red, "ERROR: Invalid Level! (1-5)");
    }
    return 1;
}

dcmd_admins(playerid,params[])
{
    #pragma unused params
    new count = 0, string[1580];
    strcat(string, "{00FF00}___________ |- Online Admins -| ___________\n\n{FFFF00}");
    for(new i = 0; i < MAX_PLAYERS; i++) //Foreach is a better option
    {
        if(!IsPlayerConnected(i)) continue; //Remove this if you are using foreach.
        if(!AccInfo[i][Level]) continue;
        if(AccInfo[i][Hide]) continue;
        if(count >= 20)
        {
            strcat(string, "\n{FF0000}Not all Administrators could be listed. (More than 20 online)");
            break;
        }
        new Rank[21], fstr[72];
        switch(AccInfo[i][Level])
        {
            case 1: Rank = "Trial Moderator";
            case 2: Rank = "Moderator";
            case 3: Rank = "Junior Administrator";
            case 4: Rank = "Administrator";
            case 5: Rank = "Head Administrator";
            default: Rank = "Community Owner";
        }
        if(IsPlayerAdmin(i)) Rank = "RCON Administrator";
        format(fstr, sizeof(fstr), "%s (Id:%i) | Level: %d - %s\n", PlayerName2(i), i, AccInfo[i][Level], Rank);
        strcat(string, fstr);
        count++;
    }
    if(!count) strcat(string, "{FF0000}There are currently no Administrators online.");
    ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Online Administrators", string, "Okay", "");
    return 1;
}
Make sure you change 'DIALOG_ID' to something that isn't being used by any other dialog in any of your scripts.

EDIT: And I don't think that I need to remind you that ZCMD or YCMD is highly recommended?
Reply


Messages In This Thread
Transfering From SendClientMessage To Dialog - by Team_PRO - 13.06.2014, 09:39
Re: Transfering From SendClientMessage To Dialog - by [Cali]ChrOnic_T - 13.06.2014, 09:47
Re: Transfering From SendClientMessage To Dialog - by MacT - 13.06.2014, 09:57
Re: Transfering From SendClientMessage To Dialog - by Threshold - 14.06.2014, 04:28

Forum Jump:


Users browsing this thread: 2 Guest(s)