MDC Dialog system
#1

I already have an MDC system that works like this:
pawn Код:
CMD:mdc(playerid, params[])
{
    new playerb, string[138], gender[8];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsASAA(playerid) && !IsAFBI(playerid) && !IsARCSD(playerid) && !IsASWAT(playerid) && !IsASATF(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD/FBI/RCSD Officer.");
    if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /mdc [playerid]");
    if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    //if(!PlayerInfo[playerb][pWanted]) return SendClientMessage(playerid, COLOR_GREY, "Player is not wanted.");
    // Gender
    if(PlayerInfo[playerb][pGender] == 1) format(gender, sizeof(gender), "Male");
    else if(PlayerInfo[playerb][pGender] == 2) format(gender, sizeof(gender), "Female");
    new text1[20];
    new text2[20];
    new text3[20];
    if(PlayerInfo[playerb][pCarLic]) { text1 = "Passed"; } else { text1 = "Not Passed"; }
    if(PlayerInfo[playerb][pFireArmsLic]) { text2 = "Passed"; } else { text2 = "Not Passed"; }
    if(PlayerInfo[playerb][pPilotLic]) { text3 = "Passed"; } else { text3 = "Not Passed"; }
    SendClientMessage(playerid, COLOR_ORANGE, "__[MDC - Mobile Data Computer]__");
    format(string, sizeof(string), "Welcome %s %s to the Mobile Data Computer.", RPFRN(playerid), RPN(playerid));
    SendClientMessage(playerid, COLOR_WHITE, string);
    SendClientMessage(playerid, COLOR_ORANGE, "______[ Person Info ]______");
    format(string, sizeof(string), "{FF9900}Full name: {FFFFFF}%s {FF9900}| Gender: {FFFFFF}%s {FF9900}| Age: {FFFFFF}%d", RPN(playerb));
    SendClientMessage(playerid, COLOR_ORANGE, string);
    format(string, sizeof(string), "{FF9900}Gender: {FFFFFF}%s", gender);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    format(string, sizeof(string), "{FF9900}Age: {FFFFFF}%d", PlayerInfo[playerb][pAge]);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    SendClientMessage(playerid, COLOR_ORANGE, "________[ Licenses ]________");
    format(string, sizeof(string), "{FF9900}Drivers License: {FFFFFF}%s", text1);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    format(string, sizeof(string), "{FF9900}Firearms License: {FFFFFF}%s", text2);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    format(string, sizeof(string), "{FF9900}Pilot License: {FFFFFF}%s", text3);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    if(PlayerInfo[playerb][pWanted] >= 1){format(string, sizeof(string), "______[ Warrants Issued ]______", PlayerInfo[playerb][pWanted1]); SendClientMessage(playerid, COLOR_ORANGE, string);}
    if(PlayerInfo[playerb][pWanted] >= 1){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted1]); SendClientMessage(playerid, COLOR_ORANGE, string);}
    if(PlayerInfo[playerb][pWanted] >= 2){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted2]); SendClientMessage(playerid, COLOR_ORANGE, string);}
    if(PlayerInfo[playerb][pWanted] >= 3){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted3]); SendClientMessage(playerid, COLOR_ORANGE, string);}
    if(PlayerInfo[playerb][pWanted] >= 4){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted4]); SendClientMessage(playerid, COLOR_ORANGE, string);}
    if(PlayerInfo[playerb][pWanted] >= 5){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted5]); SendClientMessage(playerid, COLOR_ORANGE, string);}
    if(PlayerInfo[playerb][pWanted] >= 6){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted6]); SendClientMessage(playerid, COLOR_ORANGE, string);}
    SendClientMessage(playerid, COLOR_ORANGE, "______[ Crime Record ]______");
    format(string, sizeof(string), "{FF9900}Arrest Record: {FFFFFF}%s", PlayerInfo[playerid][pArrested]);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    format(string, sizeof(string), "{FF9900}Crime Record: {FFFFFF}%s", PlayerInfo[playerid][pCrimes]);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    return 1;
}
But i want to convert it into a simple 2 step dialog process that'll work like this:
1. An input dialog pops up, saying "Hello and welcome to the MDC %s" RPN(playerid) <-- playername
Then you put into a field the name of the person you want to see the stats for (without underscore if possible.)
2. It sends the message like above, showing stats about the other player. (defined as playerb)

