06.02.2017, 17:31
I have this enum
vInfo aka VehicleInfo[MAX_PLAYERS]
I load the vehicles by this public using a loop.
From that I understand that the loop will run until it loops trough all the cars in the database, example 3 at the moment.
Each car will be assigned to a vehicle info in this way
VehicleInfo[1]...
VehicleInfo[2]...
VehicleInfo[3]...
and stop because thats all the vehicles.
Isn't it normal to get the data from that enum when I call it? Example this command:
This loop will run until it reaches 200, max pvehicles.
And it starts
VehicleInfo[1]...
VehicleInfo[2]...
VehicleInfo[3]...
But if I use the command, I get 0 on vehicle ID, vtype etc
Shouldn't this command take the information that was stored in the enum and use it in that format..?
This is my logic..
vInfo aka VehicleInfo[MAX_PLAYERS]
I load the vehicles by this public using a loop.
PHP код:
public OnVehiclesAvailable()
{
new rows;
cache_get_row_count(rows);
for(new i; i < rows; i++)
{
cache_get_value_int(i, "ID", VehicleInfo[i][ID]);
cache_get_value(i, "Owner", VehicleInfo[i][vOwner], 24);
cache_get_value_int(i, "vModel", VehicleInfo[i][vModel]);
cache_get_value_float(i, "Pos_x", VehicleInfo[i][vPos_x]);
cache_get_value_float(i, "Pos_y", VehicleInfo[i][vPos_y]);
cache_get_value_float(i, "Pos_z", VehicleInfo[i][vPos_z]);
cache_get_value_float(i, "Rot", VehicleInfo[i][vRot]);
cache_get_value_int(i, "Fuel", VehicleInfo[i][vFuel]);
cache_get_value_int(i, "Type", VehicleInfo[i][vType]);
cache_get_value(i, "Plate", VehicleInfo[i][vPlate], 120);
cache_get_value_int(i, "vLock", VehicleInfo[i][vLock]);
cache_get_value_int(i, "Color1", VehicleInfo[i][vColor1]);
cache_get_value_int(i, "Color2", VehicleInfo[i][vColor2]);
cache_get_value_int(i, "RespawnDelay", VehicleInfo[i][vRespawnDelay]);
cache_get_value_int(i, "Price", VehicleInfo[i][vPrice]);
//VehicleInfo[i][Vehicle_Cache] = cache_save();
pvehicle[i] = CreateVehicle(VehicleInfo[i][vModel], VehicleInfo[i][vPos_x], VehicleInfo[i][vPos_y], VehicleInfo[i][vPos_z], VehicleInfo[i][vRot], VehicleInfo[i][vColor1], VehicleInfo[i][vColor2], VehicleInfo[i][vRespawnDelay]);
SetVehicleNumberPlate(pvehicle[i], VehicleInfo[i][vPlate]);
}
return 1;
}
Each car will be assigned to a vehicle info in this way
VehicleInfo[1]...
VehicleInfo[2]...
VehicleInfo[3]...
and stop because thats all the vehicles.
Isn't it normal to get the data from that enum when I call it? Example this command:
PHP код:
CMD:testcar(playerid, params[])
{
new string[200];
for(new i; i < MAX_PVEHICLES; i++)
format(string, sizeof(string), "Vehicle ID: %d | Vehicle Type: %d, Plate: %s | Owner: %s", VehicleInfo[i][ID], VehicleInfo[i][vType], VehicleInfo[i][vPlate], VehicleInfo[i][vOwner] );
SCM(playerid, COLOR_YELLOW, string);
return 1;
}
And it starts
VehicleInfo[1]...
VehicleInfo[2]...
VehicleInfo[3]...
But if I use the command, I get 0 on vehicle ID, vtype etc
Shouldn't this command take the information that was stored in the enum and use it in that format..?
This is my logic..