SA-MP Forums Archive
[HELP]: Attach the same 3D text label to vehicles - 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)
+--- Thread: [HELP]: Attach the same 3D text label to vehicles (/showthread.php?tid=618639)



[HELP]: Attach the same 3D text label to vehicles - Eoussama - 08.10.2016

Hello, so I wanted to attach a single 3d text label to some various vehicles,
the array for these vehicles is gVIPVehicles
so how can I attach it to all of the 387 vehicle without repeating the same function again and again?


Re: [HELP]: Attach the same 3D text label to vehicles - Threshold - 08.10.2016

You cannot attach 1 label to 387 vehicles. You can attach 387 labels to 387 vehicles though. Is that what you mean?


Re: [HELP]: Attach the same 3D text label to vehicles - Eoussama - 08.10.2016

Quote:
Originally Posted by Threshold
Посмотреть сообщение
You cannot attach 1 label to 387 vehicles. You can attach 387 labels to 387 vehicles though. Is that what you mean?
yeh, literally


Re: [HELP]: Attach the same 3D text label to vehicles - Threshold - 08.10.2016

Well I haven't seen your code, so I can only assume at this point. You would need something like this once you've spawned all your vehicles:
PHP код:
for(new 0sizeof(gVIPVehicles); i++)
    
Attach3DTextLabelToVehicle(Create3DTextLabel("VIP Vehicle"0xFF0000AA0.00.0, -10.015.000), gVIPVehicles[i], 0.00.00.0); 
Whereby 'gVIPVehicles[i]' would store the vehicle ID of the vehicle you're trying to attach the label to. The parameters given are just examples, the parameters of Create3DTextLabel and Attached3DTextLabelToVehicle can be found on the wiki. You can also add something to delete the labels OnGameModeExit if you really want to, or when/if a vehicle is destroyed.

The code above would attach a red label with the text "VIP Vehicle" to the centre of each vehicle listed in the array 'gVIPVehicles'.


Re: [HELP]: Attach the same 3D text label to vehicles - Eoussama - 08.10.2016

Tnx +REP