bool ObservePlayerPage::PopulateMenuPage(player_t *player_ptr)
{
	this->SetEscLink("%s", Translate(player_ptr, 3110));
	this->SetTitle("%s", Translate(player_ptr, 3111));

	MenuItem *ptr = NULL;

	if (gpManiObserverTrack->observer_id[player_ptr->index - 1] != -1)
	{
		ptr = new ObservePlayerItem;
		ptr->SetDisplayText("%s", Translate(player_ptr, 3114));
		ptr->params.AddParamVar("user_id", "%i", -1);
		ptr->SetHiddenText(" ");
		this->AddItem(ptr);
	}

	for( int i = 1; i <= max_players; i++ )
	{
		player_t player;
		player.index = i;
		if (!FindPlayerByIndex(&player)) continue;
		if (player.player_info->IsFakeClient())
		{
			continue;
		}

		ptr = new ObservePlayerItem;

		if (gpManiObserverTrack->observer_id[player_ptr->index - 1] == player.index)
		{
			ptr->SetDisplayText("%s [%s] %i",
				Translate(player_ptr, 3112),
				player.name, 
				player.user_id);
		}
		else
		{
			ptr->SetDisplayText("[%s] %i",
				player.name, 
				player.user_id);
		}

		ptr->SetHiddenText("%s", player.name);
		ptr->params.AddParamVar("user_id", "%i", player.user_id);
		this->AddItem(ptr);
	}

	this->SortHidden();
	return true;
}
Esempio n. 2
0
bool SetSkinPage::PopulateMenuPage(player_t *player_ptr)
{
	this->SetEscLink("%s", Translate(player_ptr, 780));
	this->SetTitle("%s", Translate(player_ptr, 781));

	for( int i = 1; i <= max_players; i++ )
	{
		player_t player;
		player.index = i;
		if (!FindPlayerByIndex(&player)) continue;
		if (player.is_dead)	continue;

		if (player_ptr->index != player.index &&
			gpManiClient->HasAccess(player.index, IMMUNITY, IMMUNITY_SETSKIN))
		{
			continue;
		}

		MenuItem *ptr = new SetSkinItem();
		ptr->SetDisplayText("[%s] %i", player.name, player.user_id);
		ptr->SetHiddenText("%s", player.name);
		ptr->params.AddParam("user_id", player.user_id);
		this->AddItem(ptr);
	}

	this->SortHidden();
	return true;
}
bool RestrictWeaponPage::PopulateMenuPage(player_t *player_ptr)
{
	this->SetEscLink("%s", Translate(player_ptr, 530));
	this->SetTitle("%s", Translate(player_ptr, 531));

	// Setup weapon list
	for( int i = 0; i < MAX_WEAPONS_USED; i++ )
	{
		if ( !gpManiWeaponMgr->weapons[i] ) continue;
		if (gpManiWeaponMgr->weapons[i]->GetDisplayID() == 0) continue;

		MenuItem *ptr = new RestrictWeaponItem();
		if (!gpManiWeaponMgr->weapons[i]->IsRestricted())
		{
			ptr->SetDisplayText("%s", Translate(player_ptr, gpManiWeaponMgr->weapons[i]->GetDisplayID()));	
		}
		else
		{
			ptr->SetDisplayText("* %s <%i>", 
				Translate(player_ptr, gpManiWeaponMgr->weapons[i]->GetDisplayID()), 
				gpManiWeaponMgr->weapons[i]->GetTeamLimit());
		}

		ptr->SetHiddenText("%s", Translate(player_ptr, gpManiWeaponMgr->weapons[i]->GetDisplayID()));
		ptr->params.AddParam("index", i);
		this->AddItem(ptr);
	}

	this->SortHidden();
	return true;

}