SA-MP Forums Archive
Switch Cases In 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: Switch Cases In Dialog (/showthread.php?tid=560477)



Switch Cases In Dialog - Mark_Samp - 28.01.2015

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?


Re: Switch Cases In Dialog - Sime30 - 28.01.2015

Strcat ? New lines? I don't understand you


Re: Switch Cases In Dialog - Mark_Samp - 28.01.2015

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]);
    }