God Damn!, connot attach my trailer to the truck!.. please help!
#1

i just can't attach my trailer to the truck sometime it's just not appear sometime it's not attaching omg please help me!...

i need that if player execute the command lets say.. '/hello' it will CreateVehicle or AddStaticVehicle (GetPlayerVehilcePos) it will spawn that trailer behind my truck and attach automatically the trailer to my truck..

just cannot make that right.., always messed up..

thank you for your help guys.
Reply
#2

Already tried AttachTrailerToVehicle?
Reply
#3

try making a command like /tow or /attach...
Reply
#4

trailer = CreateVehicl(blahblah)
AttachTrailerToVehicle("trailer" to your vehicle)

:S
Reply
#5

Quote:
Originally Posted by Thrarod
trailer = CreateVehicl(blahblah)
AttachTrailerToVehicle("trailer" to your vehicle)

:S
lol


OFFTOPIC:


Yeah i have helped rodney 3 times now he is 22!!!!!
Reply
#6

Quote:
Originally Posted by Steven82
Quote:
Originally Posted by Thrarod
trailer = CreateVehicl(blahblah)
AttachTrailerToVehicle("trailer" to your vehicle)

:S
lol


OFFTOPIC:


Yeah i have helped rodney 3 times now he is 22!!!!!
i've tryed that already but i can't get the vehicle spawned to my truck's ass.. how do i do that?...
Reply
#7

Get your position then get your angle then... Spawn trailer behind that point with use (x-4, y-5, z-2 (example not true)) also those may vary with your angle hard huh?
Reply
#8

Quote:
Originally Posted by Thrarod
Get your position then get your angle then... Spawn trailer behind that point with use (x-4, y-5, z-2 (example not true)) also those may vary with your angle hard huh?
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(p layerid)))
{
new gTrailer = GetVehicleTrailer(GetPlayerVehicleID(playerid));
DetachTrailerFromVehicle(GetPlayerVehicleID(player id));
DestroyVehicle(gTrailer);
}
new FloatX,FloatY,FloatZ;
GetPlayerPos(playerid,pX,pY,pZ);
new FloatA;
GetVehicleZAngle(GetPlayerVehicleID(playerid),pA);
new newtrailer = CreateVehicle(450,pX+7,pY+7,pZ+7,pA,-1,-1,0);
AttachTrailerToVehicle(newtrailer,GetPlayerVehicle ID(playerid));

its not attaching.. simply not attaching... i was searching for xoomer mini mission and i found that he created the vehicle at 0.0,0.0,0.0 and the trailer attached so wth?... how my trailer not attaching to the truck it's just not normal..
Reply
#9

someone please?...
Reply
#10

Are you sure there's actually a player in the vehicle when calling that function?

( And use the tags to display code )
Reply
#11

yes. i'm at a truck and when im calling the command the trailer is spawning but not attaching..
Reply
#12

Quote:

Important Note: Will only work if both vehicles are streamed in. -> Taken from the SA:MP wiki

Do the above ^.
Reply
#13

what does it mean (need to be streamed?...)
Reply
#14

Both vehicles must be streamed in, IE close to you.

OFFTOPIC:

I helped Rodney to get to level 9, 25 and 26 xD suckit
Reply
#15

Quote:
Originally Posted by biltong
Both vehicles must be streamed in, IE close to you.

OFFTOPIC:

I helped Rodney to get to level 9, 25 and 26 xD suckit
they are closed to me..

