04.12.2010, 18:04
(
Последний раз редактировалось Ash.; 11.12.2010 в 15:42.
)
5th Dec - Resolved
Hi all,
I have a 'stock' to load a vehicle from its file, however when i go to spawn the vehicle and associate that vehicle (and its id) to an array, it becomes -1. The vehicle still spawns, but according to the array, the vehicle id is -1 (this is for all vehicles)
Here is the 'LoadVehicle' stock
If i wanted to load all vehicles, i would do this...
Has anyone got any ideas? Its probably a stupid error knowing me ![Sad](images/smilies/sad.gif)
Thanks in advance
Ash
Hi all,
I have a 'stock' to load a vehicle from its file, however when i go to spawn the vehicle and associate that vehicle (and its id) to an array, it becomes -1. The vehicle still spawns, but according to the array, the vehicle id is -1 (this is for all vehicles)
Here is the 'LoadVehicle' stock
pawn Код:
stock LoadVehicle(vid)
{
DestroyVehicle(Vehicles[vid]);
DestroyDynamic3DTextLabel(VehicleText[vid]);
new file[64], string[64], Float:x, Float:y, Float:z;
format(file, sizeof(file), "vehicles/%i.veh", vid);
Vehicles[vid] = CreateVehicle(dini_Int(file, "Model"), dini_Float(file, "x"), dini_Float(file, "y"), dini_Float(file, "z"), dini_Float(file, "rot"), dini_Int(file, "Colour1"), dini_Int(file, "Colour2"), -1);
format(string, sizeof(string), "This vehicle is owned by %s\nIt cost %i", dini_Get(file, "Owner"), dini_Int(file, "Cost"));
GetVehiclePos(Vehicles[vid], x, y, z);
VehicleText[vid] = CreateDynamic3DTextLabel(string, COLOUR, x, y, z, 5.0, -1, Vehicles[vid], 0, -1, -1, -1, 100.0);
printf("%i", Vehicles[vid]); //is -1
}
pawn Код:
for(new i; i < LastID; i++) // Last ID is a variable that is saved to file on filterscript close, and the number is retrieved on filterscript init - this means less looping because i dont have to go through till my max vehicle limit
{
LoadVehicle(i);
}
![Sad](images/smilies/sad.gif)
Thanks in advance
Ash