attatch object to vehicle
#1

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!
Reply
#2

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
Reply
#3

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
Reply
#4

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 | 
Reply
#5

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".
Reply
#6

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); 
Reply
#7

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.
Reply
#8

thanks guy gave all 3 of u rep!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)