pawn Код:
if(strcmp(cmd, "/transport", true) == 0)
    {
      if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pJob] == 23)
            {
              if(tr_check[playerid] >= 1)
              {
                    if(PlayerInfo[playerid][pJobTime] == 0)
                  {
                        new newcar = GetPlayerVehicleID(playerid);
                        if(newcar >= 254 && newcar <= 255)
                        {
                          if(PlayerToPoint(20.0,playerid,1647.3077,-2112.8350,13.5547))
                        { //vlada
                            new Float:pX,Float:pY,Float:pZ;
                                GetPlayerPos(playerid,pX,pY,pZ);
                                /*new Float:pA;
                                GetVehicleZAngle(GetPlayerVehicleID(playerid),pA);*/

                                new Float:vX,Float:vY,Float:vZ;
                                new Found=0;
                                new newtrailer = AddStaticVehicleEx(450,pX,pY,pZ,0.0,-1,-1,0);
                                while((GetPlayerVehicleID(playerid)<MAX_VEHICLES)&&(!Found))
                                {
                                GetVehiclePos(GetPlayerVehicleID(playerid),vX,vY,vZ);
                                if((floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0)&&(floatabs(pZ-vZ)<7.0))
                                {
                                    Found=1;
                                if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
                                {
                                        new gTrailer = GetVehicleTrailer(GetPlayerVehicleID(playerid));
                                    DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
                                    DestroyVehicle(gTrailer);
                                }
                                    AttachTrailerToVehicle(newtrailer,GetPlayerVehicleID(playerid));
                                    SetPlayerCheckpoint(playerid,2431.2773,114.5036,26.4689,20.0);
                                    transportcheck[playerid]=1; tr_check[playerid] = 0;
                                    GameTextForPlayer(playerid,"~r~Transport ~w~the container to the selected destination!",8000,3);
                                } }
                            }
                            else
                            {
                              SendClientMessage(playerid, COLOR_GREY,"* You need to be in the working place entrance area to enable the mission.");
                            }
                    }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY,"* You cannot transport without a transporter vehicle!");
                        }
                    }
                    else
                    {
                      SendClientMessage(playerid, COLOR_GREY,"* You are already started the your job mission.");
                    }
            }
                else
                {
          format(string, sizeof(string), "* You cannot transport at the moment, please come again in %d minutes.", PlayerInfo[playerid][pJobTime]);
                    SendClientMessage(playerid, COLOR_GREY, string);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY,"* You are not a transporter.");
            }
        }
        return 1;
    }
Reply
#16

someone please?...
Reply
#17

not answered yet... please i really need it..
Reply
#18

Are you sure u did everything good? All i did was go to the position with my character and save it then replaced it with

Код:
new trailer;
Trailer = AddVehicle(blahblah
and then when he pushes a button it goes like:

Код:
if(GetPlayerVehicleID(playerid) == Truck1)
	  {
	    //code
		  AttachTrailerToVehicle(Trailer1,Truck1);
			//code
		}
HOpe i helped?
Reply
#19

pawn Код:
new vc = CreateVehicle(trailer,0,0,0,0,0,0,0)
AttachTrailerToVehicle(vc,GetPlayerVehicleID(playerid));
Reply
#20

Compare you code to this.
this code works so just fix what you need

Код:
//Towing Stuff
CMD:tow(playerid, params[]) {
	if(IsPlayerConnected(playerid)) {
		if(IsPlayerInAnyVehicle(playerid)) {
	        new m = GetVehicleModel(GetPlayerVehicleID(playerid));
	    	if (m == 525 || m == 552) {
	   	   	    if(GetPlayerState(playerid)==2) {
					new Float:pX,Float:pY,Float:pZ;
					GetPlayerPos(playerid,pX,pY,pZ);
					new Float:vX,Float:vY,Float:vZ;
					new Found=0;
					new vid=0;
					while((vid<MAX_VEHICLES)&&(!Found)) {
	   					vid++;
	   					GetVehiclePos(vid,vX,vY,vZ);
	   					if ((floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0)&&(floatabs(pZ-vZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid))) {
	   				    	Found=1;
	   				    	if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) {
	   				        	DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
				           	}
				           	else {
	    						AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
							}
	 					}
	     			}
					if(!Found) {
	   					SendClientMessage(playerid, COLOR_RED, "[ Error ]: There is no car in range.");
	   				}
				}
				else {
					SendClientMessage(playerid, COLOR_RED, "[ Error ]: You need to be the driver!");
					return 1;
				}
			}
			else	{
			SendClientMessage(playerid, COLOR_RED, "[ Error ]: You need to be in a vehicle to do this!");
			return 1;
		}
	}
 	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: