Veh Name [+REP]
#1

I do not give the name of the car !

Код HTML:
format(vstring, sizeof(vstring), "%s - %s", NameCar[GetVehicleModel(VehiclesInfo[c1][vServerID])-400], vlock);
ShowPlayerDialog(playerid, DIALOG_V, DIALOG_STYLE_LIST, "Vehicles:", vstring, "Select", "Close");
The function works civilian cars ! But do not work to personal cars
Reply
#2

That doesn't help much. Here are some thoughts.
1. Your NameCar[] array is broken.
2. That "c1" variable doesn't represent the desired vehicle.
Reply
#3

new c1 = PlayerInfo[playerid][pCarKey];
Reply
#4

1. Make sure VehiclesInfo[c1][vServerID] actually stores the vehicle id. And don't just paste some code that says "this = that", i know you are giving vServerID a value. Test it in game (with a debug message) if it actually has the correct vehicle ID stored.
2. Basically there's no other problem there.
Reply
#5

printf("dd: %i", VehiclesInfo[c1][vModel]); // debugging.

LOG: dd: 0
Reply
#6

Told you, something is wrong with your VehiclesInfo[c1] data. Fix it and you're done.
Reply
#7

[+REP]
But how to find the problem VehiclesInfo [ c1 ] [ vModel ] ?
Reply
#8

Since both vModel and vServerID are not set properly, I'm guessing that the function that gives values to these variables is broken.
Reply
#9

Код HTML:
public LoadVehicles()
{
    new tempp[124], TotalVeh;
    cache_get_data(rows, fields);
    while(TotalVeh < rows)
    {
        cache_get_row(TotalVeh, 0, tempp), VehiclesInfo[TotalVeh][vID] = strval(tempp);
        cache_get_row(TotalVeh, 1, tempp), VehiclesInfo[TotalVeh][vModel] = strval(tempp);
        cache_get_row(TotalVeh, 2, tempp), VehiclesInfo[TotalVeh][vPositionX] = floatstr(tempp);
        cache_get_row(TotalVeh, 3, tempp), VehiclesInfo[TotalVeh][vPositionY] = floatstr(tempp);
        cache_get_row(TotalVeh, 4, tempp), VehiclesInfo[TotalVeh][vPositionZ] = floatstr(tempp);
        cache_get_row(TotalVeh, 5, tempp), VehiclesInfo[TotalVeh][vAngle] = floatstr(tempp);
        cache_get_row(TotalVeh, 6, tempp), VehiclesInfo[TotalVeh][vColor1] = strval(tempp);
        cache_get_row(TotalVeh, 7, tempp), VehiclesInfo[TotalVeh][vColor2] = strval(tempp);
        cache_get_row(TotalVeh, 8, tempp), VehiclesInfo[TotalVeh][vPaintJob] = strval(tempp);
        cache_get_row(TotalVeh, 9, tempp), VehiclesInfo[TotalVeh][vOwner] = strval(tempp);
        cache_get_row(TotalVeh, 10, tempp), VehiclesInfo[TotalVeh][vLock] = strval(tempp);
        cache_get_row(TotalVeh, 11, tempp), VehiclesInfo[TotalVeh][vKM] = strval(tempp);
        cache_get_row(TotalVeh, 12, tempp), VehiclesInfo[TotalVeh][vDays] = strval(tempp);
        cache_get_row(TotalVeh, 13, tempp), VehiclesInfo[TotalVeh][vNumberPlate] = strval(tempp);
        cache_get_row(TotalVeh, 14, tempp), VehiclesInfo[TotalVeh][vComponent1] = strval(tempp);
        cache_get_row(TotalVeh, 15, tempp), VehiclesInfo[TotalVeh][vComponent2] = strval(tempp);
        cache_get_row(TotalVeh, 16, tempp), VehiclesInfo[TotalVeh][vComponent3] = strval(tempp);
        cache_get_row(TotalVeh, 17, tempp), VehiclesInfo[TotalVeh][vComponent4] = strval(tempp);
        cache_get_row(TotalVeh, 18, tempp), VehiclesInfo[TotalVeh][vComponent5] = strval(tempp);
        cache_get_row(TotalVeh, 19, tempp), VehiclesInfo[TotalVeh][vComponent6] = strval(tempp);
        cache_get_row(TotalVeh, 20, tempp), VehiclesInfo[TotalVeh][vComponent7] = strval(tempp);
        cache_get_row(TotalVeh, 21, tempp), VehiclesInfo[TotalVeh][vComponent8] = strval(tempp);
        cache_get_row(TotalVeh, 22, tempp), VehiclesInfo[TotalVeh][vComponent9] = strval(tempp);
        cache_get_row(TotalVeh, 23, tempp), VehiclesInfo[TotalVeh][vComponent10] = strval(tempp);
        cache_get_row(TotalVeh, 24, tempp), VehiclesInfo[TotalVeh][vComponent11] = strval(tempp);
        cache_get_row(TotalVeh, 25, tempp), VehiclesInfo[TotalVeh][vComponent12] = strval(tempp);
        cache_get_row(TotalVeh, 26, tempp), VehiclesInfo[TotalVeh][vComponent13] = strval(tempp);
        cache_get_row(TotalVeh, 27, tempp), VehiclesInfo[TotalVeh][vComponent14] = strval(tempp);
        cache_get_row(TotalVeh, 28, tempp), VehiclesInfo[TotalVeh][vComponent15] = strval(tempp);
        cache_get_row(TotalVeh, 29, tempp), VehiclesInfo[TotalVeh][vComponent16] = strval(tempp);
        cache_get_row(TotalVeh, 30, tempp), VehiclesInfo[TotalVeh][vComponent17] = strval(tempp);
        cache_get_row(TotalVeh, 31, tempp), VehiclesInfo[TotalVeh][vServerID] = strval(tempp);
        cache_get_row(TotalVeh, 32, tempp), VehiclesInfo[TotalVeh][vSlot] = strval(tempp);
        TotalVeh++;
    }
    return 1;
}
Reply
#10

Here are some tips on how to find the problem:
1. Add a debug message after each vehicle is loaded, for example:
printf("Vehs: %d | vModel: %d | vServerID: %d", TotalVeh, VehiclesInfo[TotalVeh][vModel], VehiclesInfo[TotalVeh][vServerID]);
This will tell you how many vehicles are created and if they are created as expected.
2. Looks like you're making a major mistake. vServerID is always changing, you can't keep it constant so don't store it in your database.
3. You're having this PlayerInfo[playerid][pCarKey] variable, but make sure that VehiclesInfo[ PlayerInfo[playerid][pCarKey] ] actually stores the info of that specific vehicle and not others.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)