Help trailer
#1

How can I give ID_trailer for a trailer with a mission?

For:
Код:
CreateVehicle(591, -2105.3228, -124.2982, 37.2531, 0.0, 1, 1, -1);
Code:
Код:
enum MisLocationsEnum
{
	ID_trailer,
	Status[128],
	MissionName[128],
	Float:UnloadX,
	Float:UnloadY,
	Float:UnloadZ,
	Pay
}

new MisLocations[TRAILERS][MisLocationsEnum] =
{
	{0, "Legal", "Shop SF", -2177.2544, 107.1364, 35.3203, 10000},
	{1, "Illegal", "Gun Shop  SF", -2273.9893, 1.2645, 35.3203, 5000}
};
How can I use? For a trailer with ID_trailer?
Код:
public OnPlayerUpdate(playerid)
{
	new vID = GetPlayerVehicleID(playerid);
	if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)
	{
	    if(IsTrailerAttachedToVehicle(vID))
	    {
			ShowPlayerDialog(playerid, /*MISSION_1*/999, DIALOG_STYLE_MSGBOX, "INFO", "Point: Shop SF\nPrize: 5000$", "Yes", "No");
		}	
		else
		{
			SendClientMessage(playerid, COLOR_RED, "You need a trailer!");
		}
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "You must be in a Truck to perform this!");
	}
	return 1;
}
Reply
#2

help please?
Reply
#3

Not really sure what you're trying to do but if you're trying to get the ID of the trailer you can use GetVehicleTrailer
Reply
#4

I meant something like that: https://*********/RyMq9yP_ynM
Reply
#5

Can you explain again what you're trying to achieve?
If you want to store each trailer in ID_Trailer you should do something like this:


PHP код:
new ID_trailer[10// put the number of trailers you will create inside the brackets
And thenID_trailer[0] = CreateVehicle(591 ...);
               
ID_trailer[1] = CreateVehicle(591...); 
Reply
#6

I wanted a system like: https://*********/RyMq9yP_ynM
There are two trailers. I have a truck and I drive to the trailer. I connect the trailer and the msgbox dialogue pops up. In the dialogue he writes the unloading point: Shop SF, Status: Legal, Money: 5000 $. When I accept the mission, I have to go to the checkpoint with the trailer to earn money.
Reply
#7

Use Phreak's code above to create the trailers, once you've created the trailers,
under OnPlayerUpdate,
Код:
if(GetVehicleTrailer(vID) == ID_trailer[0]) //trailer 1 (ls)
{
		ShowPlayerDialog(playerid, /*MISSION_1*/997, DIALOG_STYLE_MSGBOX, "INFO", "Point: Shop LS\nPrize: 5000$", "Yes", "No");

}
else if(GetVehicleTrailer(vID) == ID_trailer[1]) //trailer 2 lv
{
		ShowPlayerDialog(playerid, /*MISSION_2*/998, DIALOG_STYLE_MSGBOX, "INFO", "Point: Shop LV\nPrize: 5000$", "Yes", "No");

}
else if(GetVehicleTrailer(vID) == ID_trailer[3]) //trailer 3 sf
{
		ShowPlayerDialog(playerid, /*MISSION_3*/999, DIALOG_STYLE_MSGBOX, "INFO", "Point: Shop SF\nPrize: 5000$", "Yes", "No");

}
If you wanna add the label to the trailers just use Attach3DTextLabelToVehicle under OnGameModeInit (or wherever you create the trailers)

Then under OnDialogResponse it will simply look something like this
Код:
if(dialogid == 999 && response)
{
        SetPlayerCheckpoint(playerid, /*x, y, z, size*/);
        SetPVarInt(playerid, "trucking", 1);
}
and then the event that happens when the player enters the destination under OnPlayerEnterCheckpoint

Код:
if(GetPVarInt(playerid, "trucking") == 1)
{
      DeletePVar(playerid, "trucking");
      SendClientMessage(playerid, 1, "Congratulations");
      //whatever else you wanna do
}
Give it ago, if you get stuck, ask for some more help.

(not tested any of this, but it will most likely work)
Reply
#8

THANKS!! Everything works. There is only one problem. I am connecting the trailer and there is a spam dialogue. For example, if I click Yes and start to drive forward, it again shows the dialogue.
So dialogue spam. I click all the time Yes and No it shows dialogue all the time.
Reply
#9

just put
Код:
if(GetPVarInt(playerid, "trucking") != 1)
{
//all the code you have for the trailer
}
Reply
#10

No, Don't use OnPlayerUpdate checking trailers attached to the vehicle, when there is a trailer callback at your disposal... Use as above said OnTrailerUpdate.





The reason your checkpoint keeps coming back is you aren't checking which dialog they are using and because it's simply looking for the response, it's simply showing it regardless of which dialog you hit.

Sit in that truck, and use any dialog, and it'll likely recreate the checkpoint.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)