Raised This Month: $ Target: $400
 0% 

[CS:GO] Headshot Overlay help :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
m22b
Senior Member
Join Date: Jul 2013
Old 02-19-2015 , 08:19   [CS:GO] Headshot Overlay help :)
Reply With Quote #1

PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

#define PLUGIN_VERSION     "1"

new Handle:sm_headshot              INVALID_HANDLE;
new 
Handle:sm_headshot_overlay_version         INVALID_HANDLE;

public 
Plugin:myinfo =
{
    
name "CSVK.RU Over",
    
author "csvk.ru",
    
description "csvk.ru",
    
version PLUGIN_VERSION,
    
url "csvk.ru"
};

public 
OnPluginStart()
{
    
// Hook events
    
HookEvent("player_death"player_death);

    
// Create convars
    
sm_headshot CreateConVar("sm_headshot""csvk_kill/headshot""Patch to overlay");
    
sm_headshot_overlay_version CreateConVar("sm_headshot_overlay_version"PLUGIN_VERSION"Headshot overlay version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

    
HookConVarChange(sm_headshot_overlay_versionVersionChange);
}

public 
VersionChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
SetConVarString(convarPLUGIN_VERSION);
}

public 
OnMapStart()
{
    
decl String:file[256];
    
BuildPath(Path_SMfile255"configs/headshot_downloads.ini");
    new 
Handle:fileh OpenFile(file"r");
    if (
fileh != INVALID_HANDLE)
    {
        
decl String:buffer[256];
        
decl String:buffer_full[PLATFORM_MAX_PATH];

        while(
ReadFileLine(filehbuffersizeof(buffer)))
        {
            
TrimString(buffer);
            if ( (
StrContains(buffer"//") == -1) && (!StrEqual(buffer"")) )
            {
                
PrintToServer("Reading overlay_downloads line :: %s"buffer);
                
Format(buffer_fullsizeof(buffer_full), "materials/%s"buffer);
                if (
FileExists(buffer_full))
                {
                    
PrintToServer("Precaching %s"buffer);
                    
PrecacheDecal(buffertrue);
                    
AddFileToDownloadsTable(buffer_full);
                    
PrintToServer("Adding %s to downloads table"buffer_full);
                }
                else
                {
                    
PrintToServer("File does not exist! %s"buffer_full);
                }
            }
        }

    }

}

public 
player_death(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
headshot GetEventInt(event"headshot");
    new 
attacker GetEventInt(event"attacker");
    
    
decl String:overlaypath[PLATFORM_MAX_PATH];

    if (
headshot == 1)
    {
        
GetConVarString(sm_headshotoverlaypathsizeof(overlaypath));
        
ClientCommand(attacker"r_screenoverlay \"%s\""overlaypath);
    }

Where is my fault ?
m22b is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-19-2015 , 18:18   Re: [CS:GO] Headshot Overlay help :)
Reply With Quote #2

What is the problem is the real question.
__________________
Neuro Toxin is offline
m22b
Senior Member
Join Date: Jul 2013
Old 02-19-2015 , 20:57   Re: [CS:GO] Headshot Overlay help :)
Reply With Quote #3

i have new problem, :

PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

#define PLUGIN_VERSION     "1"

new Handle:sm_headshot              INVALID_HANDLE;
new 
Handle:sm_knife1            INVALID_HANDLE;
new 
Handle:sm_hegrenade1            INVALID_HANDLE;
new 
Handle:sm_headshot_overlay_version         INVALID_HANDLE;

public 
Plugin:myinfo =
{
    
name "CSVK.RU Over",
    
author "csvk.ru",
    
description "csvk.ru",
    
version PLUGIN_VERSION,
    
url "csvk.ru"
};

public 
OnPluginStart()
{
    
// Hook events
    
HookEvent("player_death"player_death);

    
// Create convars
    
sm_headshot CreateConVar("sm_headshot""csvk_kill/headshot""Patch to overlay1");
    
sm_knife1 CreateConVar("sm_knife1""csvk_kill/knife""Patch to overlay2");
    
sm_hegrenade1 CreateConVar("sm_hegrenade1""csvk_kill/hegrenade""Patch to overlay2");
    
sm_headshot_overlay_version CreateConVar("sm_headshot_overlay_version"PLUGIN_VERSION"Headshot overlay version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

    
HookConVarChange(sm_headshot_overlay_versionVersionChange);
}

public 
VersionChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
SetConVarString(convarPLUGIN_VERSION);
}

