Страница 1 от 1

need votemap modified

Публикувано на: 12 Яну 2019, 12:17
от Kvothe
this my boss and senario plugin. But only change map 1 (zl_boss_oberon_v2).

I want to list the 3 most recent maps and selected.
Example:
- 10 player say /boss , vote completed.
- Nextround open menu. Select map 1-zl_boss_oberon 2-zl_boss_alien 3-zs_senario
- open map more votes
Some like rtv system
Anyone pls help me

Код за потвърждение: Избери целия код

#include <amxmodx>

#define VOTES	10

#define HOURS	12
#define MINUTES	0
#define SECONDS	0

new g_iTime;
new g_iBoss;
new g_iVotes;
new g_iPlayerVote[33];
new g_szMaps[][] =
{
	"zl_boss_oberon_v2",
	"zl_boss_alien",
	"zs_senario"
}

public plugin_init()
{
	// register_menucmd(register_menuid("VoteBoss"), MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_0, "MenuVoteBoss");
	
	register_clcmd("vtbss", "ClCmdVtboss");
	register_clcmd("say /boss", "ClCmdVtboss");
	register_clcmd("say_team /boss", "ClCmdVtboss");
	
	register_event("HLTV", "EventRoundStart", "a", "1=0", "2=0");
	
	new szTime[12];
	
	if (get_localinfo("vtbss", szTime, charsmax(szTime))) g_iTime = str_to_num(szTime);
	
	if (get_systime() < g_iTime) set_task(float(g_iTime - get_systime()), "TaskCanVote");
	else set_task(120.0, "TaskAdv", _, _, _, "b");
	
	register_dictionary("csnz_voteboss.txt");
}

public TaskCanVote()
{
	client_print(0, print_chat, "%L", 0, "ZP_BOSS_INFO")
	client_print(0, print_chat, "%L", 0, "ZP_BOSS_INFO2")

	set_task(120.0, "TaskAdv", _, _, _, "b");
}

public TaskAdv()
{
	client_print(0, print_chat, "%L", 0, "ZP_BOSS_INFO3")
}

public client_disconnect(iEntity)
{
	if (g_iPlayerVote[iEntity])
	{
		g_iVotes--;
		
		g_iPlayerVote[iEntity] = 0;
	}
}

public ClCmdVtboss(iEntity)
{
	if (g_iPlayerVote[iEntity])
	{
		client_print(iEntity, print_chat, "oy verildi yeterli sayiya ulasilirsa acilacak", iEntity)
		return PLUGIN_HANDLED;
	}
	
	if (g_iBoss)
	{
		client_print(iEntity, print_chat, "%L", iEntity, "ZP_BOSS_ALREADY")
		return PLUGIN_HANDLED;
	}
	
	new iTime = g_iTime - get_systime();
	
	if (iTime > 0)
	{
		new iMinutes = (iTime / 60) + ((iTime % 60) ? 1 : 0);
		new iHours = (iMinutes / 60);
		
		iMinutes %= 60;
		
		if (iHours) 
			client_print(iEntity, print_chat, "%L", iEntity, "ZP_BOSS_DELAY_H", iHours, iMinutes)
		else 
			client_print(iEntity, print_chat, "%L", iEntity, "ZP_BOSS_DELAY_M", "VtbossWaitMinutes", iMinutes)
		
		return PLUGIN_HANDLED;
	}
	
	g_iPlayerVote[iEntity] = 1;
	
	if (++g_iVotes == VOTES)
	{		
		g_iBoss = 1;
			
		client_print(0, print_chat, "%L", iEntity, "ZP_BOSS_START")

		remove_task();
		
		return PLUGIN_HANDLED;
	}

	new szName[32]
	get_user_name(iEntity, szName, 31)	

	client_print(0, print_chat, "%L", iEntity, "ZP_BOSS_VOTE", szName, VOTES - g_iVotes)

	return PLUGIN_HANDLED;
}

public EventRoundStart()
{
	if (g_iBoss)
	{
		new last_id_str[10],last_id
		get_localinfo("vtmpi",last_id_str,charsmax(last_id_str))
		last_id = str_to_num(last_id_str)
		
		if(last_id >= sizeof g_szMaps)
			last_id = 0
		
		server_cmd("changelevel %s", g_szMaps[last_id]);
		
		num_to_str(last_id + 1,last_id_str,charsmax(last_id_str))
		set_localinfo("vtmpi",last_id_str)
		
		new szTime[12]
		
		num_to_str(get_systime() + HOURS * 3600 + MINUTES * 60 + SECONDS, szTime, charsmax(szTime));
		
		set_localinfo("vtbss", szTime);
	}
}