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

Close a Panel when new round begins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
~Gh05t~
Member
Join Date: Oct 2007
Old 02-26-2010 , 05:33   Close a Panel when new round begins
Reply With Quote #1

Hi all,
i have a plugin (SM-Quiz) that uses a Panel to show Questions to dead players.
Now i have the Problem, that these Panel stays open when a new round starts.
I have tried to close the panel that way:

PHP Code:
HookEvent("round_end",closePanels,EventHookMode_PostNoCopy);
...
public 
closePanels(Handleevent, const Stringname[], booldontBroadcast)
{
   new 
Handle:hEmptyPanel INVALID_HANDLE;

   
hEmptyPanel CreatePanel();
   
SetPanelTitle(hEmptyPanel" ");
   for(new 
1<= GetMaxClients(); i++)
   {
      
// check if client is valid and could have a panel displayed
      
if(hasClientPanel(i))
      {
         
// Send empty panel that closes after 1 sec
         
SendPanelToClient(hEmptyPaneliHandler_QuizPanel1);
      }
   }
   
CloseHandle(hEmptyPanel);

Unfortunately that does only work sometimes. Any idea how to do that?
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
Arson
BANNED
Join Date: Jan 2005
Old 02-26-2010 , 08:11   Re: Close a Panel when new round begins
Reply With Quote #2

Quote:
Originally Posted by ~Gh05t~ View Post
Hi all,
i have a plugin (SM-Quiz) that uses a Panel to show Questions to dead players.
Now i have the Problem, that these Panel stays open when a new round starts.
I have tried to close the panel that way:

PHP Code:
HookEvent("round_end",closePanels,EventHookMode_PostNoCopy);
...
public 
closePanels(Handleevent, const Stringname[], booldontBroadcast)
{
   new 
Handle:hEmptyPanel INVALID_HANDLE;

   
hEmptyPanel CreatePanel();
   
SetPanelTitle(hEmptyPanel" ");
   for(new 
1<= GetMaxClients(); i++)
   {
      
// check if client is valid and could have a panel displayed
      
if(hasClientPanel(i))
      {
         
// Send empty panel that closes after 1 sec
         
SendPanelToClient(hEmptyPaneliHandler_QuizPanel1);
      }
   }
   
CloseHandle(hEmptyPanel);

Unfortunately that does only work sometimes. Any idea how to do that?

Maybe just...

Code:

HookEvent("round_end",closePanels,EventHookMode_Post);

public closePanels(Handle:event, const String: name[], bool: dontBroadcast)
{
  CloseQuiz(menu);
}

public Action:CloseQuiz(Handle:menu)
{
CloseHandle(menu);
}
Arson is offline
~Gh05t~
Member
Join Date: Oct 2007
Old 02-26-2010 , 10:09   Re: Close a Panel when new round begins
Reply With Quote #3

Hmmm... this would close the Handle (i.e. the functionality on server side), but not the displayed panel on the client i think.
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 02-26-2010 , 10:19   Re: Close a Panel when new round begins
Reply With Quote #4

I think what you already posted is the only way to do it. It should work fine. Does the quiz sometimes pop up after round end? If that's your problem, temporarily disable the quiz between round end and round start. just to be sure you catch anybody that may have one open.
__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
~Gh05t~
Member
Join Date: Oct 2007
Old 02-26-2010 , 10:24   Re: Close a Panel when new round begins
Reply With Quote #5

hmmmm... possible. Should check this, thx for advice.

Can i check if theres another panel opened on the client (mapvote for example)? I could disable the quiz then, too.
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 02-26-2010 , 10:33   Re: Close a Panel when new round begins
Reply With Quote #6

Im not sure if this works for panels, but to check if they have a menu open (like a mapvote), you can use this.

PHP Code:
if (GetClientMenu(client) != MenuSource_None)
{
    
// client currently has a menu open

__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
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 08:05.


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