Problem dialog
#1

I have a problem.
A player with ID 0 will attach a trailer and a dialogue with the mission pops up. (Well)
A player with ID 1 will attach a trailer and do not show dialogue with the mission. (Wrong)
Why? How to fix it so that they show a dialogue with the mission for other IDs.

Код:
new MissionStatus[MAX_PLAYERS];

enum mlInfo
{
	TrailerID[10],
	TrailerMissionID,
	TrailerMissionStatus[15],
	TrailerMissionName[25],
	Float:TrailerMissionUnloadX,
	Float:TrailerMissionUnloadY,
	Float:TrailerMissionUnloadZ,
	TrailerMissionPayMoney,
	TrailerMissionPayScore
}
new TrailerMissionLocation[][mlInfo] =
{
	{0, 0, "Legal", "Dillimore", 610.9240, -590.9404, 17.2266, 100, 1},
	{1, 1, "Illegal", "El Quebrados", -1499.8832, 2533.9829, 55.6875, 200, 2}
};

public OnGameModeInit()
{
	SetTimer("OnTrailerUpdateXX", 1000, true);

	TrailerMissionLocation[0][TrailerID] = CreateVehicle(435, 2749.8076, 2628.5588, 11.4041, 206.2215, 1, 1, 60); // TrailerLV
	TrailerMissionLocation[1][TrailerID] = CreateVehicle(435, 2756.3267, 2628.5952, 11.4061, 206.6927, 1, 1, 60); // TrailerLV

	return 1;
}

forward OnTrailerUpdateXX(playerid, vehicleid);
public OnTrailerUpdateXX(playerid, vehicleid)
{
	new vID = GetPlayerVehicleID(playerid);
	new string[250];

	if(MissionStatus[playerid] == 0)
	{
		if(GetVehicleTrailer(vID) == TrailerMissionLocation[0][TrailerID])
		{
			ShowPlayerDialog(playerid, 700, DIALOG_STYLE_MSGBOX, "Info", "Mission 1", "Yes", "Cancel");
		}
		else if(GetVehicleTrailer(vID) == TrailerMissionLocation[1][TrailerID])
		{
			ShowPlayerDialog(playerid, 701, DIALOG_STYLE_MSGBOX, "Info", "Mission 2", "Yes", "Cancel");
		}
	}
	return 0;
}
Reply
#2

Your timer doesn't pass any extra parameters to OnTrailerUpdateXX. So playerid and vehicleid arguments will always be 0.

You need to use SetTimerEx and pass the two values for playerid and vehicleid to it.
Reply
#3

Okay, but it will not work on OnGameModeInit so where should I do it in OnPlayerConnect?
Reply
#4

I do not know if this will be good because I think it's best to do it in OnGameModeInit..
Reply
#5

As already mentioned, the timer is not passing any extra parameters and you need to use SetTimerEx, you can leave it where it is but just loop the players instead of using playerid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)