[Tutorial] How to Add Number plates and 3DTextLabels to Vehicles
#1

So welcome to my tutorial

First off we are going to be working under OnGamemodeInit so lets go there

Code:

pawn Код:
public OnGameModeInit()
{
Ok so now we want to add

Code:

pawn Код:
new vehicle_id, Text3D:vehicle3Dtext;
This will Create the variable

ok so now it should look like this


Code:

pawn Код:
public OnGameModeInit()
{

new vehicle_id, Text3D:vehicle3Dtext;


Ok so now lets create the text label on your car

pawn Код:
vehicle3Dtext = Create3DTextLabel( "Best car in the Game!", 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
so lets break that down a little


In the brackets we have the label that will display on the car then after that we have the colour (that's red) then all those complex numbers are the positioning of the label you can play around with them or check the wiki for extra info on that

Now lets attach the label

pawn Код:
Attach3DTextLabelToVehicle( vehicle3Dtext, vehicle_id, 0.0, 0.0, 2.0);
That just pretty much attaches it to the vehicle

Now Its almost over, lets just create the car and the license plate!


pawn Код:
vehicle_id = SetVehicleNumberPlate(CreateVehicle(411, 786.0544, -513.6415, 16.3859,0.00000000, 144,422, 30), "FlakeZor");
now lets have a look at this, This will create the vehicle while having a license plate on it the '411' is the car ID and in this case it is a infernus then we just have the X Y Z cords Then comes the fun bit, creating the atcuall License plate in this case mine obviously says FlakeZor


Now lets put it all together


pawn Код:
public OnGameModeInit()
{

new vehicle_id, Text3D:vehicle3Dtext;
    vehicle3Dtext = Create3DTextLabel( "Best car in the Game!", 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
    Attach3DTextLabelToVehicle( vehicle3Dtext, vehicle_id, 0.0, 0.0, 2.0);
    vehicle_id = SetVehicleNumberPlate(CreateVehicle(411, 786.0544, -513.6415, 16.3859,0.00000000, 144,422, 30), "FlakeZor");

return 1; // and exit :)
}

Hope you all liked it and you enjoyed it, i left all the variables as default
Reply
#2

Oh hey PwnFlakes. Great tutorial on license plates!
Reply
#3

Quote:
Originally Posted by Fierro
Посмотреть сообщение
Oh hey PwnFlakes. Great tutorial on license plates!
haha thanks, but im not PwnFlakes im just Flake
Reply
#4

pawn Код:
Attach3DTextLabelToVehicle( vehicle3Dtext, vehicle_id, 0.0, 0.0, 2.0);
    vehicle_id = SetVehicleNumberPlate(CreateVehicle(411, 786.0544, -513.6415, 16.3859,0.00000000, 144,422, 30), "FlakeZor");
I'm sure this wouldn't work.
Reply
#5

haha yep, ill fix it up here


this is for adding the label to the vehicle
pawn Код:
vehicle_id = CreateVehicle( 510, 0.0. 0.0, 15.0, 5, 0, 120 );
my bad lawl
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)