Vehicles list shows only one line?
#1

I have tried to use the new style that came up with 0.3.7 in the vehicle's list of the gamemode I'm working on, and basically everything has gone smoothly but a small bug occured when I was trying to show more than one line. for example if I own 5+ cars, it won't show 5 lines, just exchange between the single line.

That's the code:
Quote:

forward vs_OnPlayerSpawnsVehicle(playerid);
public vs_OnPlayerSpawnsVehicle(playerid) {
new rows = cache_get_row_count(handlesql);
if(rows > 0) {
new dialogMsg[400],
addition[20],
platenum,
value;

for(new i = 0; i < rows; i++) {
format(dialogMsg, sizeof(dialogMsg), "{ff9900}Vehicle Name\t{ff9900}Market Value\t{ff9900}Plate Number{AFAFAF}");
value = cache_get_field_content_int(i, "Value");
platenum = cache_get_field_content_int(i, "Plate");
if(cache_get_field_content_int(i, "Donate") != 0 || value == 0) {
format(addition, sizeof(addition), "Donator Vehicle, ");
} else {
format(addition, sizeof(addition), "%s", EOS);
}

if(isnull(dialogMsg)) {
format(dialogMsg, sizeof(dialogMsg), "%s\n%s\t%s\t%s", VehicleName[cache_get_field_content_int(i, "Model") - 400], addition, FormatMoney(value), platenum);
} else {
format(dialogMsg, sizeof(dialogMsg), "%s\n%s\t%s\t%s", dialogMsg, VehicleName[cache_get_field_content_int(i, "Model") - 400], addition, FormatMoney(value), platenum);
}
}
ShowPlayerDialogEx(playerid, DIALOG_VEHICLE_SPAWN, DIALOG_STYLE_TABLIST_HEADERS, "{AFAFAF}Personal Vehicles", dialogMsg, "Spawn", "Cancel");
} else {
ShowPlayerDialogEx(playerid, 3155, DIALOG_STYLE_MSGBOX, "{AFAFAF}Personal Vehicles", "{FF0000}You don't have any vehicles.", "EXIT", "");
}
}

How to show more than one line?
Reply
#2

Add a \n at the end
Reply
#3

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Add a \n at the end
Now everything's fine, but it copies the first line like If I have buffalo and infenus, it shows 2 buffalos instead. why?
Reply
#4

Your codes really messy. Could you put it in [PHP] and make it more clear?

For dialogMsg, add:

PHP код:
dialogMsg[0] = EOS
I don't guarantee it'll fix anything.
Reply
#5

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Your codes really messy. Could you put it in [PHP] and make it more clear?

For dialogMsg, add:

PHP код:
dialogMsg[0] = EOS
I don't guarantee it'll fix anything.
PHP код:
forward vs_OnPlayerSpawnsVehicle(playerid);
public 
vs_OnPlayerSpawnsVehicle(playerid) {
    new 
rows cache_get_row_count(handlesql);
    if(
rows 0) {
        new 
dialogMsg[400],
            
addition[20],
            
value;
        new 
dialogMsg[0] = EOS;  
        new 
plate[VEHICLE_PLATE_MAX_LENGTH];
        for(new 
0rowsi++) {
            
format(dialogMsgsizeof(dialogMsg), "{AFAFAF}Vehicle Name\t{AFAFAF}Market Value\t{AFAFAF}Plate Number{AFAFAF}");
            
value cache_get_field_content_int(i"Value");
            for(new 
0cache_get_row_count(); x++) {
            
cache_get_field_content(x"Plate"plate);      
            if(
cache_get_field_content_int(i"Donate") != || value == 0) {
                
format(additionsizeof(addition), "Donator Vehicle, ");
            } else {
                
format(additionsizeof(addition), "%s"EOS);
            }
            
            if(
isnull(dialogMsg)) {
            
format(dialogMsgsizeof(dialogMsg), "%s\n%s\t%s\t%s\n"VehicleName[cache_get_field_content_int(i"Model") - 400], additionFormatMoney(value), plate);
            } else {
            
format(dialogMsgsizeof(dialogMsg), "%s\n%s\t%s\t%s\t%s\n"dialogMsgVehicleName[cache_get_field_content_int(i"Model") - 400], additionFormatMoney(value), plate);
            }
          }
        }
        
ShowPlayerDialogEx(playeridDIALOG_VEHICLE_SPAWNDIALOG_STYLE_TABLIST_HEADERS"{ff9900}Personal Vehicle"dialogMsg"Spawn""Exit");
    } else {
    
ShowPlayerDialogEx(playerid3155DIALOG_STYLE_MSGBOX"{ff9900}Personal Vehicle""{FF0000}You have have any vehicles on your possesssion.\n{AFAFAF}HINT: If you'd like to purchase a vehicle for your ride, head down to the dealerships and purchase one!\n{AFAFAF}Hint: You can go to the newbies spawn to rent a vehicle until you work to gain enough money for a sufficent vehicle.""Okay""");
    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)