Trailer Attach to Truck -
Sn4ke2 - 12.06.2015
Okay, so I make command
PHP код:
CMD:work(playerid,params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te loghezi mai intai.");
new idcar = GetPlayerVehicleID(playerid);
if(PlayerInfo[playerid][pJob] != 14) return SCM(playerid,COLOR_WHITE,"{FFF8C6}You are not a Trucker.");
if(!IsATruck(idcar) && GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SCM(playerid,COLOR_WHITE,"{FFF8C6}This vehicle does not truck or you are not driver.");
if(!IsPlayerInRangeOfPoint(playerid, 50.0, -63.6036,-1128.5824,1.0781)) return SCM(playerid,COLOR_WHITE,"{FFF8C6}You are not the place where you can get products.");
//new Trucker = CreateVehicle(515,-77.2527,-1128.5070,2.0876,68.5459,3,77,9000); // Trucker
new TrailerID = CreateVehicle(450,-68.6366,-1132.4463,2.0863,63.8751,3,77,9000); // Trucker si remorca
//PutPlayerInVehicle(playerid,Trucker,0);
//ShowPlayerDialog(playerid, DIALOG_TRANSPORT, DIALOG_STYLE_LIST, "Product:", "Legal Products\nIllegal Products", "Select", "Close");
//AttachTrailerToVehicle(TrailerID,GetPlayerVehicleID(playerid));
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
new Float:vX,Float:vY,Float:vZ;
GetVehiclePos(idcar,vX,vY,vZ);
AttachTrailerToVehicle(TrailerID,idcar);
return 1;
}
I did this command when writing / work wherever you are attach the trailer to truck
BUT! Not work, i don't know why
He give me the trailer to this Coordonates
PHP код:
new TrailerID = CreateVehicle(450,-68.6366,-1132.4463,2.0863,63.8751,3,77,9000); // Trucker si remorca
where is trailer create!
Help me Guys!
Re: Trailer Attach to Truck -
rappy93 - 12.06.2015
The trailer is created at X = -68.6366, Y = -1132.4463 and Z = 2.0863 as the code clearly states.
Re: Trailer Attach to Truck -
Sn4ke2 - 12.06.2015
this i know...,how to create trailer but in same time to attach to vehcile wherever vehicle are ?
Re: Trailer Attach to Truck -
rappy93 - 12.06.2015
PHP код:
new TrailerID = CreateVehicle(450,-68.6366,-1132.4463,2.0863,63.8751,3,77,9000); // Trucker si remorca
new vehicleid = GetPlayerVehicleID(playerid); // Asta este tirul tau.
AttachTrailerToVehicle(TrailerID, vehicleid); // Iar cu asta vei putea atasa remorca la tir.
I gave you some explanations in romanian, this should be all you need to attach the trailer to the vehicle.
Re: Trailer Attach to Truck -
Sn4ke2 - 12.06.2015
dude, i know,BUT i want to create and attach trailer wherever are VEHICLE!
If vehicle as this coord : 0,0,0 then attach and create the trailer at this coord.
Re: Trailer Attach to Truck -
rappy93 - 12.06.2015
RO : Macar de ai fi cautat pe Wiki ,nu e greu, dar nah, lenea e mare. Uite cum se face:
EN : If only you'd have searched the wiki, its not hard, but meh, lazy people! Here is how to do that :
PHP код:
new vehicleid = GetPlayerVehicleID(playerid); // Asta este tirul tau.
new Float:vehx, Float:vehy, Float:vehz; // cream variable sa stocam pozitia tirului tau
new Float:z_rot; // Rotatia masinii
GetVehiclePos(vehicleid, vehx, vehy, vehz); // Salvam pozitia tirului tau.
GetVehicleZAngle(vehicleid, z_rot);
new TrailerID = CreateVehicle(450, vehx+2, vehy+2, vehz+2, z_rot,3,77,9000); // Cream remorca la coordonatele tale curente.
AttachTrailerToVehicle(TrailerID, vehicleid); // Iar cu asta vei putea atasa remorca la tir.
This should work, I didn't test it.
Re: Trailer Attach to Truck -
Sn4ke2 - 12.06.2015
please give me the link of wikipedia page
Re: Trailer Attach to Truck -
rappy93 - 12.06.2015
Main Page of SAMP Wiki :
http://wiki.sa-mp.com
GetVehiclePos =
https://sampwiki.blast.hk/wiki/Function:GetVehiclePos
GetVehicleZAngle =
https://sampwiki.blast.hk/wiki/GetVehicleZAngle
CreateVehicle =
https://sampwiki.blast.hk/wiki/CreateVehicle
AttachTrailerToVehicle =
https://sampwiki.blast.hk/wiki/AttachTrailerToVehicle
Re: Trailer Attach to Truck -
Sn4ke2 - 12.06.2015
Anybody?