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



AttachObjectToVehicle - Aleksabre - 05.08.2015

Okay, so I'm trying to get a police siren to a burrito vehicle and it seems like it doesn't work.

#include <ZCMD>
CMD:burrito(playerid, params[])
{
new
vehicleid = GetPlayerVehicleID(playerid);
AttachObjectToVehicle(CreateObject(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), vehicleid, 255.44949, 1774.31165, 14.43670, 0.0, 0.0, 0.0);
return 1;
}

---------- in the map editor
CreateObject(19419, 255.44949, 1774.31165, 14.43670, 0.00000, 0.00000, 0.00000);
CreateVehicle(482, 255.4524, 1773.3035, 13.5286, 0.0000, -1, -1, 100);
-----------
Can someone help me how to attach it? It seems the script works, as it shows no errors, no nothing, but it's still bugged I guess or the coordinates aren't good or something. Thank you.
P.S: This is in the gamemode, not in filterscript.
http://s29.postimg.org/wlj3x16s7/pol...ht_vehicle.png


Re: AttachObjectToVehicle - SpikeSpigel - 05.08.2015

What is this ?

Код:
AttachObjectToVehicle(CreateObject(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), vehicleid, 255.44949, 1774.31165, 14.43670, 0.0, 0.0, 0.0);



Re: AttachObjectToVehicle - Aleksabre - 05.08.2015

I don't know what you mean, but I explained everything above. I mean, I thought I was doing alright or? Could you help me?


Re: AttachObjectToVehicle - SpikeSpigel - 05.08.2015

Well, I think. What command you actually want to made ? And what that command should do ?


Re: AttachObjectToVehicle - Aleksabre - 05.08.2015

I want to make an object(police siren(ID:19419)) to be attached to a vehicle(Burrito(ID:482))
I guess I didn't do something right, could you help me, please?


Re: AttachObjectToVehicle - jamesbond007 - 05.08.2015

Why is your offset so high? ... (255.44949, 1774.31165, 14.43670,)

Zzz. and try create the object near the vehicle not at 0, 0, 0 pos


Re: AttachObjectToVehicle - Aleksabre - 05.08.2015

I watched a ******* video, and by watching it, my coordinates for the object are 255.44949, 1774.31165, 14.43670

I want to make police lights attacked to a burrito shown in the picture above.

CreateObject(19419, 255.44949, 1774.31165, 14.43670, 0.00000, 0.00000, 0.00000);
CreateVehicle(482, 255.4524, 1773.3035, 13.5286, 0.0000, -1, -1, 100);

These codes are for the burrito and the police light, attached shown in the picture: http://s29.postimg.org/wlj3x16s7/pol...ht_vehicle.png

Could you tell me or if you're kind to make me codes, so I will know then my mistakes?


Re: AttachObjectToVehicle - SpikeSpigel - 05.08.2015

It's really simple if you want em to have an siren. You can just use

Код:
  CreateVehicle(vehicleid, Float:x, Float:y, Float:z, Float:angle, color1, color2, -1, 1);
How it works ? you put the command in the gamemode under the OnGamemodeInit public and how to modify it ? Vehicleid >> burrito id, float,y,z,angle, location + facing angle, COLOR 1, color 2, color ID's, -1 if you want vehicle not to respawn after a while and the last "1" to have a siren, 0 - No siren , 1- siren. If you want to make a command that creates a vehicle in front of the player just tell me. or if you want the vehicle to spawn somewhere, tell me and I will help ya' !


Re: AttachObjectToVehicle - jamesbond007 - 05.08.2015

https://sampwiki.blast.hk/wiki/AttachObjectToVehicle


Re: AttachObjectToVehicle - Aleksabre - 05.08.2015

I don't understand... is it supposed to be like this?
CreateVehicle(482, 255.4524, 1773.3035, 13.5286, 0.0000, 0, 0, -1, 1);