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

Send panel to multible players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
~Gh05t~
Member
Join Date: Oct 2007
Old 10-26-2007 , 09:34   Send panel to multible players
Reply With Quote #1

Hi all,
i have a problem with a Panel in my Plugin. I Want to send a Panel to some particular players to let them select some options (NOT to all players!).
Here is my code:
PHP Code:
new Handle:g_hMyPanel INVALID_HANDLE;

public 
displayPanel()
{
    
buildMyPanel();
    for(new 
1<= GetMaxClients(); i++)
    {
        if(
isValidClient(i)) //some more checks here
        
{
                
SendPanelToClient(g_hMyPaneliHandler_MyPanelDISPLAY_TIME);
        }
    }
    if(
g_hMyPanel != INVALID_HANDLECloseHandle(g_hMyPanel);
}

buildMyPanel()
{
    
g_hMyPanel CreatePanel();
    
SetPanelTitle(g_hMyPanel"Title");

    
DrawPanelText(g_hMyPanel"Text...");
    
DrawPanelText(g_hMyPanel" ");
    
    
DrawPanelItem(g_hMyPanel"Item 1"ITEMDRAW_DEFAULT);
    
DrawPanelItem(g_hMyPanel"Item 2"ITEMDRAW_DEFAULT);
    
DrawPanelItem(g_hMyPanel"Item 3"ITEMDRAW_DEFAULT);

    
SetPanelCurrentKey(g_hMyPanel10);
    
DrawPanelItem(g_hMyPanel"Exit"ITEMDRAW_CONTROL);
}

public 
Handler_MyPanel(Handle:menuMenuAction:actionparam1param2) {...} 
When i run displayPanel() i get that error message:
Code:
L 10/26/2007 - 14:41:48: [SM] Native "CloseHandle" reported: Handle aa0019 is invalid (error 1)
L 10/26/2007 - 14:41:48: [SM] Displaying call stack trace for plugin "myplugin.smx":
L 10/26/2007 - 14:41:48: [SM]   [0]  Line 241, myplugin.sp::displayPanel()
That problem does only occur, if i add selectable PanelItems ("ITEMDRAW_DEFAULT") to the Panel. How can i solve that problem? Do i realy have to build an own panel for each client?
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
ferret
SourceMod Developer
Join Date: Dec 2004
Location: Atlanta, GA
Old 10-26-2007 , 09:37   Re: Send panel to multible players
Reply With Quote #2

Do you close the panel in Handler_MyPanel?
__________________
I'm a blast from the past!
ferret is offline
~Gh05t~
Member
Join Date: Oct 2007
Old 10-26-2007 , 09:50   Re: Send panel to multible players
Reply With Quote #3

no, i dont... should i?
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
ferret
SourceMod Developer
Join Date: Dec 2004
Location: Atlanta, GA
Old 10-26-2007 , 10:04   Re: Send panel to multible players
Reply With Quote #4

No, if you did, that would definately be the problem. I don't have an answer right now, I haven't specificly used panels much, just Menus.
__________________
I'm a blast from the past!
ferret is offline
BAILOPAN
Join Date: Jan 2004
Old 10-26-2007 , 11:01   Re: Send panel to multible players
Reply With Quote #5

Can you paste the full code?
__________________
egg
BAILOPAN is offline
~Gh05t~
Member
Join Date: Oct 2007
Old 10-27-2007 , 07:55   Re: Send panel to multible players
Reply With Quote #6

Sry, iam no full-time developer, had no time yesterday
Ive shordened it a bit, because my Code is very long, the menu is only a short part.
But the shortened code has the problem ive described above. I dont think that it is a Problem of the Panel itself, but of the direct following Panels while another panel is displayed.
Heres my Code
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
ferret
SourceMod Developer
Join Date: Dec 2004
Location: Atlanta, GA
Old 11-05-2007 , 09:07   Re: Send panel to multible players
Reply With Quote #7

Couple of things:

#1) You don't need to find life state. You'll have to #include sdktools, but there is an "IsAlive()" native there, so that will save you a little effort.

#2) This is just an idea, but give it a try. Instead of doing this:

Code:
if(g_hMyPanel != INVALID_HANDLE) CloseHandle(g_hMyPanel);
At the end of displayPanel(), instead do it inside buildMyPanel(), just before you use CreatePanel();

Just an idea. I don't immediately see an issue with the way you've done it, but if you try that out, the panel will stay around until you need to change it.
__________________
I'm a blast from the past!
ferret is offline
BAILOPAN
Join Date: Jan 2004
Old 11-05-2007 , 09:14   Re: Send panel to multible players
Reply With Quote #8

FYI it's IsPlayerAlive() and was moved to core (clients.inc I believe) a week or two ago.
__________________
egg
BAILOPAN 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 07:41.


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