SA-MP Forums Archive
Transfering From SendClientMessage To Dialog - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Transfering From SendClientMessage To Dialog (/showthread.php?tid=519194)



Transfering From SendClientMessage To Dialog - Team_PRO - 13.06.2014

i need this to be dialog
pawn Код:
dcmd_level(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 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");
        }
        //======================================================================
        // Level 1
        //======================================================================
        if(strcmp(params,"1",true) == 0)
        {
        if(AccInfo[playerid][Level] >= 1)
        {
        SendClientMessage(playerid, white, "___________ |- Trial Moderator (Level 1) -| ___________");
        SendClientMessage(playerid,0x53D212FF,"Player: getinfo, weaps, ping, ip, ");
        SendClientMessage(playerid,0x33F666FF,"Vehicle: fix, repair, addnos, tcar");
        SendClientMessage(playerid,0x53D212FF,"Tele: saveplacae, gotoplace");
        SendClientMessage(playerid,0x33F666FF,"Adm: saveskin, useskin, dontuseskin, setmytime, adminarea");
        SendClientMessage(playerid,0x53D212FF,"Other: lconfig, morning, reports, richlist, miniguns");
        }
            else return ErrorMessages(playerid, 8);
        }
        //======================================================================
        // Level 2
        //======================================================================
        else if(strcmp(params,"2",true) == 0)
        {
        if(AccInfo[playerid][Level] >= 2)
        {
        SendClientMessage(playerid, white, "___________ |- Moderator (Level 2) -| ___________");
        SendClientMessage(playerid, orange, "+ Level 1 commands.");
        SendClientMessage(playerid,0x53D212FF,"Player: giveweapon, setcolour, burn, spawn, disarm, highlight, jetpack, flip, fu");
        SendClientMessage(playerid,0x33F666FF,"Player: warn, slap, (un)mute, laston, lspec, lspecoff");
        SendClientMessage(playerid,0x53D212FF,"Vehicle: acar, abike, aheli, aboat, aplane, lspecvehicle");
        SendClientMessage(playerid,0x33F666FF,"Tele: goto, vgoto, lgoto");
        SendClientMessage(playerid,0x53D212FF,"Adm: lmenu, clearchat, write, announce, announce2, screen, (un)lockcar");
        SendClientMessage(playerid,0x33F666FF,"Other: wanted, jailed, frozen, muted, fstyles");
        }
            else return ErrorMessages(playerid, 7);
        }
        //======================================================================
        // Level 3
        //======================================================================
        else if(strcmp(params,"3",true) == 0)
        {
        if(AccInfo[playerid][Level] >= 3)
        {
        SendClientMessage(playerid, white, "___________ |- Junior Administrator (Level 3) -| ___________");
        SendClientMessage(playerid, orange, "+ Level 1 and 2 commands.");
        SendClientMessage(playerid,0x53D212FF,"Set: set(health/armour/cash/score/skin/wanted/name/weather/time/world/interior/ping/gravity)");
        SendClientMessage(playerid,0x33F666FF,"All: setallskin, armourall, setallskin, setallwanted, setallweather, setalltime, setallworld");
        SendClientMessage(playerid,0x53D212FF,"All: setallscore, setallcash, giveallcash, giveallweapon, clearallchat, healall, disablechat");
        SendClientMessage(playerid,0x33F666FF,"Player: ubound, duel, akill, aka, caps,(un)freeze, kick, explode,(un)jail, force, eject, (s)removecash");
        SendClientMessage(playerid,0x53D212FF,"Vehicle: car, carhealth, carcolour, destroycar, vget, givecar");
        SendClientMessage(playerid,0x33F666FF,"Tele: teleplayer, gethere, get, move, moveplayer");
        SendClientMessage(playerid,0x53D212FF,"Other: gps, setpass, lammo, countdown, aweaps, invisible, visible");
        }
            else return ErrorMessages(playerid, 6);
        }
        //======================================================================
        // Level 4
        //======================================================================
        else if(strcmp(params,"4",true) == 0)
        {
        if(AccInfo[playerid][Level] >= 4)
        {
        SendClientMessage(playerid, white, "___________ |- Administrator (Level 4) -| ___________");
        SendClientMessage(playerid, orange, "+ Level 1,2 and 3 commands.");
        SendClientMessage(playerid,0x53D212FF,"All: spawnall, muteall, unmuteall, getall, killall, freezeall, unfreezeall");
        SendClientMessage(playerid,0x33F666FF,"All: kickall, slapalll, explodeall, disarmall, ejectall");
        SendClientMessage(playerid,0x53D212FF,"Player: cage, ban, rban, tempban, settemplevel, crash");
        SendClientMessage(playerid,0x33F666FF,"Adm: ctele, lockserver, enable, disable, spam, god, godcar, botcheck, forbidname, forbidword, fakedeath");
        SendClientMessage(playerid,0x53D212FF,"Other: uconfig, die, hide, unhide");
        }
            else return ErrorMessages(playerid, 5);
        }
        //======================================================================
        // Level 5
        //======================================================================
        else if(strcmp(params,"5",true) == 0)
        {
        if(AccInfo[playerid][Level] >= 5)
        {
        SendClientMessage(playerid, white, "___________ |- Head Administrator (Level 5) -| ___________");
        SendClientMessage(playerid, orange, "+ Level 1,2,3 and 4 commands.");
        SendClientMessage(playerid, orange, "+ Level 5 is Immune for all commands");
        SendClientMessage(playerid,0x53D212FF,"Player: setlevel, fakechat, fakedeath, fakecmd");
        SendClientMessage(playerid,0x33F666FF,"Adm: god, sgod, console");
        SendClientMessage(playerid,0x53D212FF,"Other: pickup, object, respawncars");
        SendClientMessage(playerid,0x53D212FF,"Rcon: lrcon (Only Rcon Admins) (Use: /rcon lrcon)");
        }
            else return ErrorMessages(playerid, 9);
        }
        //======================================================================
        else
        {
        SendClientMessage(playerid, red, "ERROR: Invalid Level! (1-5)");
        }
        return 1;
    }
    else return ErrorMessages(playerid, 1);
}
and this too
pawn Код:
dcmd_admins(playerid,params[])
{
    #pragma unused params
        new count = 0;
        new string[128];
        SendClientMessage(playerid, green, " ");
        SendClientMessage(playerid, green, "___________ |- Online Admins -| ___________");
        SendClientMessage(playerid, green, " ");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        if (IsPlayerConnected(i))
        {
        if(AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
        {
        if(AccInfo[i][Level] > 5) {
        AdmRank = "Community Owner";
        }
        if(IsPlayerAdmin(i)) AdmRank = "RCON Administrator";
        else
        switch(AccInfo[i][Level])
        {
        case 1: AdmRank = "Trial Moderator";
        case 2: AdmRank = "Moderator";
        case 3: AdmRank = "Junior Administrator";
        case 4: AdmRank = "Administrator";
        case 5: AdmRank = "Head Administrator";
        }
        format(string, 128, "%s (Id:%i) | Level: %d - %s",PlayerName2(i),i,AccInfo[i][Level], AdmRank);
        SendClientMessage(playerid, yellow, string);
        count++;
        }
        }
        }
        if (count == 0)
        SendClientMessage(playerid,red,"No admin online in the list");
        SendClientMessage(playerid, green, " _______________________________________");
        return 1;
}
Remove the
Код:
___________________________



