26.12.2012, 14:58
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;
}
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);
}
}
(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)