Vehicle not created?
#1

Ok. I edited a bit of my code to discover DestroyVehicle wasn't the actual problem. The problem (I think) is that the vehicle doesn't get created.
Код:
stock CreateVehicleEx(vehicletype,Float:x,Float:y,Float:z,Float:rot,color1,color2,resp,owner[],cost)
{
	VehicleCount++;
	new str[128];
	format(str,128,"WSSFILES/CARDATA/%d.xcu",VehicleCount);
	if(fexist(str))
	{
	  VehicleVar[VehicleCount][vtype]=djInt(str,"VehicleType",false);
	  VehicleVar[VehicleCount][carX]=djFloat(str,"X",false);
	  VehicleVar[VehicleCount][carY]=djFloat(str,"Y",false);
	  VehicleVar[VehicleCount][carZ]=djFloat(str,"Z",false);
	  VehicleVar[VehicleCount][carRot]=djFloat(str,"Rot",false);
		VehicleVar[VehicleCount][vcolor1]=djInt(str,"color1",false);
		VehicleVar[VehicleCount][vcolor2]=djInt(str,"color2",false);
	  VehicleVar[VehicleCount][resp_time]=djInt(str,"Resp",false);
	  CreateVehicle(VehicleVar[VehicleCount][vtype],VehicleVar[VehicleCount][carX],VehicleVar[VehicleCount][carY],VehicleVar[VehicleCount][carZ],VehicleVar[VehicleCount][carRot],VehicleVar[VehicleCount][vcolor1],VehicleVar[VehicleCount][vcolor2],VehicleVar[VehicleCount][resp_time]);
	  format(VehicleVar[VehicleCount][ownername],24,"%s",dj(str,"Owner",false));
		VehicleVar[VehicleCount][value]=djInt(str,"Cost",false);
	}
	else
	{
		// ....
	}
 	if(!strcmp(VehicleVar[VehicleCount][ownername],"ForSale"))
 	{
		VehicleVar[VehicleCount][locked]=0;
 	}
  	if(!strcmp(VehicleVar[VehicleCount][ownername],"SFPD"))
  	{
		VehicleVar[VehicleCount][locked]=1;
 	}
	VehicleVar[VehicleCount][engine]=0;
	return VehicleCount;
}
VehicleCount; is for counting Vehicle IDs
EDIT: Yes I forgot to say that at the end no vehicle is created. BTW sorry for indentation, the forum fucks it up

Please help me get why the vehicles aren't getting created/get destroyed!

Thanx
Reply
#2

*bump*
Reply
#3

Quote:
Originally Posted by Y_Leѕѕ
Why are you creating a vehicle then loading another vehicle with information about that vehicle from a file? Why not just load the information in the first place?
Because I need the actual vehicle ID to know which file I should get the data from.
Reply
#4

Updated problem... See first post
Reply
#5

Does the file exist ? Also, add debug messages at every ~third line so you'll see where it gets stuck
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)