SA-MP Forums Archive
[Tool/Web/Other] [Function]GetVehicleTrailerPos - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [Tool/Web/Other] [Function]GetVehicleTrailerPos (/showthread.php?tid=170857)



[Function]GetVehicleTrailerPos - CoaPsyFactor - 24.08.2010

pawn Код:
stock GetVehicleTrailerPos(vehicleid, trailerid, &Float:x, &Float:y, &Float:z){
    if(IsTrailerAttachedToVehicle(vehicleid)){
        if(GetVehicleTrailer(vehicleid) == trailerid){
            GetVehiclePos(trailerid, x, y, z);
            return 1;
        }else{
            return 0;
        }
    }else{
        return 0;
    }
}
so this is function that can return position of trailer that is attached to some vehicle.
Usage:
pawn Код:
GetVehicleTrailerPos(vehicleid,GetVehicleTrailer(vehicleid), mx, my, mz);
            new mstring[128];
            format(mstring, sizeof(mstring), "%f | %f | %f |", mx, my, mz);
            SendClientMessage(playerid, COLOR_SYSTEM, mstring);
i want to thanks to Donny_K for little help.


Re: [Function]GetVehicleTrailerPos - DiddyBop - 24.08.2010

Cool, Good for trucking servers for when you park your trailer :P


Re: [Function]GetVehicleTrailerPos - nuriel8833 - 26.08.2010

Its not working for me /=


Re: [Function]GetVehicleTrailerPos - ScottCFR - 26.08.2010

Are you using it correctly?


Re: [Function]GetVehicleTrailerPos - XXJacksug8X - 16.07.2014

what a rubbish
anyone would use this
Код:
GetVehiclePos(GetVehicleTrailer(vehicleid), mx, my, mz);
rather than this
Код:
#include <blabla>
GetVehicleTrailerPos(vehicleid, GetVehicleTrailer(vehicleid), mx, my, mz);
if you wanna make something useful you would make
Код:
stock GetVehicleTrailerPos(vehicleid, &Float:x, &Float:y, &Float:z)
    return GetVehiclePos(GetVehicleTrailer(vehicleid), x, y, z);
}
if no trailer is attached, GetVehicleTrailer returns 0 then GetVehiclePos returns 0 too, otherwise GetVehiclePos returns 1 cuz the trailer exists.
but seriously, why getting the position of a vehicle trailer?


Re: [Function]GetVehicleTrailerPos - CoaPsyFactor - 18.07.2014

lol, I found that useful in my trucking mode, if player is on a mission he could have only one trailer, only one id. Or in roleplay mode with mechanic job, for towing broke cars.