Re: Transfering From SendClientMessage To Dialog - [Cali]ChrOnic_T - 13.06.2014

J.L admin? yes man i understand i use it too I hate its in dialogs xD


Re: Transfering From SendClientMessage To Dialog - MacT - 13.06.2014

Here you go:
pawn Код:
new PT[1900];
    if(AccInfo[playerid][Level] >= 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");
        }
        //======================================================================
        // Level 1
        //======================================================================
        if(strcmp(params,"1",true) == 0)
        {
        if(AccInfo[playerid][Level] >= 1)
        {
        strcat(PT,"{53D212}Player: getinfo, weaps, ping, ip\n, ",sizeof(PT));
        strcat(PT,"{33F666}Vehicle: fix, repair, addnos, tcar\n",sizeof(PT));
        strcat(PT,"{53D212}Tele: saveplacae, gotoplace"\n,sizeof(PT));
        strcat(PT,"{33F666}Adm: saveskin, useskin, dontuseskin, setmytime, adminarea\n",sizeof(PT));
        strcat(PT,"{53D212}Other: lconfig, morning, reports, richlist, miniguns",sizeof(PT));
        ShowPlayerDialog(playerid, 90, DIALOG_STYLE_MSGBOX, "___________ |- Trial Moderator (Level 1) -| ___________", PT, "Ok", "Cancel");
        }
            else return ErrorMessages(playerid, 8);
        }



Re: Transfering From SendClientMessage To Dialog - Threshold - 14.06.2014

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?