SA-MP Forums Archive
Hlp again :D - 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: Hlp again :D (/showthread.php?tid=643894)



Hlp again :D - Maky184 - 29.10.2017

How to attach farm trailer to tractor?


Re: Hlp again :D - Kraeror - 29.10.2017

Take a look here my friend
https://sampwiki.blast.hk/wiki/AttachTrailerToVehicle


Re: Hlp again :D - 10MIN - 29.10.2017

Use AttachTrailerToVehicle like

AttachTrailerToVehicle(farm_trailer_vehid, tractor_vehid);

PS: You need to create the trailer like a normal vehicle (via AddStaticVehicle/ CreateVehicle)


Re: Hlp again :D - Maky184 - 30.10.2017

Tnx, but can you explain how i can make it like cmd and where i need to puti it ?


Re: Hlp again :D - Lucases - 30.10.2017

pawn Код:
CMD:attachtrailer(playerid, params[])
{
          new vehicleid = GetPlayerVehicleID(playerid);          
          if(GetVehicleModel(vehicleid) != 531) return SendClientMessage(playerid, -1, "You aren't driving a tractor");
          if(IsTrailerAttachedToVehicle(vehicleid)) return SendClientMessage(playerid, -1, "You already have a trailer attached");
          new Float:x, Float:y, Float:z;
          GetPlayerPos(playerid, x, y, z);
          new trailer = CreateVehicle(610, x, y, z+2, 1.0, 0, 0, -1, 0);
          AttachTrailerToVehicle(trailer, vehicleid);
          SendClientMessage(playerid, -1, "You have attached a farm trailer to your tractor.");
          return 1;
}
Untested