SA-MP Forums Archive
List of players with a special criteria - 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: List of players with a special criteria (/showthread.php?tid=641914)



List of players with a special criteria - Kampott - 22.09.2017

So, i need a dialog that will show the list of people with a special criteria
Example:
Код:
stock criteria();
{
	for(new i; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(GetPlayerWantedLevel(playerid) > 1)
			{
				//code that adds the player to the dialog
			}
		}
	}
	new list[5000];
	format(list, sizeof(list), ?);
	ShowPlayerDialog(playerid, -1, DIALOG_STYLE_LIST, "Playerlist", list, "ok","ok");
}
How could i manage to make the list show each player with more than 1 wanted level in a new line? (There shouldn't be empty lines)


Re: List of players with a special criteria - Livar - 22.09.2017

What database type are you using? Is it sql based or flatfile?


Re: List of players with a special criteria - Kampott - 22.09.2017

Quote:
Originally Posted by Livar
Посмотреть сообщение
What database type are you using? Is it sql based or flatfile?
It's sql


Re: List of players with a special criteria - ToiletDuck - 22.09.2017

Код:
stock criteria();
{
	new szList[800];
	for(new i; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(GetPlayerWantedLevel(i) > 1)
			{
				format(szList, sizeof(szList), "%s-%s (Wanted Level: %d\n", szList, Getlayername(i), GetPlayerWantedLevel(i)); // Change the getplayername the i = Playerid you're looping all players in the server
			}
		}
	}
	ShowPlayerDialog(playerid, -1, DIALOG_STYLE_LIST, "Playerlist", list, "ok","ok");
}



Re: List of players with a special criteria - Kampott - 22.09.2017

Quote:
Originally Posted by ToiletDuck
Посмотреть сообщение
Код:
stock criteria();
{
	new szList[800];
	for(new i; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(GetPlayerWantedLevel(i) > 1)
			{
				format(szList, sizeof(szList), "%s-%s (Wanted Level: %d\n", szList, Getlayername(i), GetPlayerWantedLevel(i)); // Change the getplayername the i = Playerid you're looping all players in the server
			}
		}
	}
	ShowPlayerDialog(playerid, -1, DIALOG_STYLE_LIST, "Playerlist", list, "ok","ok");
}
Much Thanks!