SA-MP Forums Archive
[CMD] /wanted - 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: [CMD] /wanted (/showthread.php?tid=588877)



[CMD] /wanted - DevaBeast - 13.09.2015

Hey guys!

How I can to write a command /wanted, which send you a dialog_style_list dialog with all players online which have wanted?

And, when I press one of them the server set a checkpoint to him.

Thank you!


Re: [CMD] /wanted - DevaBeast - 13.09.2015

You can to write your variables to this command.


Re: [CMD] /wanted - X337 - 13.09.2015

Код:
CMD:wanted(playerid, params[])
{
	new 
		str[256],
		name[MAX_PLAYER_NAME];
	foreach(new i : Player)
	{
		if(GetPlayerWantedLevel(i) > 0)
		{
			GetPlayerName(i, name, MAX_PLAYER_NAME);
			strcat(str, name);
			strcat(str, "\n");
		}
	}
	if(!!str[1])
		ShowPlayerDialog(playerid, 69, DIALOG_STYLE_LIST, "Wanted Players", str, "Close", "");
	else
		ShowPlayerDialog(playerid, 69, DIALOG_STYLE_LIST, "Wanted Players", "There's no wanted players", "Close", "");
	return 1;
}



Re: [CMD] /wanted - DevaBeast - 13.09.2015

Quote:
Originally Posted by X337
Посмотреть сообщение
Код:
CMD:wanted(playerid, params[])
{
	new 
		str[256],
		name[MAX_PLAYER_NAME];
	foreach(new i : Player)
	{
		if(GetPlayerWantedLevel(i) > 0)
		{
			GetPlayerName(i, name, MAX_PLAYER_NAME);
			strcat(str, name);
			strcat(str, "\n");
		}
	}
	if(!!str[1])
		ShowPlayerDialog(playerid, 69, DIALOG_STYLE_LIST, "Wanted Players", str, "Close", "");
	else
		ShowPlayerDialog(playerid, 69, DIALOG_STYLE_LIST, "Wanted Players", "There's no wanted players", "Close", "");
	return 1;
}
Thanks, but when I click on one player server needs to put a checkpoint on him, did you can to help me with that?


Re: [CMD] /wanted - X337 - 13.09.2015

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	// .....
	if(dialogid == 69)
	{
		if(response)
		{
			new a;
			foreach(new i : Player)
			{
				if(GetPlayerWantedLevel(i) > 0)
				{
					if(a == listitem)
					{
						// Put a checkpoint to that player
						break;
					}
					a++;
				}
			}
		}
	}
	// ...
}



Re: [CMD] /wanted - DevaBeast - 13.09.2015

Quote:
Originally Posted by X337
Посмотреть сообщение
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	// .....
	if(dialogid == 69)
	{
		if(response)
		{
			new a;
			foreach(new i : Player)
			{
				if(GetPlayerWantedLevel(i) > 0)
				{
					if(a == listitem)
					{
						// Put a checkpoint to that player
						break;
					}
					a++;
				}
			}
		}
	}
	// ...
}
Thank you man!