Raised This Month: $32 Target: $400
 8% 

[CSS] How do i hook "Map end"?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
~Gh05t~
Member
Join Date: Oct 2007
Old 08-24-2010 , 11:47   [CSS] How do i hook "Map end"?
Reply With Quote #1

Hi all,
how can i pre hook the map end event in cs:s?
I want to do something when scoreboard is shown, but before mapchange is started. Can i change the time the scoreboard is shown somehow?
Thanks for help,

~Gh05t~
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 08-24-2010 , 13:05   Re: [CSS] How do i hook "Map end"?
Reply With Quote #2

There is the forward OnMapEnd. However, I'm not sure if this is when the scoreboard is displayed or not.
KyleS is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 08-24-2010 , 15:55   Re: [CSS] How do i hook "Map end"?
Reply With Quote #3

Quote:
Originally Posted by ~Gh05t~ View Post
I want to do something when scoreboard is shown, but before mapchange is started.
The word you're looking for is "intermission". There should be a few threads about it.

Quote:
Originally Posted by ~Gh05t~ View Post
Can i change the time the scoreboard is shown somehow?
I believe this is controlled by mp_chattime.
__________________
plop
p3tsin is offline
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 08-24-2010 , 21:02   Re: [CSS] How do i hook "Map end"?
Reply With Quote #4

Isn't it Sourcemod itself that forces scoreboard to appear? I don't think it's an original CS:S feature. If so, you need to interfere in default plugins' work or rewrite them.
mp_chattime holds number of seconds between one team's win event and beginning of the next round. You can set it to your liking to do something before map changes.
__________________
Lord Canistra is offline
NouveauJoueur
SourceMod Donor
Join Date: May 2009
Old 08-24-2010 , 21:12   Re: [CSS] How do i hook "Map end"?
Reply With Quote #5

This is a default feature.

Round end --> Show scoreboard& freeze the game

Even on vanilla servers.
__________________
NouveauJoueur is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 08-24-2010 , 22:41   Re: [CSS] How do i hook "Map end"?
Reply With Quote #6

If you need to hook when the scoreboard is shown hook VGUIMenu. Gungame uses this.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
~Gh05t~
Member
Join Date: Oct 2007
Old 08-25-2010 , 03:06   Re: [CSS] How do i hook "Map end"?
Reply With Quote #7

Quote:
Originally Posted by p3tsin View Post
The word you're looking for is "intermission". There should be a few threads about it.

I believe this is controlled by mp_chattime.
Thanks, i think this is exactly what i was searching for. I just didnt find the event name of intermission in the wiki, but it seems that there isnt an event for that in cs:s. I will have to hool VGUIMenu and check for scoreboard.

I want the scoreboard not not to come up directly, i think ill try to prevent that and open it myself after some time with a VGUIMenu hook... is that possible? Can i return "return Plugin_Handled" and call it myself afterwards?

something like
PHP Code:
public OnPluginStart()
{
    
HookUserMessage(GetUserMessageId("VGUIMenu"),hook_VGUIMenu,true);
}

public 
Action:hook_VGUIMenu(UserMsg:msg_idHandle:bf, const players[], playersNumbool:reliablebool:init
{
    return 
Plugin_Handled;

How do i call it again?

Last edited by ~Gh05t~; 08-27-2010 at 03:59.
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 09-09-2010 , 04:21   Re: [CSS] How do i hook "Map end"?
Reply With Quote #8

Did you have any success with this?

I'm also interested in preventing the scoreboard from being shown automatically during "mp_chattime".
GoD-Tony is offline
~Gh05t~
Member
Join Date: Oct 2007
Old 09-09-2010 , 11:37   Re: [CSS] How do i hook "Map end"?
Reply With Quote #9

Hello,
yes i was successfull. You have to hook the VGUI-Menu call, then you can filter the scores and prevent it to come up.
PHP Code:
HookUserMessage(GetUserMessageId("VGUIMenu"),Hook_VGUIMenu,true);
...
new 
bool:IsIntermissionCalled;
public 
Action:Hook_VGUIMenu(UserMsg:msg_idHandle:bf, const players[], playersNumbool:reliablebool:init)
{
    new 
String:s[10];
    
BfReadString(bfssizeof(s));

    
// Read parameters, filter scoreboard
    
if(strcmp(s"scores"false) == 0)
    {
        if(
BfReadByte(bf) == && BfReadByte(bf) == 0)
        {
            
// We want do do this only one time...
            
if(!IsIntermissionCalled)
            {
                
IsIntermissionCalled true
                
// Call intermission routine
                
Event_Intermission();
            }
            
// prevent scores menu to come up
            
return Plugin_Handled;
        }

        return 
Plugin_Continue;
}

// Called on intermission... do what you want.
public Event_Intermission(){ ... } 
If you want to show scores later, you can use that:
PHP Code:
public showScoreBoard()
{
    new 
Handle:hScoreBoardMsg INVALID_HANDLE;
    new 
players[MaxClients];
    new 
k;

    for(new 
1<= MaxClientsi++)
    {
        if(
IsClientInGame(i) && !IsFakeClient(i))
        {
            
players[k++] = i;
        }
    }
    
hScoreBoardMsg =  StartMessage("VGUIMenu",players,k,USERMSG_RELIABLE USERMSG_BLOCKHOOKS);
    if(
hScoreBoardMsg != INVALID_HANDLE)
    {
         
BfWriteString(hScoreBoardMsg"scores");
         
BfWriteByte(hScoreBoardMsg1); // Show
         
BfWriteByte(hScoreBoardMsg0); // subkeys count
         
EndMessage();
     }
     else 
PrintToServer("[DEBUG] Invalid Msg Handle.");

Have fun with that...
~Gh05t~ is offline
Send a message via ICQ to ~Gh05t~
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 09-09-2010 , 11:45   Re: [CSS] How do i hook "Map end"?
Reply With Quote #10

game_over I believe, is the event where the scoreboard is shown.
__________________
pheadxdll is offline
Reply


Thread Tools
Display Modes

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 10:45.


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