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

[CSGO] End of match message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zerg
Member
Join Date: May 2017
Old 03-25-2021 , 18:01   [CSGO] End of match message
Reply With Quote #1

Hello

I am using GET5 on my csgo server, I would like a way that when the game ends, all players are kicked and a message "END OF MATCH" appears for example.
zerg is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-25-2021 , 19:00   Re: [CSGO] End of match message
Reply With Quote #2

PHP Code:
public void OnPluginStart()
{
    
HookEventEx("round_officially_ended"round_officially_endedEventHookMode_PostNoCopy);
}

public 
Action round_officially_ended(Event event, const char[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i) || IsFakeClient(i)) continue;
        
        
KickClient(i"END OF MATCH");
    }

Bacardi is offline
zerg
Member
Join Date: May 2017
Old 03-25-2021 , 19:25   Re: [CSGO] End of match message
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
PHP Code:
public void OnPluginStart()
{
    
HookEventEx("round_officially_ended"round_officially_endedEventHookMode_PostNoCopy);
}

public 
Action round_officially_ended(Event event, const char[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i) || IsFakeClient(i)) continue;
        
        
KickClient(i"END OF MATCH");
    }

Very cool, thanks Bacardi
Except that he is expelling as soon as the first round ends

[Edit]
I changed the "round_officially_ended" to cs_win_panel_match, until it worked, but the closing is immediate, I could put a few seconds lolll

[Edit2]
Dear Bacardi
I did this code and it was satisfactory

Quote:
PHP Code:
typedef VoidFunction = function void();

public 
void OnPluginStart()
{
    
HookEventEx("cs_win_panel_match"cs_win_panel_matchEventHookMode_PostNoCopy);
}

public 
Action cs_win_panel_match(Event event, const char[] namebool dontBroadcast)
{
  
DelayFunction(20.0KickClientsOnEnd);
}


public 
void KickClientsOnEnd() {
    for(
int i 1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i) || IsFakeClient(i)) continue;

        
KickClient(i"END OF MATCH");
    }
}

stock void DelayFunction(float delayVoidFunction f) {
  
DataPack p CreateDataPack();
  
p.WriteFunction(f);
  
CreateTimer(delay_DelayFunctionCallbackp);
}


public 
Action _DelayFunctionCallback(Handle timerDataPack data) {
  
data.Reset();
  Function 
func data.ReadFunction();
  
Call_StartFunction(INVALID_HANDLEfunc);
  
Call_Finish();
  
delete data;


Last edited by zerg; 03-26-2021 at 00:16.
zerg is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-26-2021 , 06:58   Re: [CSGO] End of match message
Reply With Quote #4

Damed. I did not notice it will fire event every round.

Good that you made one.

I posted my second version.
PHP Code:

#include <sdktools>

public void OnPluginStart()
{
    
HookEventEx("cs_win_panel_match",        eventsEventHookMode_PostNoCopy);
    
HookEventEx("cs_intermission",            eventsEventHookMode_PostNoCopy);
    
//HookEventEx("announce_phase_end",        events, EventHookMode_PostNoCopy);
    
HookEventEx("round_officially_ended",    eventsEventHookMode_PostNoCopy);
    
HookEventEx("server_spawn",                eventsEventHookMode_PostNoCopy);
}

public 
Action events(Event event, const char[] namebool dontBroadcast)
{
    static 
bool IsItOver;

    if( 
StrEqual(name"cs_win_panel_match"false) ||
        
StrEqual(name"cs_intermission"false) ||
        
StrEqual(name"announce_phase_end"false)) {

        
// Print once.
        
if(!IsItOverPrintToChatAll(" \x04End of match. You will be automatically kicked out from server");

        
IsItOver true;
        return;
    }

    
// Reset value whenever map start
    
if(StrEqual(name"server_spawn"false)) IsItOver false;


    if(!
IsItOver) return;


    
IsItOver false;

    for(
int i 1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i) || IsFakeClient(i)) continue;
        
        
KickClient(i"END OF MATCH");
    }

__________________
Do not Private Message @me

Last edited by Bacardi; 03-26-2021 at 17:05. Reason: disable event "announce_phase_end"
Bacardi is offline
zerg
Member
Join Date: May 2017
Old 03-26-2021 , 14:21   Re: [CSGO] End of match message
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
Damed. I did not notice it will fire event every round.

Good that you made one.

I posted my second version.
PHP Code:

#include <sdktools>

public void OnPluginStart()
{
    
HookEventEx("cs_win_panel_match",        eventsEventHookMode_PostNoCopy);
    
HookEventEx("cs_intermission",            eventsEventHookMode_PostNoCopy);
    
HookEventEx("announce_phase_end",        eventsEventHookMode_PostNoCopy);
    
HookEventEx("round_officially_ended",    eventsEventHookMode_PostNoCopy);
    
HookEventEx("server_spawn",                eventsEventHookMode_PostNoCopy);
}

public 
Action events(Event event, const char[] namebool dontBroadcast)
{
    static 
bool IsItOver;

    if( 
StrEqual(name"cs_win_panel_match"false) ||
        
StrEqual(name"cs_intermission"false) ||
        
StrEqual(name"announce_phase_end"false)) {

        
// Print once.
        
if(!IsItOverPrintToChatAll(" \x04End of match. You will be automatically kicked out from server");

        
IsItOver true;
        return;
    }

    
// Reset value whenever map start
    
if(StrEqual(name"server_spawn"false)) IsItOver false;


    if(!
IsItOver) return;


    
IsItOver false;

    for(
int i 1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i) || IsFakeClient(i)) continue;
        
        
KickClient(i"END OF MATCH");
    }

Thanks for your attention Bacardi,
I just tested your code, but it is ending the game on the half time =/
zerg is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-26-2021 , 16:53   Re: [CSGO] End of match message
Reply With Quote #6

ok. damed.

*fixed. Disabled hookevent "announce_phase_end"

Last edited by Bacardi; 03-26-2021 at 17:06.
Bacardi is offline
The Solid lad
Senior Member
Join Date: Oct 2018
Old 03-27-2021 , 18:53   Re: [CSGO] End of match message
Reply With Quote #7

Bacardi is so nice and helpful to everyone here... deserves a medal.
__________________
The Solid lad is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-27-2021 , 19:01   Re: [CSGO] End of match message
Reply With Quote #8

I'm just trolling and mostly practising, learning
Bacardi is offline
zerg
Member
Join Date: May 2017
Old 03-29-2021 , 03:16   Re: [CSGO] End of match message
Reply With Quote #9

Quote:
Originally Posted by Bacardi View Post
ok. damed.

*fixed. Disabled hookevent "announce_phase_end"
Cool, it worked more time to finish is quite, I didn't check correctly, but I believe that about 40 seconds


[edit1]
In fact, the time used is to change maps, does anyone know the command?

[edit2]
the command is mp_match_restart_delay

Last edited by zerg; 03-30-2021 at 02:43.
zerg is offline
The Solid lad
Senior Member
Join Date: Oct 2018
Old 03-29-2021 , 09:50   Re: [CSGO] End of match message
Reply With Quote #10

Quote:
Originally Posted by Bacardi View Post
I'm just trolling and mostly practising, learning
aaaaaand you just helped me on my own post.
Don't be so humble
__________________
The Solid lad 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 08:52.


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