SA-MP Forums Archive
Trailer help. (Attaching multiple trailers) +REP - 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: Trailer help. (Attaching multiple trailers) +REP (/showthread.php?tid=475432)



Trailer help. (Attaching multiple trailers) +REP - Josh Greening - 13.11.2013

Alright, so i've spent the past few hours trying to figure this out. I'm trying to make a system so I can latch multiple trailers to one truck(I believe it's called a Road Train when you tow multiple trailers with one cab) I've solved most of my issues, and it now compiles with no errors, the trailers are attaching and un-attaching on command, but when I have a trailer on, and try to hook a second one onto the current trailer, nothing happens. I'm possibly missing a return or something, but i can't figure out what's missing. Could someone read over this and help me?

PS: I'm still new with scripting, still learning allot of things, so excuse my sloppy scripting. Most of my scripting is made from what i've learned on Wiki.

Any help is greatly appreciated as it will help me learn, and you will be +rep'd for helping.

pawn Код:
CMD:attachtrailer(playerid)
{
 
    {

        {

            {

                {

                    {

                        {

                            {

                            }

                        }

                    }
                }
                else
                {
                    if (IsTrailerAttachedToVehicle(dudecar))
                    {
                        new rtrailer = GetVehicleModel(GetVehicleTrailer(vehicleid));
                        if(DistanceBetweenPlayerAndVeh(playerid, car) < 7.0)
                        {
                            if(IsATrailer(GetVehicleModel(car)))
                            {
                                if(VehLocked[car])
                                {
                                    SCM(playerid,COLOR_LIGHTRED, "  You can't latch onto this trailer!");
                                    return 1;
                                }
                                AttachTrailerToVehicle(car, rtrailer);
                                SCM(playerid,COLOR_LIGHTGREEN,"* You have finshed hooking up the trailer!");
                                return 1;
                            }
                        }
                    }
                    return 1;
                }
            }
            else
            {
                SCM(playerid,COLOR_LIGHTRED, "  There is no trailer in range.");
                return 1;
            }
        }
    }
    else
    {
        SCM(playerid, COLOR_LIGHTRED, " You have to be in a car to do this!");
    }
    return 1;
}



Re: Trailer help. (Attaching multiple trailers) +REP - Josh Greening - 13.11.2013

Can anybody help me on this? I'm needing it for my next update which was dated for today. But it's having to be put on hold until I can solve this. I appreciate any help!


Re: Trailer help. (Attaching multiple trailers) +REP - Josh Greening - 14.11.2013

ADDED NOTE:

I've got the rtrailer attaching to the main trailer, but the attachtrailertovehicle is confusing me, as when the trailer attaches to the other, the front of the 2nd trailer is inside the back of the 1st trailer. Is there any way to change the position on the z(up/down) axis so they are not inside eachother when using the AttachTrailerToVehicle?

Something like: AttachTrailerToVehicle(rtrailer, trailer(x,y,z+1.500,a)); for example.