Need Help With Tuned Cars
#1

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 ?
Reply
#2

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 https://sampwiki.blast.hk/wiki/OnVehicleSpawn
Reply
#3

Quote:
Originally Posted by iggy1
Посмотреть сообщение
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 https://sampwiki.blast.hk/wiki/OnVehicleSpawn
I Tryed It dude nothing happened the same thing kept on repeating .
Reply
#4

Please post the code that puts the mod back on the vehicle after it re-spawns.
Reply
#5

Ok. This is code .

pawn Код:
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;
}
Reply
#6

You are returning 1 inside your loop only allowing it to iterate once.

pawn Код:
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;
}
Reply
#7

So I should return 0 ?
Reply
#8

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.
Reply
#9

Quote:
Originally Posted by iggy1
Посмотреть сообщение
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
pawn Код:
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?
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)