SA-MP Forums Archive
Instant AttachDynamicObjectToVehicle - 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: Instant AttachDynamicObjectToVehicle (/showthread.php?tid=663868)



Instant AttachDynamicObjectToVehicle - PepsiCola23 - 13.02.2019

so when a player buys a spoiler for his bullet ,side skirts or bumpers i have this code

PHP код:
SpoilerBullet[vehicleid] = CreateDynamicObject(1003,0,0,0,0,0,0);
              
AttachDynamicObjectToVehicle(SpoilerBullet[vehicleid], vehicleid,  0.000000,-2.025000,0.300000,0.000000,0.000000,0.000000); 
the problem is the spoiler appear only after i respawn the car,how can i make it to be instant?so when he`s in the garage the spoiler willl instanlty appear on the car?


Re: Instant AttachDynamicObjectToVehicle - NaS - 13.02.2019

You can call Streamer_UpdateEx with the position of the player, interior and virtual world when you attached the object.

Or you can enable idle updating by using Streamer_ToggleIdleUpdate when the player enters the tuning garage/shop, and turn it off when they leave. That will always update the items even if the player isn't moving. This isn't really neccessary outside of the shop since players that are AFK/idle don't need to be updated normally (this is a way to save some resources).


Re: Instant AttachDynamicObjectToVehicle - RoboN1X - 13.02.2019

Create the object near the vehicle & player... Not at 0,0,0


Also note that players client may crash when there is a incompatible/some vehicle components being attached to a vehicle when they are close to vehicle mod/tuning shop