public 
OnMapStart()
{
    
decl String:file[512];
    
BuildPath(Path_SMfile255"configs/headshot_downloads.ini");
    new 
Handle:fileh OpenFile(file"r");
    if (
fileh != INVALID_HANDLE)
    {
        
decl String:buffer[512];
        
decl String:buffer_full[PLATFORM_MAX_PATH];

        while(
ReadFileLine(filehbuffersizeof(buffer)))
        {
            
TrimString(buffer);
            if ( (
StrContains(buffer"//") == -1) && (!StrEqual(buffer"")) )
            {
                
PrintToServer("Reading overlay_downloads line :: %s"buffer);
                
Format(buffer_fullsizeof(buffer_full), "materials/%s"buffer);
                if (
FileExists(buffer_full))
                {
                    
PrintToServer("Precaching %s"buffer);
                    
PrecacheDecal(buffertrue);
                    
AddFileToDownloadsTable(buffer_full);
                    
PrintToServer("Adding %s to downloads table"buffer_full);
                }
                else
                {
                    
PrintToServer("File does not exist! %s"buffer_full);
                }
            }
        }

    }

}

public 
player_death(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
headshot GetEventInt(event"headshot");
    new 
client GetClientOfUserId(GetEventInt(event"attacker"));
    
decl String:overlaypath[PLATFORM_MAX_PATH];
    if (
headshot == 1)
    {
        
GetConVarString(sm_headshotoverlaypathsizeof(overlaypath));
        
ClientCommand(client"r_screenoverlay \"%s\""overlaypath);
        
CreateTimer(1.5LoadStuffGetClientSerial(client));
    }
/*
    decl String:weapon[32];
    GetClientWeapon(client, weapon, sizeof(weapon));

     if ( StrEqual( weapon, "weapon_knife" ) )
     {
       GetConVarString(sm_knife1, overlaypath, sizeof(overlaypath));
       ClientCommand(client, "r_screenoverlay \"%s\"", overlaypath);
       CreateTimer(1.5, LoadStuff, GetClientSerial(client));
     }
}
*/

    
decl String:weapon[64];
    
GetEventString(event"weapon"weaponsizeof(weapon));

    if(
strcmp(weapon"hegrenade") == 0)
    {
        
GetConVarString(sm_hegrenade1overlaypathsizeof(overlaypath));
        
ClientCommand(client"r_screenoverlay \"%s\""overlaypath);
        
CreateTimer(1.5LoadStuffGetClientSerial(client));
    }
    else if (
strcmp(weapon"knife") == 0)
    {
        
GetConVarString(sm_knife1overlaypathsizeof(overlaypath));
        
ClientCommand(client"r_screenoverlay \"%s\""overlaypath);
        
CreateTimer(1.5LoadStuffGetClientSerial(client));
    }
}
public 
Action:LoadStuff(Handle:timerany:serial)

    new 
client GetClientFromSerial(serial); // Validate the client serial
    
ClientCommand(client"r_screenoverlay \"\"");

When i do "headshot" - i see overlay
When i kill by hegrenade - i see overlay
When i kill by knife - i dont see overlay


Last edited by m22b; 02-19-2015 at 20:59.
m22b is offline
versatile_bfg
Veteran Member
Join Date: Feb 2012
Old 02-19-2015 , 21:45   Re: [CS:GO] Headshot Overlay help :)
Reply With Quote #4

not all knives have 'knife' in the weapon name.
__________________
versatile_bfg is offline
m22b
Senior Member
Join Date: Jul 2013
Old 02-19-2015 , 22:40   Re: [CS:GO] Headshot Overlay help :)
Reply With Quote #5

i found solution

PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

#define PLUGIN_VERSION     "1"

new Handle:sm_headshot              INVALID_HANDLE;
new 
Handle:sm_knife1            INVALID_HANDLE;
new 
Handle:sm_hegrenade1            INVALID_HANDLE;
new 
Handle:sm_headshot_overlay_version         INVALID_HANDLE;

public 
Plugin:myinfo =
{
    
name "CSVK.RU Over",
    
author "csvk.ru",
    
description "csvk.ru",
    
version PLUGIN_VERSION,
    
url "csvk.ru"
};