I've tried something like this from watching a tutorial:
pawn Код:
CMD:newmdc(playerid, params[])
{
    new mdc, dialogid, response, inputtext;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsASAA(playerid) && !IsAFBI(playerid) && !IsARCSD(playerid) && !IsASWAT(playerid) && !IsASATF(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD/FBI/RCSD Officer.");
    if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
    ShowPlayerDialog(playerid, mdc, DIALOG_STYLE_INPUT, "{383635}[MDC - Mobile Data Computer]", "{383635}Welcome to the Mobile Data Computer %s.\nInsert a persons name underneath to access their information in the police/government database.", "Access", "Cancel");
    if(dialogid == 67 && response == 1)
    {
        if(inputtext[0] == '1') {
        new playerb, string[138], gender[8];
        if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /newmdc [playerid]");
        if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
        if(PlayerInfo[playerb][pGender] == 1) format(gender, sizeof(gender), "Male");
        else if(PlayerInfo[playerb][pGender] == 2) format(gender, sizeof(gender), "Female");
        new text1[20];
        new text2[20];
        new text3[20];
        if(PlayerInfo[playerb][pCarLic]) { text1 = "Passed"; } else { text1 = "Not Passed"; }
        if(PlayerInfo[playerb][pFireArmsLic]) { text2 = "Passed"; } else { text2 = "Not Passed"; }
        if(PlayerInfo[playerb][pPilotLic]) { text3 = "Passed"; } else { text3 = "Not Passed"; }
        SendClientMessage(playerid, COLOR_ORANGE, "__[MDC - Mobile Data Computer]__");
        format(string, sizeof(string), "Welcome %s %s to the Mobile Data Computer.", RPFRN(playerid), RPN(playerid));
        SendClientMessage(playerid, COLOR_WHITE, string);
        SendClientMessage(playerid, COLOR_ORANGE, "______[ Person Info ]______");
        format(string, sizeof(string), "{FF9900}Full name: {FFFFFF}%s {FF9900}| Gender: {FFFFFF}%s {FF9900}| Age: {FFFFFF}%d", RPN(playerb));
        SendClientMessage(playerid, COLOR_ORANGE, string);
        format(string, sizeof(string), "{FF9900}Gender: {FFFFFF}%s", gender);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        format(string, sizeof(string), "{FF9900}Age: {FFFFFF}%d", PlayerInfo[playerb][pAge]);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        SendClientMessage(playerid, COLOR_ORANGE, "________[ Licenses ]________");
        format(string, sizeof(string), "{FF9900}Drivers License: {FFFFFF}%s", text1);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        format(string, sizeof(string), "{FF9900}Firearms License: {FFFFFF}%s", text2);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        format(string, sizeof(string), "{FF9900}Pilot License: {FFFFFF}%s", text3);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        if(PlayerInfo[playerb][pWanted] >= 1){format(string, sizeof(string), "______[ Warrants Issued ]______", PlayerInfo[playerb][pWanted1]); SendClientMessage(playerid, COLOR_ORANGE, string);}
        if(PlayerInfo[playerb][pWanted] >= 1){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted1]); SendClientMessage(playerid, COLOR_ORANGE, string);}
        if(PlayerInfo[playerb][pWanted] >= 2){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted2]); SendClientMessage(playerid, COLOR_ORANGE, string);}
        if(PlayerInfo[playerb][pWanted] >= 3){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted3]); SendClientMessage(playerid, COLOR_ORANGE, string);}
        if(PlayerInfo[playerb][pWanted] >= 4){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted4]); SendClientMessage(playerid, COLOR_ORANGE, string);}
        if(PlayerInfo[playerb][pWanted] >= 5){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted5]); SendClientMessage(playerid, COLOR_ORANGE, string);}
        if(PlayerInfo[playerb][pWanted] >= 6){format(string, sizeof(string), "{FFFFFF}%s", PlayerInfo[playerb][pWanted6]); SendClientMessage(playerid, COLOR_ORANGE, string);}
        SendClientMessage(playerid, COLOR_ORANGE, "______[ Crime Record ]______");
        format(string, sizeof(string), "{FF9900}Arrest Record: {FFFFFF}%s", PlayerInfo[playerid][pArrested]);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        format(string, sizeof(string), "{FF9900}Crime Record: {FFFFFF}%s", PlayerInfo[playerid][pCrimes]);
        SendClientMessage(playerid, COLOR_ORANGE, string);
        }
        return 1;
        }
    return 0;
    }
return 1;
}
I could probably have adjusted some of the stuff to not return errors, but still...
As with this: if(inputtext[0] == '1') {
I want it to etc. retrieve the inputtext (name without underscore) and if it's valid, set as playerb/playerinfo for all the MDC text.
Reply
#2

wtf? if(dialogid == 67 && response == 1)

why u added that in cmd -_-
Reply
#3

Bump.
Reply
#4

pawn Код:
if(dialogid == 67 && response == 1)
This should be under OnDialogResponse, not in a command.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)