SA-MP Forums Archive
Problem dialog - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem dialog (/showthread.php?tid=665310)



Problem dialog - KamilPolska - 30.03.2019

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;
}



Re: Problem dialog - NaS - 30.03.2019

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.


Re: Problem dialog - KamilPolska - 30.03.2019

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


Re: Problem dialog - KamilPolska - 30.03.2019

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


Re: Problem dialog - solstice_ - 31.03.2019

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.