29.09.2012, 15:47
(
Last edited by SkullMaster73; 10/10/2012 at 06:29 PM.
)
Hello today i'm gonna teach you how to script Tunned Cars.
Part 1 - Define your tuned car. Goes as the following:
At the top of your script add:
For example:
Part 2. - Under OnGameModeInIt We add the declare.
The carID is the ID of the vehicle we want to give the component to (the name of the vehicle, in this case "tunnedElegy". The componentID is the ID of the car part which you wish to give to your vehicle.
For example:
This will give us all of our components we need. However we also need a paint job. So we use a different function for this called "
the Id we are using is either 0,1 or 2. In this example i am using 1. So i will add this to the TOP of the list of components. We now have this:
Part 3 - Adding them to OnVehicleSpawn.
Under OnVehicleSpawn add the same AddVehicleComponents.
Part 4 - You are Finished
Compile and your tunned car will be waiting for you!
You can find component id's here:
https://sampwiki.blast.hk/wiki/Car_Component_ID
If u need any help, you can always ask me for help!
Goodluck!
Part 1 - Define your tuned car. Goes as the following:
At the top of your script add:
For example:
pawn Code:
new tunnedElegy;
pawn Code:
tunnedElegy = AddStaticVehicle(CODE HERE);//This will be your Car
AddVehicleComponent(tunnedElegy, componentid);//Here will be your component's for the car
pawn Code:
AddVehicleComponent(carID, ComponentID);
For example:
pawn Code:
public OnGameModeInit()
{
tunnedElegy = AddStaticVehicle(CODE HERE);
AddVehicleComponent(tunnedElegy, 1035); // roof
AddVehicleComponent(tunnedElegy, 1079); // rim
AddVehicleComponent(tunnedElegy, 1037); // exhaust
AddVehicleComponent(tunnedElegy, 1039); // side
AddVehicleComponent(tunnedElegy, 1172); // front
AddVehicleComponent(tunnedElegy, 1148); // back
AddVehicleComponent(tunnedElegy, 1146); // Spoiler
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
pawn Code:
ChangeVehiclePaintjob(carid,paintjobid);
pawn Code:
public OnGameModeInit()
{
tunnedElegy = AddStaticVehicle(CODE HERE);
ChangeVehiclePaintjob(tunnedElegy,1); // paint job
AddVehicleComponent(tunnedElegy, 1035); // roof
AddVehicleComponent(tunnedElegy, 1079); // rim
AddVehicleComponent(tunnedElegy, 1037); // exhaust
AddVehicleComponent(tunnedElegy, 1039); // side
AddVehicleComponent(tunnedElegy, 1172); // front
AddVehicleComponent(tunnedElegy, 1148); // back
AddVehicleComponent(tunnedElegy, 1146); // Spoiler
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
Under OnVehicleSpawn add the same AddVehicleComponents.
pawn Code:
public OnVehicleSpawn(vehicleid)
{
if (vehicleid == tunnedElegy){
ChangeVehiclePaintjob(tunnedElegy,1); // paint job
AddVehicleComponent(tunnedElegy, 1035); // roof
AddVehicleComponent(tunnedElegy, 1079); // rim
AddVehicleComponent(tunnedElegy, 1037); // exhaust
AddVehicleComponent(tunnedElegy, 1039); // side
AddVehicleComponent(tunnedElegy, 1172); // front
AddVehicleComponent(tunnedElegy, 1148); // back
AddVehicleComponent(tunnedElegy, 1146); // Spoiler
}
return 1;
}
Compile and your tunned car will be waiting for you!
You can find component id's here:
https://sampwiki.blast.hk/wiki/Car_Component_ID
If u need any help, you can always ask me for help!
Goodluck!