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;
}
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;
}
CMD:testcar(playerid)
{
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;
}
As I said, they load right
Vehicle ID: 1, LOADED, Owner: Government, Type: 2 Vehicle ID: 2, LOADED, Owner: Government, Type: 2 Vehicle ID: 11, LOADED, Owner: Noone, Type: 3 something is wrong with the enum... |
CMD:testcar(playerid, params[])
{
new string[200];
new i = GetPlayerVehicleID(playerid);
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;
}
for(new i; i < MAX; i++)
if(GetPlayerVehicleID(playerid) == i)
//your code down here
GetVehicleArrayID(vehid)
{
for(new i; i < MAX_PVEHICLES; i++)
if(pvehicle[i]==vehid) return i;
return INVALID_VEHICLE_ID
}