08.01.2013, 09:56
Whats the problem with this it should load the cars but its not loading i tryed debbuging it but it seems something is wrong : i added this on ongamemodeinit :
pawn Код:
CreateCars();
printf("creatcars done");
pawn Код:
stock CreateCars(){
new
nomefile[32];
for(new r = 1; r<sizeof(Vehicles)+1; r++)
{
new ownername[MAX_PLAYER_NAME] = "NoBodY";
new dupekeys[MAX_PLAYER_NAME] = "NoBody";
// new platename[MAX_PLAYER_NAME] = "LV";
format(nomefile, sizeof(nomefile),"cars/Car%d.txt",Vehicles[r][cID]);
// new p[32];
//format(p,sizeof(p),"cars/Car%d.txt",Vehicles[r][
if (!dini_Exists(nomefile))
{
dini_Create(nomefile);
dini_IntSet(nomefile,"id", Vehicles[r][cID]);
dini_Set(nomefile,"owner", ownername);
dini_Set(nomefile,"dupekey",dupekeys);
//dini_IntSet(nomefile,"locked",0);
dini_Set(nomefile,"owned", Vehicles[r][cOwned]);
dini_IntSet(nomefile,"security", Vehicles[r][cSecurity]);
dini_IntSet(nomefile,"model", Vehicles[r][carmodel]);
dini_FloatSet(nomefile,"X", Vehicles[r][cX]);
dini_FloatSet(nomefile,"Y", Vehicles[r][cY]);
dini_FloatSet(nomefile,"Z", Vehicles[r][cZ]);
dini_FloatSet(nomefile,"Angle", Vehicles[r][cAngle]);
dini_IntSet(nomefile,"Color1", Vehicles[r][cColor1]);
dini_IntSet(nomefile,"Color2", Vehicles[r][cColor2]);
dini_IntSet(nomefile,"cartype", Vehicles[r][cartype]);
dini_IntSet(nomefile,"modeltype", Vehicles[r][modeltype]);
dini_Set(nomefile,"jobname", Vehicles[r][jobname]);
dini_IntSet(nomefile,"biznumber", Vehicles[r][biznumber]);
dini_IntSet(nomefile,"carteam", Vehicles[r][carteam]);
dini_IntSet(nomefile,"forsale", Vehicles[r][forsale]);
dini_IntSet(nomefile,"carvalue", Vehicles[r][carvalue]);
dini_IntSet(nomefile,"alarm", Vehicles[r][cAlarm]);
dini_IntSet(nomefile,"locked", Vehicles[r][cLocked]);
dini_IntSet(nomefile,"spoiler",INVALID_COMPONENT);
dini_IntSet(nomefile,"hood",INVALID_COMPONENT);
dini_IntSet(nomefile,"roof",INVALID_COMPONENT);
dini_IntSet(nomefile,"sideskirt",INVALID_COMPONENT);
dini_IntSet(nomefile,"lamps",INVALID_COMPONENT);
dini_IntSet(nomefile,"nitro",INVALID_COMPONENT);
dini_IntSet(nomefile,"exhaust",INVALID_COMPONENT);
dini_IntSet(nomefile,"wheels",INVALID_COMPONENT);
dini_IntSet(nomefile,"stereo",INVALID_COMPONENT);
dini_IntSet(nomefile,"hydraulics",INVALID_COMPONENT);
dini_IntSet(nomefile,"frontbumper",INVALID_COMPONENT);
dini_IntSet(nomefile,"rearbumper",INVALID_COMPONENT);
dini_IntSet(nomefile,"rightvent",INVALID_COMPONENT);
dini_IntSet(nomefile,"leftvent",INVALID_COMPONENT);
dini_IntSet(nomefile,"paintjob",0);
dini_Set(nomefile,"plate", "LV");
dini_IntSet(nomefile,"impounded",0);
dini_IntSet(nomefile,"impoundfee",0);
new string1[30];
format(string1, sizeof(string1),"LV - %d", Vehicles[r][cID]);
SetVehicleNumberPlate(Vehicles[r][cID], string1);
//SetVehicleNumberPlate(Vehicles[r][cID],dini_Get(nomefile,"plate"));
}
else
{
Vehicles[r][cID] = Vehicles[r][cID];
format( Vehicles[r][cOwner], 32, "%s", dini_Get(nomefile,"owner"));
Vehicles[r][cOwned] = dini_Int(nomefile,"owned");
format( Vehicles[r][cDupe], 32, "%s", dini_Get(nomefile,"dupekey"));
Vehicles[r][carmodel] = dini_Int(nomefile,"model");
// Vehicles[r][cLocked] = dini_Int(nomefile,"locked");
Vehicles[r][cX] = dini_Float(nomefile, "X");
Vehicles[r][cY] = dini_Float(nomefile, "Y");
Vehicles[r][cZ] = dini_Float(nomefile, "Z");
Vehicles[r][cSecurity] = dini_Int(nomefile, "security");
Vehicles[r][cAngle] = dini_Float(nomefile, "Angle");
Vehicles[r][cColor1] = dini_Int(nomefile, "Color1");
Vehicles[r][cColor2] = dini_Int(nomefile, "Color2");
Vehicles[r][cartype] = dini_Int(nomefile, "cartype");
Vehicles[r][modeltype] = dini_Int(nomefile, "modeltype");
Vehicles[r][biznumber] = dini_Int(nomefile, "biznumber");
//Vehicles[r][spoiler] = dini_Int(nomefile,"spoiler");//ddVehicleComponent(vehicleid,dini_Int(p,"spoiler"));
Vehicles[r][carteam] = dini_Int(nomefile, "carteam");
Vehicles[r][forsale] = dini_Int(nomefile, "forsale");
Vehicles[r][carvalue] = dini_Int(nomefile, "carvalue");
Vehicles[r][cAlarm] = dini_Int(nomefile, "alarm");
Vehicles[r][cLocked] = dini_Int(nomefile, "locked");
format( Vehicles[r][jobname], 32, "%s", dini_Get(nomefile,"jobname"));
// format( Vehicles[r][plate], 32, "%s", dini_Get(nomefile,"Plate"));
//SetVehicleNumberPlate(Vehicles[r][cID],dini_Get(nomefile,"plate"));
Vehicles[r][impounded] = dini_Int(nomefile, "impounded");
Vehicles[r][impoundfee] = dini_Int(nomefile, "impoundfee");
/*if((Vehicles[r][carteam]==CORLEONE || Vehicles[r][carteam]==STRACCI || Vehicles[r][carteam]==CUNEO || Vehicles[r][carteam]==SICILIONE || Vehicles[r][carteam]==TATTAGLIA || Vehicles[r][carteam]==BARZINI) && Vehicles[r][modeltype]==0 && Vehicles[r][carmodel]!=409)
{
new nomefilee[32],line[32];
new teampos = GetTeam(Vehicles[r][carteam]);
format(nomefilee,sizeof(nomefilee),"Team-%s.txt",teams[teampos][teamname]);
format(line,sizeof(line),"car%d",Vehicles[r][cfilepos]);
new modelll=dini_Int(nomefilee,line);
Vehicles[r][carmodel]=modelll;
CreateVehicle(modelll, Vehicles[r][cX], Vehicles[r][cY], Vehicles[r][cZ], Vehicles[r][cAngle], Vehicles[r][cColor1], Vehicles[r][cColor2], 600);
}
else*/
AddStaticVehicleEx(Vehicles[r][carmodel], Vehicles[r][cX], Vehicles[r][cY], Vehicles[r][cZ], Vehicles[r][cAngle], Vehicles[r][cColor1], Vehicles[r][cColor2], 600);
if(dini_Int(nomefile,"hood") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"hood"));
if(dini_Int(nomefile,"roof") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"roof"));
if(dini_Int(nomefile,"sideskirt") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"sideskirt"));
if(dini_Int(nomefile,"lamps") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"lamps"));
if(dini_Int(nomefile,"nitro") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"nitro"));
//SetVehicleNumberPlate(vehicleid,dini_Get(p,"plate"));
if(dini_Int(nomefile,"exhaust") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"exhaust"));
if(dini_Int(nomefile,"wheels") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"wheels"));
if(dini_Int(nomefile,"stereo") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"stereo"));
if(dini_Int(nomefile,"hydraulics") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"hydraulics"));
if(dini_Int(nomefile,"frontbumper") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"frontbumper"));
if(dini_Int(nomefile,"rearbumper") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"rearbumper"));
if(dini_Int(nomefile,"rightvent") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"rightvent"));
if(dini_Int(nomefile,"leftvent") != INVALID_COMPONENT) AddVehicleComponent(Vehicles[r][cID],dini_Int(nomefile,"leftvent"));
new string12[30];
format(string12, sizeof(string12),"LV - %d", Vehicles[r][cID]);
SetVehicleNumberPlate(Vehicles[r][cID], string12);
SetVehicleToRespawn(Vehicles[r][cID]);
}
}
printf("Cars created/loaded");
return 1;
}