Using a player array in switch statement
#1

So essentially, I have a command that displays the same dialog with options green depending on if the task has been finished, based on the values in the array.

new contract1[MAX_PLAYERS][3];
// 0 = option1
// 1 = option2
// 2 = option3

If 0 == 1, I want the first option in the dialog to be coloured green
if 1 == 1, I want the second option in the dialog to be coloured green
if 2 == 1, I want the third option to be colored green

Any number of these options can be green at the same but idk how to do it.

This is the command.
Код:
	if (strcmp("/contracts", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 5.0, -138.5305,1075.0895,19.7422))
		{
			if(job[playerid] != 1)
			{
				SendClientMessage(playerid, -1, "You are not a trucker.");

			}
			else
			{

		    	ShowPlayerDialog(playerid, DIALOG_CONTRACT1, DIALOG_STYLE_LIST, "Contracts", "Jim Aarons\nStark Industries\nXen Records", "Select", "Close");
			}
		}
		else
		{
 			SendClientMessage(playerid, -1, "You're not at the delivery station!");
		}
		return 1;
I know I could do long multiple if-else statements to accomplish it, but I want to find out what the quickest, most sufficient way is.
Reply


Messages In This Thread
Using a player array in switch statement - by Garr - 06.07.2014, 07:47
Re: Using a player array in switch statement - by RedFusion - 06.07.2014, 08:13
Re: Using a player array in switch statement - by RedFusion - 06.07.2014, 08:17
Re: Using a player array in switch statement - by Garr - 06.07.2014, 08:17
Re: Using a player array in switch statement - by RedFusion - 06.07.2014, 08:19

Forum Jump:


Users browsing this thread: 1 Guest(s)