Show Players Faction Online? - 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: Show Players Faction Online? (
/showthread.php?tid=529449)
Show Players Faction Online? -
Steveproxy5 - 02.08.2014
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...
Re: Show Players Faction Online? -
Blademaster680 - 02.08.2014
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
Re: Show Players Faction Online? -
Steveproxy5 - 02.08.2014
@Blademaster680 Can you give me a script? I select a option and it shows me the players online in the faction
Re: Show Players Faction Online? -
Blademaster680 - 02.08.2014
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;
}