Vehicle Modifications help
#1

pawn Код:
public OnVehicleMod(playerid, vehicleid, componentid)
{
    for(new v = 0; v < MAX_PLAYER_VEHICLES; v++) {
        if(playerVehicles[playerid][v][cID] != INVALID_PLAYER_VEHICLE_ID) {
            updateVehicleModifications(playerid, vehicleid);
            print("valid veh");
        }
    }
    return 1;
}
^^ when they mod their car

pawn Код:
updateVehicleModifications(playerid, vehicleid)
{
    new carid = playerVehicles[playerid][vehicleid][cID];
    new exhaust, frontbumper, rearbumper, roof, spoilers, sideskirt1, sideskirt2, wheels, hydraulics, nitro, hood, lamps, stereo, ventright, ventleft;
    for(new v; v < MAX_PLAYER_VEHICLES; v++) {
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_SPOILER)) {
            if(spoilers >= 1000) { playerVehicles[playerid][carid][cMods][0] = spoilers; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_HOOD)) {
            if(hood >= 1000) { playerVehicles[playerid][carid][cMods][1] = hood; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_ROOF)) {
            if(roof >= 1000) { playerVehicles[playerid][carid][cMods][2] = roof; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_SIDESKIRT)) {
            if(sideskirt1 >= 1000) { playerVehicles[playerid][carid][cMods][3] = sideskirt1; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_LAMPS)) {
            if(lamps >= 1000) { playerVehicles[playerid][carid][cMods][4] = lamps; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_NITRO)) {
            if(nitro >= 1000) { playerVehicles[playerid][carid][cMods][5] = nitro; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_EXHAUST)) {
            if(exhaust >= 1000) { playerVehicles[playerid][carid][cMods][6] = exhaust; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_WHEELS)) {
            if(wheels >= 1000) { playerVehicles[playerid][carid][cMods][7] = wheels; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_STEREO)) {
            if(stereo >= 1000) { playerVehicles[playerid][carid][cMods][8] = stereo; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_HYDRAULICS)) {
            if(hydraulics >= 1000) { playerVehicles[playerid][carid][cMods][9] = hydraulics; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_FRONT_BUMPER)) {
            if(frontbumper >= 1000) { playerVehicles[playerid][carid][cMods][10] = frontbumper; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_REAR_BUMPER)) {
            if(rearbumper >= 1000) { playerVehicles[playerid][carid][cMods][11] = rearbumper; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_VENT_RIGHT)) {
            if(ventright >= 1000) { playerVehicles[playerid][carid][cMods][12] = ventright; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_VENT_LEFT)) {
            if(ventleft >= 1000) { playerVehicles[playerid][carid][cMods][13] = ventleft; }
        }
        if(GetVehicleComponentInSlot(carid, CARMODTYPE_SIDESKIRT)) {
            if(sideskirt2 >= 1000) { playerVehicles[playerid][carid][cMods][14] = sideskirt2; }
        }
        savePlayerVehicles(playerid);
    }
}
This is supposed to update the player vehicle modification slot with the component id, but it doesn't do anything
(It print's valid veh so I am in the right vehicle)

It doesn't even change the variable, so any idea's on this?
(sorry for the code being so long, idk how else to do it)
Reply
#2

I guess the problem's with these shits:
pawn Код:
if(spoilers >= 1000)
Reply
#3

How could I do it then?
Reply
#4

new spoilers,

playerVehicles[playerid][carid][cMods][0] = spoilers;

[cMods][0] = 0 ?

HUH?

Look on the wiki https://sampwiki.blast.hk/wiki/Saving_car_mods
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)