AttachObjectToVehicle
#1

Hello everyone, along with say hello, I clarify that my English is not very good and I use the translator on this occasion.

I wanted to know what is the function to add objects to vehicles with AttachObjectToVehicle and how to destroy them when the vehicle explodes, thanks.
Reply
#2

u can create at anywhere where u want (for examples at CMD)

define object at top of the script
new VehObject[MAX_VEHICLES];

put this script at command
vehid = GetPlayerVehicleID(playerid);
VehObject[vehid] = CreateObject(objectid,0,0,0,0,0,0,0);
AttachObjectToVehicle(VehObject[vehid],vehid,0,0,0,0,0,0);

and put this at OnVehicleDestroy
DestroyObject(VehObject[vehicleid]);

u can also check these functions at wiki to get full information how to use it.
https://sampwiki.blast.hk/wiki/AttachObjectToVehicle
Reply
#3

Код:
new ORancher[2];

new vehicleid=GetPlayerVehicleID(playerid);
ORancher[0] = CreateObject(19601,0,0,-1000,0,0,0,100);
ORancher[1] = CreateObject(19601,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(ORancher[0], vehicleid, 0.000000, 3.025021, -0.629999, 177.885086, 0.000000, 0.000000); //Object Model: 19601 | objeto
AttachObjectToVehicle(ORancher[1], vehicleid, 0.000000, 3.025021, 0.234999, 154.769973, 0.000000, 0.000000); //Object Model: 19601 | objeto
in this way it can also or should be necessary to define it as:
Код:
new ORancher [MAX_VEHICLES]; ????
Reply
#4

yeah it's necessary to be called later in another scripts (such as delete or attachments)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)