[CMD] /wanted
#1

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!
Reply
#2

You can to write your variables to this command.
Reply
#3

Код:
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;
}
Reply
#4

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?
Reply
#5

Код:
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++;
				}
			}
		}
	}
	// ...
}
Reply
#6

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)