[Tutorial] ChangeVehiclePaintjob Tutorial
#1

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.
Reply
#2

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!
Reply
#3

Quote:
Originally Posted by System64
View Post
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.
Reply
#4

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)