[Tool/Web/Other] [Function]GetVehicleTrailerPos
#1

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

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

Its not working for me /=
Reply
#4

Are you using it correctly?
Reply
#5

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?
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)