Random Mis
#1

I have a system made. I just don't know how to make 5 random missions.

https://pastebin.com/TdkXxWFw
Reply
#2

hi

all cordinates are equal it means you can't make it as random.
Reply
#3

Yes. The only problem is I do not know how to make 5 random missions to be chosen in the dialogue.
Reply
#4

help plz
Reply
#5

Get this include: https://sampforum.blast.hk/showthread.php?tid=343172
then shuffle the array with this: http://forum.sa-mp.com/showpost.php?...postcount=4051
Make a copy of MisLocations array with size just 5, shuffle it with the function, loop through the copied array, concatenate each line then show the dialog.
Reply
#6

I do not know how to do it exactly.
https://pastebin.com/i07Wqm3X
Reply
#7

Hi again

See this link, I think it may help you a lot.

LINK - https://sampforum.blast.hk/showthread.php?tid=223550

Regards.
Reply
#8

Quote:
Originally Posted by KamilPolska
Посмотреть сообщение
I do not know how to do it exactly.
https://pastebin.com/i07Wqm3X
Well sorry for making you misunderstood. I didn't ask you to reduce your array until 5, you can keep it like before (10). I mean you can use it like this:
Код:
CMD:z(playerid, params[])
{
	if(MissionStatus[playerid] == 0)
	{
		new LoadText[1000]; // dialog text buffer
		LoadText = "Commadity\tPoint\tPrize"; // the dialog headers
		ShuffleDeepArray(MisLocations); // random the order of array
		for (new i = 0; i < 5; i++) // pick only first 5 missions randomly
		{
			format(LoadText, 1000, "%s\n{008000}%s\t{FFFF00}%s\t{FF0000}%d $", LoadText, MisLocations[i][Commadity], MisLocations[i][LoadName], MisLocations[i][Pay]);
		}
		ShowPlayerDialog(playerid, DIALOG_MISSION, DIALOG_STYLE_TABLIST_HEADERS, "MISSION", LoadText, "OK", "Cancel");
	}
	else
	{
		SendClientMessage(playerid, COLOR_RED, "/cancel !");
	}
	return 1;
}
Then you can add more missions on MisLocations array, just make sure it has more than 5 items otherwise it would be useless to shuffle (would not work if less!). Everytime the player type the command, they will always get different 5 random missions. On the dialog response, get the inputtext to get the selected mission ID. You might get "{008000}1" where 1 is mission id and {008000} is the color embedding, you could delete the color embedding by deleting first 8 characters in string or just remove your color embedding code at the dialog command.

Hope that helps.
Reply
#9

Thanks !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)