Raised This Month: $51 Target: $400
 12% 

Solved AutoOpen every round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 11-25-2017 , 10:50   AutoOpen every round
Reply With Quote #1

Hello guys,

i dont know code to make autoopen menu every round, like its new round, it will open menu automatically, next round open menu automatically, and again.

Thanks if you help me.

Last edited by Javierko; 11-25-2017 at 12:47. Reason: solved
Javierko is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 11-25-2017 , 11:11   Re: AutoOpen every round
Reply With Quote #2

Code:
//Pragma
#pragma semicolon 1
#pragma newdecls required

//Sourcemod Includes
#include <sourcemod>
#include <sourcemod-misc>

//Globals

public Plugin myinfo = 
{
	name = "Auto Menu Per Round", 
	author = "Keith Warren (Drixevel)", 
	description = "Opens a menu per round about numbers.", 
	version = "1.0.0", 
	url = "http://www.drixevel.com/"
};

public void OnPluginStart()
{
	HookEvent("round_start", Event_RoundStart);
}

public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	Menu menu = CreateMenu(MenuHandler_Numbers);
	SetMenuTitle(menu, "Numbers");
	
	AddMenuItem(menu, "1", "1");
	AddMenuItem(menu, "2", "2");
	AddMenuItem(menu, "3", "3");
	
	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i) && !IsFakeClient(i))
		{
			DisplayMenu(menu, i, MENU_TIME_FOREVER);
			//DisplayMenu(CloneHandle(menu), i, MENU_TIME_FOREVER);
		}
	}
	
	//delete menu;
}

public int MenuHandler_Numbers(Menu menu, MenuAction action, int param1, int param2)
{
	switch (menu)
	{
		case MenuAction_Select:
		{
			//do stuff
		}
		
		case MenuAction_End:
		{
			delete menu;
		}
	}
}
Only issue with this is you may have to duplicate the menu handle for each client...?

Last edited by Drixevel; 11-25-2017 at 11:13.
Drixevel is offline
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 11-25-2017 , 11:20   Re: AutoOpen every round
Reply With Quote #3

Maybe, but i cant confess there.... can you add it into this menu?

PHP Code:
public Action:Command_Menu(clientargs)
{
  
Menu menu = new Menu(m_themenu);
  
menu.SetTitle("☰ Herní menu");
  if (
GetClientTeam(client) == CS_TEAM_T)
  {
    
menu.AddItem("item_1""● Obchod");
    
menu.AddItem("item_2""● Žádosti");
    
menu.AddItem("item_3""● Modely");
    
menu.AddItem("item_4""● Skin");
    
menu.AddItem("item_5""● Knife");
    
menu.AddItem("item_6""● Nastavení");
  }

But thanks for answer
Javierko is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 11-25-2017 , 11:24   Re: AutoOpen every round
Reply With Quote #4

Quote:
Originally Posted by Javierko View Post
Maybe, but i cant confess there.... can you add it into this menu?

PHP Code:
public Action:Command_Menu(clientargs)
{
  
Menu menu = new Menu(m_themenu);
  
menu.SetTitle("☰ Herní menu");
  if (
GetClientTeam(client) == CS_TEAM_T)
  {
    
menu.AddItem("item_1""● Obchod");
    
menu.AddItem("item_2""● Žádosti");
    
menu.AddItem("item_3""● Modely");
    
menu.AddItem("item_4""● Skin");
    
menu.AddItem("item_5""● Knife");
    
menu.AddItem("item_6""● Nastavení");
  }

But thanks for answer
You can either post that plugin and I can update it to do what you want or you can copy and paste the code from what I posted into the plugin instead.

edit: You can also just use a function like FakeClientCommand to have them automatically type in the command you want at the start of the round and/or the console command, either or.

Last edited by Drixevel; 11-25-2017 at 11:25.
Drixevel is offline
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 11-25-2017 , 12:47   Re: AutoOpen every round
Reply With Quote #5

Solved thanks
Javierko is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode