Raised This Month: $ Target: $400
 0% 

Panel, radio style


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
skulk_on_dope
Junior Member
Join Date: Jan 2007
Old 01-17-2008 , 18:35   Panel, radio style
Reply With Quote #1

Hi,
I'm trying to create a Panel which provides some information's.
It should have the AMX Style (Radio Style). But all I get is a Valve Style menu :/

its for the mod Empires and this mod supports the style, as it is described here: http://www.empiresmod.com/forums/sho...nu+style+radio

It would be nice if anyone can tell me where I'm making a mistake with it.
Code:
public Plugin:myinfo = 
{
	name = "dummy",
	author = "skulk_on_dope",
	description = "dummy",
	version = "0.0",
	url = "http://www.sek2000.net/"
};

public OnPluginStart()
{
	RegConsoleCmd("say", Command_Say);
	RegConsoleCmd("say_team", Command_Say);
}

public Action:Command_Say(client, args)
{
	decl String:text[192];
	new startidx = 0;
	if (GetCmdArgString(text, sizeof(text)) < 1)
	{
		return Plugin_Continue;
	}
	
	if (text[strlen(text)-1] == '"')
	{
		text[strlen(text)-1] = '\0';
		startidx = 1;
	}
	
	if (strncmp(text[startidx], "say2", 4, false) == 0)
		startidx += 4;
	
	// Teamsay detection, need to remove Location (EMPIRES ONLY!!)
	if((strncmp(text[startidx], "(", 1, false) == 0) && (strncmp(text[startidx + 3], ")", 1, false) == 0))
		startidx += 5;
	
	if (strcmp(text[startidx], ".lvl", false) == 0)
	{
		decl String:targetName[64];
		GetClientName(client, targetName, sizeof(targetName));
		new Handle:panelStyle = GetMenuStyleHandle(MenuStyle_Radio);
		new Handle:panel = CreatePanel(panelStyle);
		decl String:line[80];
		
		SetPanelTitle(panel, "Ranking Stats" );
		DrawPanelText(panel, " ")
		DrawPanelItem(panel, "Basic Stats:")
		Format(line,sizeof(line),"Information on %s(DB Name: %s)", targetName, "Dummy");
		DrawPanelText(panel, line);
		Format(line,sizeof(line),"Client has a total score of %d", 0);
		DrawPanelText(panel, line);
		Format(line,sizeof(line),"and reached rank %d(%s)", 0, "dummy");
		DrawPanelText(panel, line);
		DrawPanelText(panel, " ");
		DrawPanelItem(panel, "Exit")
		SendPanelToClient(panel, client, BlankMenuHandler, 20)
		
		CloseHandle(panel)
		
		return Plugin_Handled;
	}
	
	return Plugin_Continue;
}

public BlankMenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
	
}
skulk_on_dope is offline
KMFrog
Senior Member
Join Date: Oct 2007
Old 01-17-2008 , 22:56   Re: Panel, radio style
Reply With Quote #2

Empires does not fully support radio menus so its disabled by default.

You can create a menu, but none of the clients have the slot keys bound - This means you cant make a selection on the menu.

See this thread for the (ignored) bug report: http://forums.empiresmod.com/showthread.php?t=4642
__________________
Was I helpful or not? Rate Me!

Last edited by KMFrog; 01-17-2008 at 23:02.
KMFrog is offline
skulk_on_dope
Junior Member
Join Date: Jan 2007
Old 01-18-2008 , 06:49   Re: Panel, radio style
Reply With Quote #3

I'll just want to use it for informations so there is no need for bound keys
skulk_on_dope is offline
BAILOPAN
Join Date: Jan 2004
Old 01-18-2008 , 07:12   Re: Panel, radio style
Reply With Quote #4

You can manually enable it by editing the menu section of core.games.txt. SourceMod can't distinguish between a menu intended for information or actual use, so we have to make a blanket restriction.
__________________
egg
BAILOPAN is offline
skulk_on_dope
Junior Member
Join Date: Jan 2007
Old 01-18-2008 , 09:42   Re: Panel, radio style
Reply With Quote #5

thanks now it works

but why doesn't:
native Handle:GetMenuStyleHandle(MenuStyle:style);
return a INVALID_HANDLE as it is described in the include file ?

I've tested that...
Code:
public Action:CMD_Debug(args)
{
    new Handle:RStyle = GetMenuStyleHandle(MenuStyle_Radio);
    new Handle:VStyle = GetMenuStyleHandle(MenuStyle_Valve);
    new Handle:DStyle = GetMenuStyleHandle(MenuStyle_Default);
    
    if(RStyle == INVALID_HANDLE)
    {
        PrintToServer("RStyle: INVALID_HANDLE");
    }
    else
    {
        PrintToServer("RStyle: VALID!");
    }
    
    if(VStyle == INVALID_HANDLE)
    {
        PrintToServer("VStyle: INVALID_HANDLE");
    }
    else
    {
        PrintToServer("VStyle: VALID");
    }
    
    if(DStyle == VStyle)
    {
        PrintToServer("DStyle: VStyle!");
    }
    else if(DStyle == RStyle)
    {
        PrintToServer("DStyle: RStyle!");
    }
    
    new Handle:panel = CreatePanel(RStyle);
    
    new Handle:PStyle = GetPanelStyle(panel);
    
    if(PStyle == RStyle)
    {
        PrintToServer("PanelStyle -> Radio");
    }
    
    CloseHandle(panel);
}
skulk_on_dope is offline
BAILOPAN
Join Date: Jan 2004
Old 01-19-2008 , 01:52   Re: Panel, radio style
Reply With Quote #6

I'm not sure what you're asking. In which situation does what not work?
__________________
egg
BAILOPAN is offline
skulk_on_dope
Junior Member
Join Date: Jan 2007
Old 01-19-2008 , 08:15   Re: Panel, radio style
Reply With Quote #7

in the documentation it says:
"A Handle, or INVALID_HANDLE if not found or unusable."
but it returns a valid handle aswell even if its unusable
skulk_on_dope is offline
BAILOPAN
Join Date: Jan 2004
Old 01-19-2008 , 10:06   Re: Panel, radio style
Reply With Quote #8

Sounds like a bug then.
__________________
egg
BAILOPAN is offline
KMFrog
Senior Member
Join Date: Oct 2007
Old 01-19-2008 , 11:05   Re: Panel, radio style
Reply With Quote #9

which line of code do you think causes the error?

If its something like this:
Code:
new Handle:Style = GetPanelStyle(panel);
Then the handle will always be valid, since you create a new one each time even if GetPanelStyle fails to return a value.

You also might want to sort out some of the memory issues in this code (each handle must be closed at some point)
__________________
Was I helpful or not? Rate Me!
KMFrog 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 20:26.


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