AttachTrailerToVehicle bug
#1

I'm working on a trucking system with a dialog.
This is what I have right now.

Код:
		case DIALOG_TRUCKER:
		{
			new Float:x, Float:y, Float:z;
			GetPlayerPos(playerid, x, y, z);
			new col1 = randomEx(128,255);
			new col2 = randomEx(128,255);
			new tr = randomEx(1, 2);
			if(tr == 1)
			{
				pInfo[playerid][TrailID] = CreateVehicle(591, x, y, z+15, 0, col1, col2, -1);
			}		
			else if(tr == 2)
			{
				pInfo[playerid][TrailID] = CreateVehicle(435, x, y, z+15, 0, col1, col2, -1);
			}
			new vehicleid = GetPlayerVehicleID(playerid);
			switch(listitem)
			{
				case 0:
				{
					SetPlayerCheckpoint(playerid, 1190.2216,-883.0084,43.0915, 5);
					SendClientMessage(playerid, COLOR_GREY, "You have chosen the delivery for Burger Shot LS.");
					pInfo[playerid][Checkpoint] = 3;
					AttachTrailerToVehicle(pInfo[playerid][TrailID], vehicleid);
				}				
				case 1:
				{
					SetPlayerCheckpoint(playerid, 369.6213,-2043.0742,7.6719, 5);
					SendClientMessage(playerid, COLOR_GREY, "You have chosen the delivery for Fish LS.");
					pInfo[playerid][Checkpoint] = 4;
					AttachTrailerToVehicle(pInfo[playerid][TrailID], vehicleid);
				}				
				case 2:
				{
					SetPlayerCheckpoint(playerid, 1389.0614,266.1005,19.5669, 5);
					SendClientMessage(playerid, COLOR_GREY, "You have chosen the delivery for Montegory's Pizza Stack.");
					pInfo[playerid][Checkpoint] = 5;
					AttachTrailerToVehicle(pInfo[playerid][TrailID], vehicleid);
				}
			}
		}
The problem here is, that the trailer is spawning but it isn't attaching to the truck.
What did I do wrong?
Reply
#2

Anyone?
Reply
#3

@danielpalade
please debug your code with "IsTrailerAttachedToVehicle" and check whetever the trailer is attached or not.
Reply
#4

Quote:
Originally Posted by GangstaSunny
Посмотреть сообщение
@danielpalade
please debug your code with "IsTrailerAttachedToVehicle" and check whetever the trailer is attached or not.
Well I can't see it being attached to the vehicle, so it probably isn't?
Reply
#5

Anyone?
Reply
#6

"This will only work if both vehicles are streamed in for a player"

And also i would suggest not to spawn it and directly connect it afterwards, maybe set a timer to make it happen 1 second later, i dont know if that helps tho, it is just a random guess.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)