Vehicle ID is -1? -
Ash. - 11.12.2010
Hi all,
I really dont know how to explain the problem i am having, but here it goes:
I have the following code:
pawn Код:
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)
- The vehicle that all that corresponds to works correctly, however the vehicle id becaomes -1. I have tried doing:
pawn Код:
printf("%i", 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));
and it still gives me -1.
Has anyone else had this error before? + Does anyone know a fix?
Re: Vehicle ID is -1? -
[MF]FACE - 11.12.2010
Well i think, the %i is connected to , -1 at the end. Already tried change the -1 to another value?
Re: Vehicle ID is -1? -
Ash. - 11.12.2010
I changed it to 23 (random number generator - dont ask) - it's still -1. The vehicle does spawn, but the server gives every single one that uses the above code, the id -1
Re: Vehicle ID is -1? -
[MF]FACE - 11.12.2010
You can't print a complete Function I think.You should write a printer which shows you the VehicleID.
But what do you want to print there?
Model, coulour? or only the ID?
Re: Vehicle ID is -1? -
Ash. - 11.12.2010
Correct, you cant print a complete function, but if you put it in print, it prints whatever it returns, rather than the information in the function.
I have a stock that should load a specified vehicle from a file. Here is the stock - You will be able to see that i am trying to attach that vehicle to an array.
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"), 23);
printf("%i", Vehicles[vid]); //Here i tried to print the id, it still gave -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);
}
Re: Vehicle ID is -1? -
Ash. - 11.12.2010
Bump - Sorry, anyone got anything?