18.09.2010, 10:39
Hey, well i'm working on a vehicle system and i have a small problem that i'm struggling to solve.
Here is the stock:
When a car is bought this stock is being called out.
Everything works well except from the vehicle spawn, it doesn't create a vehicle and i don't understand why.
If you figure it our, thanks!
Here is the stock:
PHP код:
stock AddCar(CarModel,Float:X,Float:Y,Float:Z,Float:A,color1,color2,playerid,cPrice)
{
new file[164];
carCount++;
format(file,sizeof(file),"RP/Cars/%d.car",carCount);
while(dini_Exists(file)) carCount++;
dini_Create(file);
dini_IntSet(file,"Model",CarModel);
dini_FloatSet(file,"X",X);
dini_FloatSet(file,"Y",Y);
dini_FloatSet(file,"Z",Z);
dini_FloatSet(file,"Angle",A);
dini_Set(file,"Owner",GetName(playerid));
dini_IntSet(file,"Price",cPrice);
dini_IntSet(file,"Color1",color1);
dini_IntSet(file,"Color2",color2);
dini_IntSet(file,"TrunkM",0);
dini_IntSet(file,"TrunkG1",0);
dini_IntSet(file,"TrunkA1",0);
dini_IntSet(file,"TrunkG2",0);
dini_IntSet(file,"TrunkA2",0);
dini_IntSet(file,"TrunkG3",0);
dini_IntSet(file,"TrunkA3",0);
new rand = random((10000000 + 2500000)/2);
dini_IntSet(file,"Key",rand);
GiveHMoney(playerid,-cPrice);
new id = CreateVehicle(CarModel,340.5165,-1337.5707,14.1347, 29.8872,color1,color2,60000);
vehLocked[id] = 1;
vehSystemKey[id] = rand;
vehSellID[id] = carCount;
new KeyNumber = 0;
for(new i=0;i<3;i++) if(VehicleKeys[playerid][i] != 0) KeyNumber++;
VehicleKeys[playerid][KeyNumber] = rand;
return 1;
}
Everything works well except from the vehicle spawn, it doesn't create a vehicle and i don't understand why.
If you figure it our, thanks!