SA-MP Forums Archive
attatch object to vehicle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: attatch object to vehicle (/showthread.php?tid=598394)



attatch object to vehicle - Nightmares - 11.01.2016

AttachObjectToVehicle(objectid, vehicleid, 0.034999, -0.379994, 0.519999, 0.000000, 0.000000, 0.000000); //Object Model: 19419 |


I am posting this in the gamemode, no errors and when I go on the car isn't changed. its a bullet. What am I doing wrong? =1 rep whoever help!


Re: attatch object to vehicle help =1REP - lucamsx - 12.01.2016

GetPlayerVehicleID maybe? You need to specify the vehicle.
Also, wrong section. This is the right place: http://forum.sa-mp.com/forumdisplay.php?f=12


Re: attatch object to vehicle help =1REP - Nightmares - 12.01.2016

Quote:
Originally Posted by lucamsx
Посмотреть сообщение
GetPlayerVehicleID maybe? You need to specify the vehicle.
Also, wrong section. This is the right place: http://forum.sa-mp.com/forumdisplay.php?f=12
can u do for me


Re: attatch object to vehicle help =1REP - SaltySandy - 12.01.2016

You'll have to define what vehicle IDs get what object and on what location:
( Wiki post: https://sampwiki.blast.hk/wiki/GetPlayerVehicleID )
Код:
(objectid, vehicleid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ)
For your code, noting that the bullet has to be vehicle ID 1:
PHP код:
AttachObjectToVehicle(objectid, vehicleid, 0.034999, -0.379994, 0.519999, 0.000000, 0.000000, 0.000000); //Object Model: 19419 | 
objectid should be 19419 ( I believe, as I can see from your post )
vehicleid should be 1 ( or whatever the ID of the vehicle is )

PHP код:
AttachObjectToVehicle(19419, 1, 0.034999, -0.379994, 0.519999, 0.000000, 0.000000, 0.000000); //Object Model: 19419 | 



Re: attatch object to vehicle help =1REP - lucamsx - 12.01.2016

Quote:
Originally Posted by SaltySandy
Посмотреть сообщение
PHP код:
AttachObjectToVehicle(19419, 1, 0.034999, -0.379994, 0.519999, 0.000000, 0.000000, 0.000000); //Object Model: 19419 | 
what?
Код:
new vehid;
vehid = GetPlayerVehicleID(playerid);
replace "1" with "vehid".


Re: attatch object to vehicle help =1REP - AbyssMorgan - 12.01.2016

objectid this is not a modelid !!
PHP код:
new tmpobj = CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 0.0);
AttachObjectToVehicle(tmpobj, vehicleid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ);
OR
new 
tmpobj = CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = STREAMER_OBJECT_SD, Float:drawdistance = STREAMER_OBJECT_DD);
AttachDynamicObjectToVehicle(tmpobj, vehicleid, Float:offsetx, Float:offsety, Float:offsetz, Float:rx, Float:ry, Float:rz); 



Re: attatch object to vehicle help =1REP - SaltySandy - 12.01.2016

Quote:
Originally Posted by lucamsx
Посмотреть сообщение
what?
Код:
new vehid;
vehid = GetPlayerVehicleID(playerid);
replace "1" with "vehid".
I copied his code and went on to explain in the rest of my post.


Re: attatch object to vehicle help =1REP - Nightmares - 13.01.2016

thanks guy gave all 3 of u rep!