How to script Tunned Cars -
SkullMaster73 - 29.09.2012
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.
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);
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:
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;
}
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 "
pawn Code:
ChangeVehiclePaintjob(carid,paintjobid);
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:
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;
}
Part 3 - Adding them to OnVehicleSpawn.
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;
}
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!
Re: How to create Tunnec Cars in your script -
HyDrAtIc - 29.09.2012
I didn't like this actually
but good work also use [pawn][ /pawn] not [code] tags and explain more..
Re: How to script Tunned Cars -
SkullMaster73 - 29.09.2012
okey and thanks
Re: How to script Tunned Cars -
[HK]Ryder[AN] - 29.09.2012
not bad..could be better
Re: How to script Tunned Cars -
SkullMaster73 - 30.09.2012
thanks
Re: How to script Tunned Cars -
Ayumi - 02.10.2012
Could be better, but still... It's a great tutorial! Many people will endure this and use this I believe, as I know a lot of people have been wondering how to do this. (That are new to the scripting scene).
Re: How to script Tunned Cars -
Ghost_Boii - 02.10.2012
Nice and useful
Re : How to script Tunned Cars -
Allerre - 02.10.2012
Nice
Re: How to script Tunned Cars -
SkullMaster73 - 06.10.2012
Thank you all.