Dynamic Dialogboxes
#2

Quote:
Originally Posted by Markus_Whiteus
Посмотреть сообщение
I'm adding in a dynamic car dealership feature into my script I already have it loading my cars dynamically into the dialog box list
how ever when it comes to switch(listitem) is there anyway to dynamically make the cases depending on the amount of items on the list as that can change as vehicles and added/removed into the dealership table of my database.
PHP код:
    new
        
count,
        
text[128],
        
dialogText[200];
    for (new 
0!= MAX_VEHICLES++) // put your MAX_DEALERSHIP_VEHICLES thing...
    
{
        if (!
CarData[i][cExists]) continue; // create an another variable for each vehicle to see if they exists
        
strunpack(textCarData[i][cModel]); // Load things you need... (loads model such as Cheetah, Infernus)
        
CarData[i][cFuel] = new Float:cFuel// I'm assuming this is float
        
        
format(dialogTextsizeof(dialogText), "Car ID: %d | Car Model: %s | Car Fuel: %f\n"CarData[i][cID], textcFuel);
        
ShowPlayerDialog(playeridDIALOG_LIST_VEHICLESDIALOG_STYLE_LIST"Vehicles"dialogText"Select""Exit");
        
count++;
    }
    if (!
count) return SendClientMessage(playerid, -1"There are no vehicles to display."); 
I hope I understood you correctly. You can put these in a command or a function idk whatever pleases you. Ofc you have to change variables to what you set in your script.

But just realised this script will probably show dialog for each vehicle. So, you may want to create another function to prevent that. Maybe listDealershipCars()
Reply


Messages In This Thread
Dynamic Dialogboxes - by Markus_Whiteus - 21.03.2016, 11:54
Re: Dynamic Dialogboxes - by WhoIsYourDaddy - 21.03.2016, 12:19
Re: Dynamic Dialogboxes - by Markus_Whiteus - 21.03.2016, 12:26
Re: Dynamic Dialogboxes - by WhoIsYourDaddy - 21.03.2016, 12:33

Forum Jump:


Users browsing this thread: 1 Guest(s)