PDA

View Full Version : Need Help With Tuned Cars


-=Dar[K]Lord=-
02/04/2013, 08:12 AM
Guys I have Just Edited The GarHouse And Made A Tuned Car For It. It Has Switch Wheels , but when it respawns it does not have those wheels it has its original wheels . IS There Any Solution for it ?

iggy1
02/04/2013, 08:16 AM
Mods need to be put on cars each time it spawns IIRC, so create a function that spawns a modded car.

Or use this callback maybe http://wiki.sa-mp.com/wiki/OnVehicleSpawn

-=Dar[K]Lord=-
02/04/2013, 08:19 AM
Mods need to be put on cars each time it spawns IIRC, so create a function that spawns a modded car.

Or use this callback maybe http://wiki.sa-mp.com/wiki/OnVehicleSpawn

I Tryed It dude nothing happened the same thing kept on repeating .

iggy1
02/04/2013, 08:20 AM
Please post the code that puts the mod back on the vehicle after it re-spawns.

-=Dar[K]Lord=-
02/04/2013, 08:22 AM
Ok. This is code .


public OnVehicleSpawn(vehicleid)
{
Loop(h,MAX_HOUSES)
{
if(vehicleid == HouseCar[h])
{
new file[256];
format(file,sizeof(file),FILEPATH,h);
AddVehicleComponent(vehicleid,dini_Int(file,"HCarWheels"));
}
return 1;
}
return 1;
}

iggy1
02/04/2013, 08:23 AM
You are returning 1 inside your loop only allowing it to iterate once.

public OnVehicleSpawn(vehicleid)
{
Loop(h,MAX_HOUSES)
{
if(vehicleid == HouseCar[h])
{
new file[256];
format(file,sizeof(file),FILEPATH,h);
AddVehicleComponent(vehicleid,dini_Int(file,"HCarWheels"));
return 1;//return only if vehicle is found.
}
}
return 1;
}

-=Dar[K]Lord=-
02/04/2013, 08:25 AM
So I should return 0 ?

iggy1
02/04/2013, 08:26 AM
I edited my post, your code was returning after the first iteration. See the difference between the code you posted and the code i posted. (see comment) The return value doesn't matter in this case, just the fact that you are returning after the first iteration.

-=Dar[K]Lord=-
02/04/2013, 08:30 AM
I edited my post, your code was returning after the first iteration. See the difference between the code you posted and the code i posted. (see comment) The return value doesn't matter in this case, just the fact that you are returning after the first iteration.

still not working...

EDIT:-

If I Remove That

if(vehicleid == HouseCar[h])

It Respawns With The mod , but with it every car respawns with that mod i know if i remove that it wont check whether its a housecar , but is there a solution for it?

iggy1
02/04/2013, 08:32 AM
Put some prints down, see what dini_int is returning. Try to narrow the problem down for us, else we are just shooting in the dark.

EDIT: Your problem is most likely the HouseCar array doesn't hold the correct value, after seeing the edit above.

-=Dar[K]Lord=-
02/04/2013, 08:34 AM
Put some prints down, see what dini_int is returning. Try to narrow the problem down for us, else we are just shooting in the dark.

Amm may i give you the whole code it will be better :|

iggy1
02/04/2013, 08:42 AM
After seeing your edit i know your HouseCar array is not holding the correct value.

Send me the relevant code and ill have a look, cba looking through a GM tho.