06.02.2017, 15:09
You are directly using the ID you get from the game as the array index, What makes you think that the i you set is the same as CreateVehicle?
Here's 3 options for you;
1- You need to load the data into a dummy array, then create the vehicle and use that as the index to insert the data into if you want to be able to use the GetPlayerVehicleID as the index.
2- Or you should change that creating part to
and then loop pvehicle to find the index.
3- or an alternative way would be creating a global array to link them then do
now you can use vArrayIndex[GetPlayerVehicleID(playerid)] as your index for the array.
Here's 3 options for you;
1- You need to load the data into a dummy array, then create the vehicle and use that as the index to insert the data into if you want to be able to use the GetPlayerVehicleID as the index.
2- Or you should change that creating part to
Quote:
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]); |
3- or an alternative way would be creating a global array to link them then do
PHP код:
new veh= CreateVehicle(...)
vArrayIndex[veh]=i;