Untune vehicle command. -
OleKristian95 - 02.08.2011
Hey all ^^
Today I would like to know if its possible to make an untune command,
That removes all tuning on vehicles and works permanent even on cars that players own.
I was hoping someone could make a command like that for me

^^
Re: Untune vehicle command. -
Calgon - 02.08.2011
Yes, it's very possible.
pawn Код:
CMD:untunemycar(playerid, params[]) {
for(new i = 0; i < 14; i++){
RemoveVehicleComponent(GetPlayerVehicleID(playerid), GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), i));
}
return 1;
}
Re: Untune vehicle command. -
OleKristian95 - 02.08.2011
Thanks, I'll try it out.
Re: Untune vehicle command. -
OleKristian95 - 02.08.2011
Nope that didn't work, it removed the tunings but when the vehicles got respawned it was back.
EDIT: Didnt even remove the tuning colors
Re: Untune vehicle command. -
Calgon - 02.08.2011
"Tunings" as you say are removed from a vehicle when it is destroyed (not despawned), so some code in your script is probably working against the code and respawning the mods when the car respawns.
Show us some example code with your vehicle mods, like when a vehicle spawns - show us the code used to spawn a vehicle (presumably for a player).
Re: Untune vehicle command. -
OleKristian95 - 02.08.2011
I dont understand..
I'm using this gamemode if you want to take a look for me:
SATDM~RP v9_Final
Re: Untune vehicle command. -
Calgon - 02.08.2011
I'm not downloading 17.9mb just to get a function from you. Try read my post properly, or pastebin your script.
Re: Untune vehicle command. -
OleKristian95 - 02.08.2011
Maybe this is what you want:
pawn Код:
//--------------------------------Load Vehicles---------------------------------
vehcount = CountVehicles(V_FILE_LOAD);
LoadVehicles();
for(new c=1;c<=vehcount;c++)
{
ModVehicle(c);
}
pawn Код:
stock ModVehicle(vehicleid)
{
new tuned2 = 0;
if(VehicleInfo[vehicleid][mod1] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod1]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod2] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod2]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod3] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod3]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod4] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod4]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod5] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod5]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod6] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod6]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod7] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod7]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod8] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod8]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod9] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod9]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod10] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod10]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod11] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod11]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod12] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod12]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod13] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod13]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod14] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod14]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod15] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod15]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod16] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod16]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][mod17] != 0) {
AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod17]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][color_1] > -1 || VehicleInfo[vehicleid][color_2] > -1) {
ChangeVehicleColor(vehicleid,VehicleInfo[vehicleid][color_1],VehicleInfo[vehicleid][color_2]);
tuned2 = 1;
}
if(VehicleInfo[vehicleid][paintjob] > -1) {
ChangeVehiclePaintjob(vehicleid,VehicleInfo[vehicleid][paintjob]);
tuned2 = 1;
}
if(tuned2 == 1) {
tuned++;
}
}
I got much more that maybe can be what you need to but take a look at this first
Re: Untune vehicle command. -
Calgon - 02.08.2011
Yes, that's the code.
pawn Код:
CMD:untunemycar(playerid, params[]) {
new
vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == 0)
return SendClientMessage(playerid, 0, "Invalid vehicle ID");
for(new i = 0; i < 14; i++){
RemoveVehicleComponent(vehicleid, GetVehicleComponentInSlot(vehicleid, i));
}
VehicleInfo[vehicleid][mod1] = 0;
VehicleInfo[vehicleid][mod2] = 0;
VehicleInfo[vehicleid][mod3] = 0;
VehicleInfo[vehicleid][mod4] = 0;
VehicleInfo[vehicleid][mod5] = 0;
VehicleInfo[vehicleid][mod6] = 0;
VehicleInfo[vehicleid][mod7] = 0;
VehicleInfo[vehicleid][mod8] = 0;
VehicleInfo[vehicleid][mod9] = 0;
VehicleInfo[vehicleid][mod10] = 0;
VehicleInfo[vehicleid][mod11] = 0;
VehicleInfo[vehicleid][mod12] = 0;
VehicleInfo[vehicleid][mod13] = 0;
VehicleInfo[vehicleid][mod14] = 0;
VehicleInfo[vehicleid][mod15] = 0;
VehicleInfo[vehicleid][mod16] = 0;
VehicleInfo[vehicleid][mod17] = 0;
VehicleInfo[vehicleid][paintjob] = -1;
VehicleInfo[vehicleid][color_2] = -1;
VehicleInfo[vehicleid][color_1] = -1;
return 1;
}
Re: Untune vehicle command. -
OleKristian95 - 02.08.2011
THANK YOU ALOT!