Need a example :)
#1

How i can make a dialog like:

/TRUNK and give: "Take M4" and "TAKE MP5" and if someone press m4 got the m4 if mp5 it...
Reply
#2

pawn Код:
#define DIALOG_TRUNK 8464 // defines the dialogid so you don't confuse it later
zcmd:
pawn Код:
CMD:trunk(playerid, params[]) {
    ShowPlayerDialog(playerid, DIALOG_TRUNK, DIALOG_STYLE_LIST, "Trunk", "Take M4\nTake MP5", "Take", "Exit"); // shows the dialog
    return 1;
}
strcmp:
pawn Код:
if(!strcmp(cmdtext, "/trunk", true, 6)) {
    ShowPlayerDialog(playerid, DIALOG_TRUNK, DIALOG_STYLE_LIST, "Trunk", "Take M4\nTake MP5", "Take", "Exit"); // shows the dialog
    return 1;
}
And add this to your OnDialogResponse:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if(dialogid == DIALOG_TRUNK) {
        if(response) { // if you responded to the dialog
            switch(listitem) {
                case 0: GivePlayerWeapon(playerid, 31, 1000); // Gives player an M4.
                case 1: GivePlayerWeapon(playerid, 29, 1000); // Gives player an MP5.
            }
        }
    }
    return 0;
}
Reply
#3

Thanks, how i can include to this:

pawn Код:
case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response ) {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                        GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                        ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_WHITE"You have successfully logged in!","Ok","");
                        SpawnPlayer(playerid);
                        SetPlayerColor(playerid, COLOR_WHITE);
                }
                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 0;
}
Reply
#4

Just add it after that, add this:
pawn Код:
if(dialogid == DIALOG_TRUNK) {
    if(response) { // if you responded to the dialog
        switch(listitem) {
            case 0: GivePlayerWeapon(playerid, 31, 1000); // Gives player an M4.
            case 1: GivePlayerWeapon(playerid, 29, 1000); // Gives player an MP5.
        }
    }
}
above "return 0;"
Reply
#5

another question how i can made like:

/trunk ---> shows:
Weapons
Car:

IF weapons show the list "take m4/tame mp5"

IF car another option (press is a work and have another dialog...)
Reply
#6

Show the dialog with "Weapons" and "Car" and in "switch(listitem)" case 0 would be Weapons, and case 1 would be Car. So then in case 0 open this dialog:
pawn Код:
ShowPlayerDialog(playerid, DIALOG_TRUNK, DIALOG_STYLE_LIST, "Trunk", "Take M4\nTake MP5", "Take", "Exit")
and on case 1, open a car dialog.

For more info, visit this link and this link.
Reply
#7

DIALOG NOT WORKING:

In game i see the dialog but it wont work:
pawn Код:
.....end of another dialog
}
        if(dialogid == DIALOG_TRUNK) {
        if(response) { // if you responded to the dialog
             if(listitem == 0)
             {
              GivePlayerWeapon(playerid, 31, 10000); // Gives player an M4.
             }
              if(listitem == 1)
             {
              GivePlayerWeapon(playerid, 29, 10000); // Gives player an M4.
             }
              if(listitem == 2)
             {
              GivePlayerWeapon(playerid, 23, 10000); // Gives player an M4.
             }
              if(listitem == 3)
             {
              GivePlayerWeapon(playerid, 43, 10000); // Gives player an M4.
             }
              if(listitem == 4)
             {
              SetPlayerArmour(playerid, 75); // Gives player an M4.
             }
              if(listitem == 5)
             {
              SetPlayerHealth(playerid, 25); // Gives player an M4.
             }
              }
        return 1;
    }
        }
    }
    return 0;
}
Please help
Reply
#8

Remove that "return 1"
Reply
#9

STILL NOT workin
Reply
#10

Try this one.

pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/trunk", cmdtext, true, 5) == 0)
{
ShowPlayerDialog(playerid, 20320, DIALOG_STYLE_LIST, "Trunk", "Weapons\nCars", "Select", "Exit");
return 1;
}

return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 20320 && response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Weapons", "M4\nMP5", "Select", "Cancel");
}
case 1:
{
ShowPlayerDialog(playerid, 20322, DIALOG_STYLE_LIST, "Vehicles", "BMX\nFaggio", "Select", "Cancel");
}
}
}

if(dialogid == 20321 && response)
{
switch(listitem)
{
case 0:
{
GivePlayerWeapon(playerid, 31, 9999);
}
case 1:
{
GivePlayerWeapon(playerid, 29, 9999);
}
}
}

if(dialogid == 20322 && response)
{
switch(listitem)
{
case 0:
{
new Float:x, Float:y, Float:z;
new BMX;
GetPlayerPos(playerid, x, y, z);
BMX = CreateVehicle(481, x, y, z, 82.2873, 0, 1, 999999);
PutPlayerInVehicle(playerid, BMX, 0);
}
case 1:
{
new Float:x, Float:y, Float:z;
new Faggio;
GetPlayerPos(playerid, x, y, z);
Faggio = CreateVehicle(462, x, y, z, 82.2873, 0, 1, 999999);
PutPlayerInVehicle(playerid, Faggio, 0);
}
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)