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

Solved [CS:GO] Banner when team wins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 02-21-2021 , 13:03   [CS:GO] Banner when team wins
Reply With Quote #1

Hey,

I tried to find / code a plugin that would replace the CT Win or T Win banner that shows on the screen to something like this (I've seen this already in some servers): https://i.imgur.com/ToKtKFo.png

I tried a lot of plugins. Even tried and changed the one provided by kento but didn't work.

The current source code is:
PHP Code:
#include <sourcemod> 
#include <sdktools> 

#pragma newdecls required 

ConVar Cvar_TimeCT_OverlayT_Overlay;

char ct_overlay[PLATFORM_MAX_PATH], t_overlay[PLATFORM_MAX_PATH];
float overlay_time;

public 
Plugin myinfo =   

    
name "[SpirT] Round Draw Overlay",  
    
author "SpirT",  
    
description "Display overlay when round draw.",  
    
version "1.0",  
    
url "http://steamcommunity.com/id/spirtbbx/" 
}; 

public 
void OnPluginStart() 

    
HookEvent("round_end"Event_RoundEnd); 
    
    
Cvar_Time CreateConVar("sm_overlay_time""7.0""How long should overlay display?");
    
CT_Overlay CreateConVar("sm_overlay_t""path/to/file""Overlay when Terrorists win! Path to file without materials/ and without .vtf or .vmt extension");
    
T_Overlay CreateConVar("sm_overlay_ct""path/to/file""Overlay when Counter-Terrorists win! Path to file without materials/ and without .vtf or .vmt extension");
    
    
AutoExecConfig(true"spirt_round_end_overlay");


public 
void OnConfigsExecuted()
{
    
CT_Overlay.GetString(ct_overlaysizeof(ct_overlay));
    
T_Overlay.GetString(t_overlaysizeof(t_overlay));
    
overlay_time Cvar_Time.FloatValue;
}

public 
void OnMapStart() 

    if(!
StrEqual(ct_overlay"") && StrEqual(t_overlay""))
    {
        
char dlpath1[1024], dlpath2[1024], dlpath3[1024], dlpath4[1024];
        
Format(dlpath1sizeof(dlpath1), "materials/%s.vtf"ct_overlay);
        
Format(dlpath2sizeof(dlpath2), "materials/%s.vmt"ct_overlay);
        
Format(dlpath3sizeof(dlpath1), "materials/%s.vtf"t_overlay);
        
Format(dlpath4sizeof(dlpath2), "materials/%s.vmt"t_overlay);
        
AddFileToDownloadsTable(dlpath1);
        
AddFileToDownloadsTable(dlpath2);
        
AddFileToDownloadsTable(dlpath3);
        
AddFileToDownloadsTable(dlpath4);
        
PrecacheDecal(dlpath1true); 
        
PrecacheDecal(dlpath2true);
        
PrecacheDecal(dlpath3true);
        
PrecacheDecal(dlpath4true);
    }


public 
Action Event_RoundEnd(Handle event, const char[] namebool dontBroadcast

    
char message[256];
    
int winnerTeam GetEventInt(event"winner");
    
GetEventString(event"message"messagesizeof(message));
    if(
StrEqual(message"#SFUI_Notice_Round_Draw"false))
    {
        for (
int i 1<= MaxClientsi++) 
        {
            if (
IsValidClient(i) && !IsFakeClient(i)) 
            {
                if(
winnerTeam == 2)
                {
                    
SetClientOverlay(it_overlay);
                    
PrintToChatAll("os T ganharam crl");
                    
CreateTimer(overlay_timeDeleteOverlayi);
                }
                else if(
winnerTeam == 3)
                {
                    
SetClientOverlay(ict_overlay);
                    
PrintToChatAll("os CTs deram uma tareia nos Ts");
                    
CreateTimer(overlay_timeDeleteOverlayi);
                }                
            }
        }
    }


stock bool IsValidClient(int client

    if (
client <= 0) return false
    if (
client MaxClients) return false
    if (!
IsClientConnected(client)) return false
    return 
IsClientInGame(client); 


// Code taken from csgoware  
// https://forums.alliedmods.net/showthread.php?p=2500764 
bool SetClientOverlay(int clientchar[] strOverlay

    if (
IsValidClient(client) && !IsFakeClient(client)) 
    { 
        
int iFlags GetCommandFlags("r_screenoverlay") & (~FCVAR_CHEAT); 
        
SetCommandFlags("r_screenoverlay"iFlags);  
        
ClientCommand(client"r_screenoverlay \"%s.vtf\""strOverlay); 
        return 
true
    } 
    return 
false


public 
Action DeleteOverlay(Handle tmrany client

    if (
IsValidClient(client) && !IsFakeClient(client)) 
    { 
        
SetClientOverlay(client""); 
    } 
    return 
Plugin_Handled

How may I fix this
__________________

Last edited by SpirT; 02-27-2021 at 08:20.
SpirT is offline
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 02-26-2021 , 17:20   Re: [CS:GO] Banner when team wins
Reply With Quote #2

Use this:
https://forums.alliedmods.net/showthread.php?t=298248
jugule is offline
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 02-27-2021 , 08:20   Re: [CS:GO] Banner when team wins
Reply With Quote #3

Quote:
Originally Posted by jugule View Post
Thanks, that worked. I also tried another plugin that works now.
__________________
SpirT 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 04:01.


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