Switch Cases In Dialog
#1

Okay, so i am having a issue with DIALOG_STYLE_MSGBOX. I wonder how i can do something like "Case's" or listitem for it. Or should it be done in another way?
Reply
#2

Strcat ? New lines? I don't understand you
Reply
#3

This is the code for everything:

PHP код:
    if(dialogid == 6774)
    {
         if(
response)
         {
            if(
listitem == 0//Cars
            
{
                
ShowPlayerDialogEx(playeridDIALOG_SALOONSDIALOG_STYLE_LIST"Choose a car you would like to buy","Bravura\nSentinel","Buy/Preview""Cancel");
            }
        }
    }
    if(
dialogid == DIALOG_CARS)
    {
         if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    if (
GetPlayerCash(playerid) >= 3000)
                    {
                        
GivePlayerCash(playerid, -3000);
                        new 
playervehicleid GetPlayerFreeVehicleId(playerid);
                        
CreatePlayerVehicle(playeridplayervehicleid4012172.1597,1391.7802,10.820390.0000000);
                        
SendClientMessage(playeridCOLOR_GRAD1"You have bought a bravura");
                        
VehicleSpawned[playerid] = 1;
                        
TextDrawHideForPlayer(playeridTDEditor_TD[0]);
                        return 
1;
                    }
                    else
                     {
                        
TextDrawHideForPlayer(playeridTDEditor_TD[0]);
                        
SendClientMessage(playeridCOLOR_GRAD1"You don't have enough money");
                    }
                }
                case 
1:
                {
                    if (
GetPlayerCash(playerid) >= 10000)
                    {
                        
GivePlayerCash(playerid, -10000);
                        new 
playervehicleid GetPlayerFreeVehicleId(playerid);
                        
CreatePlayerVehicle(playeridplayervehicleid4052172.1597,1391.7802,10.820390.0000000);
                        
SendClientMessage(playeridCOLOR_GRAD1"You have bought a Sentinel");
                        
VehicleSpawned[playerid] = 1;
                        
TextDrawHideForPlayer(playeridTDEditor_TD[1]);
                        return 
1;
                    }
                    else
                     {
                        
TextDrawHideForPlayer(playeridTDEditor_TD[1]);
                        
SendClientMessage(playeridCOLOR_GRAD1"You don't have enough money");
                    }
                }
            }
        }
        else
            
TextDrawHideForPlayer(playeridTDEditor_TD[0]);
            
TextDrawHideForPlayer(playeridTDEditor_TD[1]);
            
//ShowPlayerDialogEx(playerid, 6774, DIALOG_STYLE_LIST, "Choose a car you would like to buy","Bravura\nSentinel","Buy/Preview", "Cancel");
    
}
    if(
dialogid == DIALOG_SALOONS)
    {
         if(
response)
        {
            switch(
listitem)
            {
                case 
0// Bravura
                
{
                    
TextDrawShowForPlayer(playeridTDEditor_TD[0]);
                    
ShowPlayerDialogEx(playerid,DIALOG_CONVERT,DIALOG_STYLE_MSGBOX,"Are you sure?","Do you wanna buy this Bravura\nPrice: $3,000","Buy","Cancel");
                }
                case 
1// Sentinel
                
{
                    
TextDrawShowForPlayer(playeridTDEditor_TD[1]);
                    
ShowPlayerDialogEx(playerid,DIALOG_CONVERT,DIALOG_STYLE_MSGBOX,"Are you sure?","Do you wanna buy this Sentinel\nPrice: $10,000","Buy","Cancel");
                }
            }
        }
        else
            
TextDrawHideForPlayer(playeridTDEditor_TD[0]);
            
TextDrawHideForPlayer(playeridTDEditor_TD[1]);
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)