SA-MP Forums Archive
Attach object to vehicle won't work - 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: Attach object to vehicle won't work (/showthread.php?tid=420713)



Attach object to vehicle won't work - davve95 - 06.03.2013

Hi!


I've never tested attach object to vehicle, but now when I tired it, the objects won't
show up at right place on the car..

pawn Код:
if (strcmp("/aveh", cmdtext, true, 10) == 0)

    {
        new Obj1 = CreateObject(1000, 1857.13, 810.50, 10.45,   7.44, -0.84, -1.20);
        new Obj2 = CreateObject(1006, 1857.08, 814.52, 10.43,   0.00, 0.00, 0.00);
        new Obj3 = CreateObject(1025, 1856.40, 811.98, 10.42,   0.00, 0.00, 1.44);
        new Obj4 = CreateObject(1046, 1857.29, 812.24, 10.08,   0.00, 0.00, 0.00);
        new Obj5 = CreateObject(2937, 1857.02, 815.27, 9.52,   0.96, 88.32, -90.12);
        new Veh = GetPlayerVehicleID(playerid);
        AttachObjectToVehicle(Obj1, Veh, 1857.13, 810.50, 10.45,   7.44, -0.84, -1.20);
        AttachObjectToVehicle(Obj2, Veh, 1857.08, 814.52, 10.43,   0.00, 0.00, 0.00);
        AttachObjectToVehicle(Obj3, Veh, 1856.40, 811.98, 10.42,   0.00, 0.00, 1.44);
        AttachObjectToVehicle(Obj4, Veh, 1857.29, 812.24, 10.08,   0.00, 0.00, 0.00);
        AttachObjectToVehicle(Obj5, Veh, 1857.02, 815.27, 9.52,   0.96, 88.32, -90.12);
        return 1;
    }
    return 0;
}

pawn Код:
Aveh = CreateVehicle(605, 1857.1119, 812.9612, 10.0264, 1.2000, -1, -1, 100);// Admin vehicle

I took the same coordinates as from the objects, maybe you shoulden't do that way?..

Well I maybe figured out the problem now but not full sure, so I wait for reply.


Re: Attach object to vehicle won't work - Glad2BeHere - 06.03.2013

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

as u see u set the object distance to be far awah from the vehicle try:
pawn Код:
AttachObjectToVehicle(Obj1, Veh, 0, 0, 0,   7.44, -0.84, -1.20); //change the first 3 coords to 0 and keep the rotation because u didn't set the object position @u set the object to be >1857.13, 810.50, 10.45 away from the vehicle note:change each one



Re: Attach object to vehicle won't work - davve95 - 06.03.2013

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/AttachObjectToVehicle

as u see u set the object distance to be far awah from the vehicle try:
pawn Код:
AttachObjectToVehicle(Obj1, Veh, 0, 0, 0,   7.44, -0.84, -1.20); //change the first 3 coords to 0 and keep the rotation because u didn't set the object position @u set the object to be >1857.13, 810.50, 10.45 away from the vehicle note:change each one
I see thanks alot!. I will try that..


Edit: Won't work either.


Re: Attach object to vehicle won't work - Glad2BeHere - 06.03.2013

WORKS 100% just gotta fix the obj
put that in the cmd n u will c
pawn Код:
new Float:y[3];
        GetPlayerPos(playerid ,y[0], y[1], y[2]);
        new x =CreateVehicle(541,y[0], y[1], y[2],90, 93, 93, -1);
        PutPlayerInVehicle(playerid, x , 0);
        new Obj1 = CreateObject(1000, 0,0,0,   7.44, -0.84, -1.20);
        new Obj2 = CreateObject(1006, 0,0,0,   0.00, 0.00, 0.00);
        new Obj3 = CreateObject(1025, 0,0,0,   0.00, 0.00, 1.44);
        new Obj4 = CreateObject(1046, 0,0,0,   0.00, 0.00, 0.00);
        new Obj5 = CreateObject(2937, 0,0,0,   0.96, 88.32, -90.12);
        new Veh = GetPlayerVehicleID(playerid);
        AttachObjectToVehicle(Obj1, Veh, 0,0,1,   7.44, -0.84, -1.20);
        AttachObjectToVehicle(Obj2, Veh, 0,0,1,   0.00, 0.00, 0.00);
        AttachObjectToVehicle(Obj3, Veh, 0,0,1,   0.00, 0.00, 1.44);
        AttachObjectToVehicle(Obj4, Veh, 0,0,1,   0.00, 0.00, 0.00);
        AttachObjectToVehicle(Obj5, Veh, 0,0,1,   0.96, 88.32, -90.12);



Re: Attach object to vehicle won't work - davve95 - 06.03.2013

Oh I see ^^

Thanks alot!, first time I work with just this callback/function.


Now the objects get attached at wrong place :/.. It aren't like I did in map editor...