[Tutorial] ChangeVehiclePaintjob Tutorial - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] ChangeVehiclePaintjob Tutorial (
/showthread.php?tid=312747)
ChangeVehiclePaintjob Tutorial -
JustLuca - 22.01.2012
The ChangeVehiclePaintjob is a function for change the paintjob of vehicles, for example, in SinglePlayer if you have a Sultan and you go in a Well Arch Angel.
This is the function:
ChangeVehiclePaintjob(vehicleid, paintjobid);
vehicleid : Is the id of vehicle do you want change the paintjob.
paintjobid : Is the id of the paintjob, the paintjob IDs are this:
0=Paintjob 1
1=Paintjob 2
2=Paintjob 3
This is an example how to use this function.
Code:
if (strcmp("/paintjob", cmdtext, true, 8) == 0) //This is the cmd, this line let to the player when type this to use the command.
{
if(IsPlayerInAnyVehicle(playerid)) //This check if you are in a vehicle
{
ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 0); //The GetPlayerVehicleID(playerid) get the carid of the car, and the 0 restores the paintjob.
return 1;
}
}
See later.
Re: ChangeVehiclePaintjob Tutorial -
System64 - 22.01.2012
Tutorial fail.
1. One function, we use wiki for one function
2.
pawn Code:
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"You must are in a vehicle"); //This dont make the cmd work if you are not in the vehicle, the ! is if you are not in a vehicle so the return dont allows you to make the cmd when you are not in vehicle.
{
U mad? you use return and then opening brackets, no sense!
Re: ChangeVehiclePaintjob Tutorial -
JustLuca - 22.01.2012
Quote:
Originally Posted by System64
Tutorial fail.
1. One function, we use wiki for one function
2.
pawn Code:
{ if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"You must are in a vehicle"); //This dont make the cmd work if you are not in the vehicle, the ! is if you are not in a vehicle so the return dont allows you to make the cmd when you are not in vehicle. {
U mad? you use return and then opening brackets, no sense!
|
Yah I fail'd, but relax.
Re: ChangeVehiclePaintjob Tutorial -
Konstantinos - 22.01.2012
You won a cookie.
Click me!
Mistakes you had. The correct are:
0 = Paintjob
1 = Paintjob
2 = Paintjob
3 = Delete Paintjob
However, at the code. The length is optional. If you don't know to count how many characters the command has, I suggest you not use it.
pawn Code:
if( strcmp( "/restorepaintjob", cmdtext, true, 16 ) == 0 ) // It's 16, not 8. 15 letters and 1 /
{
if( !IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, -1, "You must are in a vehicle" );
// Without Bracket under it.
ChangeVehiclePaintjob( GetPlayerVehicleID( playerid ), 0 );
return 1;
}