public 
OnPluginStart()
{
    
// Hook events
    
HookEvent("player_death"player_death);

    
// Create convars
    
sm_headshot CreateConVar("sm_headshot""csvk_kill/headshot""Patch to overlay1");
    
sm_knife1 CreateConVar("sm_knife1""csvk_kill/knife""Patch to overlay2");
    
sm_hegrenade1 CreateConVar("sm_hegrenade1""csvk_kill/hegrenade""Patch to overlay2");
    
sm_headshot_overlay_version CreateConVar("sm_headshot_overlay_version"PLUGIN_VERSION"Headshot overlay version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

    
HookConVarChange(sm_headshot_overlay_versionVersionChange);
}

public 
VersionChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
    
SetConVarString(convarPLUGIN_VERSION);
}

public 
OnMapStart()
{
    
decl String:file[512];
    
BuildPath(Path_SMfile255"configs/headshot_downloads.ini");
    new 
Handle:fileh OpenFile(file"r");
    if (
fileh != INVALID_HANDLE)
    {
        
decl String:buffer[512];
        
decl String:buffer_full[PLATFORM_MAX_PATH];

        while(
ReadFileLine(filehbuffersizeof(buffer)))
        {
            
TrimString(buffer);
            if ( (
StrContains(buffer"//") == -1) && (!StrEqual(buffer"")) )
            {
                
PrintToServer("Reading overlay_downloads line :: %s"buffer);
                
Format(buffer_fullsizeof(buffer_full), "materials/%s"buffer);
                if (
FileExists(buffer_full))
                {
                    
PrintToServer("Precaching %s"buffer);
                    
PrecacheDecal(buffertrue);
                    
AddFileToDownloadsTable(buffer_full);
                    
PrintToServer("Adding %s to downloads table"buffer_full);
                }
                else
                {
                    
PrintToServer("File does not exist! %s"buffer_full);
                }
            }
        }

    }

}

public 
player_death(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
headshot GetEventInt(event"headshot");
    new 
client GetClientOfUserId(GetEventInt(event"attacker"));
    
decl String:overlaypath[PLATFORM_MAX_PATH];
    if (
headshot == 1)
    {
        
GetConVarString(sm_headshotoverlaypathsizeof(overlaypath));
        
ClientCommand(client"r_screenoverlay \"%s\""overlaypath);
        
CreateTimer(1.5LoadStuffGetClientSerial(client));
    }
    
    
decl String:weapon[64];
    
GetEventString(event"weapon"weaponsizeof(weapon));

    if(
strcmp(weapon"hegrenade") == 0)
    {
        
GetConVarString(sm_hegrenade1overlaypathsizeof(overlaypath));
        
ClientCommand(client"r_screenoverlay \"%s\""overlaypath);
        
CreateTimer(1.5LoadStuffGetClientSerial(client));
    }
    
    
decl String:wpn[32];
    
GetClientWeapon(clientwpn32);
    if ( 
StrEqualwpn"weapon_knife" ) )
    {
        
GetConVarString(sm_knife1overlaypathsizeof(overlaypath));
        
ClientCommand(client"r_screenoverlay \"%s\""overlaypath);
        
CreateTimer(1.5LoadStuffGetClientSerial(client));
    }
}

public 
Action:LoadStuff(Handle:timerany:serial)

    new 
client GetClientFromSerial(serial); // Validate the client serial
    
ClientCommand(client"r_screenoverlay \"\"");

m22b is offline
Scrumilation
Member
Join Date: Oct 2014
Old 02-20-2015 , 13:02   Re: [CS:GO] Headshot Overlay help :)
Reply With Quote #6

i tought you couldn't use r_screenoverlay on cs:go?
Scrumilation is offline
m22b
Senior Member
Join Date: Jul 2013
Old 03-01-2015 , 18:07   Re: [CS:GO] Headshot Overlay help :)
Reply With Quote #7

Quote:
Originally Posted by Scrumilation View Post
i tought you couldn't use r_screenoverlay on cs:go?
why?
work fine
m22b is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 03-01-2015 , 19:30   Re: [CS:GO] Headshot Overlay help :)
Reply With Quote #8

Valve did an update a few months back that enabled overlays
__________________
Neuro Toxin 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 18:45.


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