Attaching 3D to car
#1

So guys,

I'm currently editing GTA:RP and i need to attach a 3D text to a car that is in cars.cfg file.
Any ideas how to do it?
Reply
#2

Hi MrDzx,

There is a SA:MP function to do this:
Код:
Attach3DTextLabelToVehicle( vehicle3Dtext, vehicle_id, 0.0, 0.0, 2.0);
Take a look at the wiki for further help: https://sampwiki.blast.hk/wiki/Attach3DTextLabelToVehicle

Cheers,

TJ
Reply
#3

Well Here is Example, This Will Add Text: "Vehicle Owner: OwnerName" on every car which is in cars.cfg
FIND:
pawn Код:
for(new h = 184; h < sizeof(CarInfo); h++)
{
    SetVehicleParamsForPlayer(h,playerid,0,CarInfo[h][cLock]);
}
Change To
pawn Код:
new Text3D:Vehicle3D;
for(new h = 184; h < sizeof(CarInfo); h++)
{
    SetVehicleParamsForPlayer(h,playerid,0,CarInfo[h][cLock]);
    format(string, 40, "Vehicle Owner: %s",CarInfo[h][cOwner]);
    Vehicle3D = Create3DTextLabel(string, 0x32CD32AA, 0.0, 0.0, 0.0, 20.0, 0, 1 );
    Attach3DTextLabelToVehicle(Vehicle3D,h, 0.0, 0.0, 1.0);
}
- Hope It Works Didn't Test..
Reply
#4

Quote:
Originally Posted by » JoFi »
Well Here is Example, This Will Add Text: "Vehicle Owner: OwnerName" on every car which is in cars.cfg
FIND:
pawn Код:
for(new h = 184; h < sizeof(CarInfo); h++)
{
    SetVehicleParamsForPlayer(h,playerid,0,CarInfo[h][cLock]);
}
Change To
pawn Код:
new Text3D:Vehicle3D;
for(new h = 184; h < sizeof(CarInfo); h++)
{
    SetVehicleParamsForPlayer(h,playerid,0,CarInfo[h][cLock]);
    format(string, 40, "Vehicle Owner: %s",CarInfo[h][cOwner]);
    Vehicle3D = Create3DTextLabel(string, 0x32CD32AA, 0.0, 0.0, 0.0, 20.0, 0, 1 );
    Attach3DTextLabelToVehicle(Vehicle3D,h, 0.0, 0.0, 1.0);
}
- Hope It Works Didn't Test..
Almost what I needed, I just need the Car Plate thingy not the Owner, making the plate thing right now, hopefully will work
EDIT!!!!
SO here's the problem:
On the car it shows 123 numbers only although i made into cars.cfg DSD,123 so it should show DSD 123
HEre's the code:
for(new h = 184; h < sizeof(CarInfo); h++)
{
SetVehicleParamsForPlayer(h,playerid,0,CarInfo[h][cLock]);
format(string, 40, "%s_%d",CarInfo[h][c3DT],CarInfo[h][c3DN]);
Vehicle3D = Create3DTextLabel(string, 0x32CD32AA, 0.0, 0.0, 0.0, 20.0, 0, 1 );
Attach3DTextLabelToVehicle(Vehicle3D,h, 0.0, 0.0, 1.0);
}

public LoadCar()
{
new arrCoords[15][64];
new strFromFile2[256];
new File: file = fopen("cfg/cars.cfg", io_read);
if (file)
{
new idx = 184;
while (idx < sizeof(CarInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
CarInfo[idx][cModel] = strval(arrCoords[0]);
CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
CarInfo[idx][cColorOne] = strval(arrCoords[5]);
CarInfo[idx][cColorTwo] = strval(arrCoords[6]);
strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
CarInfo[idx][cValue] = strval(arrCoords[9]);
CarInfo[idx][cLicense] = strval(arrCoords[10]);
CarInfo[idx][cOwned] = strval(arrCoords[11]);
CarInfo[idx][cLock] = strval(arrCoords[12]);
CarInfo[idx][c3DT] = strlen(arrCoords[13]);
CarInfo[idx][c3DN] = strval(arrCoords[14]);
printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
idx++;
}
}
return 1;
}
Reply
#5

Код:
CarInfo[idx][c3DT] = strlen(arrCoords[13]);
to

Код:
format(CarInfo[idx][c3DT], 64, (arrCoords[13]));
Reply
#6

Quote:
Originally Posted by ♂ Antonio [G-RP
]
Код:
CarInfo[idx][c3DT] = strlen(arrCoords[13]);
to

Код:
format(CarInfo[idx][c3DT], 64, (arrCoords[13]));
It was like { 123
Not it is D{ 123
Although in cars.cfg i've made like this: DJD, 123
Reply
#7

BUMP!
Reply
#8

you want the register system? I made it for my server works perfect i will be happy to help you. nikostour@hotmail.com
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)