SA-MP Forums Archive
Attaching 3D to car - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Attaching 3D to car (/showthread.php?tid=156635)



Attaching 3D to car - Mr Dzx - 23.06.2010

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?


Re: Attaching 3D to car - TTJJ - 23.06.2010

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


Re: Attaching 3D to car - Jofi - 23.06.2010

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..


Re: Attaching 3D to car - Mr Dzx - 23.06.2010

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



Re: Attaching 3D to car - Antonio [G-RP] - 23.06.2010

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

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



Re: Attaching 3D to car - Mr Dzx - 23.06.2010

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


Re: Attaching 3D to car - Mr Dzx - 24.06.2010

BUMP!


Re: Attaching 3D to car - TouR - 24.06.2010

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