Show Players Faction Online?
#1

How Do I make a script that when you write /fazioni opens a PlayerShowDialog with options Police, Medical, Army etc... if I select and I press OK button it shows me the Players in duty.
EXAMPLE:
Police in duty: 7
Name_Surname
Name_Surname
etc...
Reply
#2

Run a loop and if(*Is player in a faction* != 0) then create the string that has their name etc. and after the loop just showplayerdialog
Reply
#3

@Blademaster680 Can you give me a script? I select a option and it shows me the players online in the faction
Reply
#4

Try this. Just change the variables to what your script is
Код:
#define DIALOG_FACOD 565
#define DIALOG_ONDUTy 566

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
    	case DIALOG_FACOD:
		{
			if(!response) return 1;
			if(response)
			{
				switch(listitem)
				{
					if(listitem == 0)
					{
						new str[128], od[500];
						for(new i = 0; i < MAX_PLAYERS; i++)
						{
							if(PlayerInfo[playerid][pFaction] == 1) // Change this to your Police faction
							{
								if(GetPVarInt(i, "OnDuty") == 1)
								{
									format(str, sizeof(str), "%s \n", GetName(i));
									strcat(od, str, sizeof(od));
								}
							}
						}
						ShowPlayerDialog(playerid, DIALOG_ONDUTY, DIALOG_STYLE_MSGBOX, "Police on duty", od, "Ok", "");
					}
					else if(listitem == 1)
					{
						new str[128], od[500];
						for(new i = 0; i < MAX_PLAYERS; i++)
						{
							if(PlayerInfo[playerid][pFaction] == 2) // Change this to your Medic faction
							{
								if(GetPVarInt(i, "OnDuty") == 1)
								{
									format(str, sizeof(str), "%s \n", GetName(i));
									strcat(od, str, sizeof(od));
								}
							}
						}
						ShowPlayerDialog(playerid, DIALOG_ONDUTY, DIALOG_STYLE_MSGBOX, "Medics on duty", od, "Ok", "");
					}
				}
			}
			return 1;
		}
	}
	return 1;
}

CMD:fazioni(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_FACOD, DIALOG_LIST, "Select a Faction", "Police \nMedic", "Ok", "Cancel");
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)