How to tow a car?
#1

Problem,the car is not towed.
AttachTrailerToVehicle not work.

Code:

Код:
if (newkeys == KEY_CTRL_BACK)
   {
        if(PlayerInfo[playerid][pJob] == 8)
  		{
  		    if(GetPlayerState(playerid) != 2 && GetPlayerVehicleID(playerid) != 525) return SCM(playerid, -1, "Nu esti in masina de mecanici.");
			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)))
				{
					if(IsABike(vid) || GetVehicleModel(vid) == 448 ||  GetVehicleModel(vid) == 525 || GetVehicleModel(vid) == 461 || GetVehicleModel(vid) == 462 || GetVehicleModel(vid) == 463 || GetVehicleModel(vid) == 468 || GetVehicleModel(vid) == 471 || GetVehicleModel(vid) == 521 || GetVehicleModel(vid) == 522 || GetVehicleModel(vid) == 523)
					{
	    				return SCM(playerid, -1, "Nu poti tracta acest tip de vehicul.");
					}
					if(IsAnOwnableCar(vid))
					{
	    				SCM(playerid,COLOR_WHITE,"Nu ai voie sa tractezi masini personale.");
	    				return 1;
					}
					if(TowAcc[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "Nu poti tracta atat de repede o masina, trebuie sa astepti 2 minute.");
	    			Found=1;
    				if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
					{
    					DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
 						DisablePlayerCheckpoint(playerid);
     					gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
      				}
         			else
           			{
 						AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
   						new rand;
						rand = random(sizeof(TowCarCk));
  						SetPlayerCheckpoint(playerid, TowCarCk[rand][0],TowCarCk[rand][1],TowCarCk[rand][2], 6);
  						CP[playerid] = 34;
					}
				}
			}
		}
   }
Reply


Messages In This Thread
How to tow a car? - by Longover - 25.02.2019, 17:48
Re: How to tow a car? - by Kaliber - 26.02.2019, 09:42
Re: How to tow a car? - by Longover - 27.02.2019, 14:35

Forum Jump:


Users browsing this thread: 1 Guest(s)