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

Hud text is now supported in csgo!


Post New Thread Reply   
 
Thread Tools Display Modes
SHUFEN
Senior Member
Join Date: Jun 2014
Location: Japan, Tokyo
Old 03-21-2017 , 04:46   Re: Hud text is now supported in csgo!
Reply With Quote #41

Quote:
Originally Posted by AntiTeal View Post
Shufen, they work, but you need to add csgo to the supported games list.
err, nice.
And thanks to latest SM update.
SHUFEN is offline
Send a message via Skype™ to SHUFEN
Weetabix
Member
Join Date: Feb 2017
Location: United Kingdom
Old 03-21-2017 , 11:41   Re: Hud text is now supported in csgo!
Reply With Quote #42

Hopefully https://github.com/ValveSoftware/csg...ux/issues/1351 is fixed soon.
Weetabix is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 03-23-2017 , 04:54   Re: Hud text is now supported in csgo!
Reply With Quote #43

shame html doesnt work, the default size is way too big imo.
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS
OSWO is offline
emialcaraz
Member
Join Date: Oct 2016
Location: Argentina
Old 03-29-2017 , 18:47   Re: Hud text is now supported in csgo!
Reply With Quote #44

this is fucking awesome.
emialcaraz is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 03-29-2017 , 18:53   Re: Hud text is now supported in csgo!
Reply With Quote #45

I though the different channels have different sizes?
__________________
Neuro Toxin is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 03-30-2017 , 23:44   Re: Hud text is now supported in csgo!
Reply With Quote #46

Quote:
Originally Posted by Neuro Toxin View Post
I though the different channels have different sizes?
No, they are guides for what users should use them for.
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS
OSWO is offline
Dreizehnt
Junior Member
Join Date: Jan 2016
Location: Russian Federation
Old 04-17-2017 , 15:41   Re: Hud text is now supported in csgo!
Reply With Quote #47

Quote:
Originally Posted by hlstriker View Post
Sure, it's a pretty old plugin I haven't used in many many years so why not. If you end up making a release you will want to use SourceMod's HudMsg functions and make the message buffer dynamic. Updating to the new syntax and giving admins the option to hide themselves from the list would be cool too. To optimize more just remove the prethink hook and lower the SPEC_MESSAGE_DELAY time. If you lower SPEC_MESSAGE_DELAY keep in mind it'll send messages over the network more often.

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

#pragma semicolon 1

new const String:PLUGIN_VERSION[] = "1.0";

public 
Plugin:myinfo 
{
    
name "Show Spectators",
    
author "hlstriker",
    
description "Shows who is spectating a specific player.",
    
version PLUGIN_VERSION,
    
url "www.swoobles.com"
}

const 
OBS_MODE_IN_EYE    4;
const 
OBS_MODE_CHASE    5;

const 
Float:SPEC_MESSAGE_DELAY 1.2;
new 
Float:g_fNextSpecMessage[MAXPLAYERS+1];
new 
g_iSpectating[MAXPLAYERS+1];

new 
UserMsg:g_msgHudMsg;


public 
OnPluginStart()
{
    
CreateConVar("hls_showspec_version"PLUGIN_VERSION"Show Spectators Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_PRINTABLEONLY);
    
    
g_msgHudMsg GetUserMessageId("HudMsg");
    
    for(new 
iClient=1iClient<=MaxClientsiClient++)
    {
        if(
IsClientInGame(iClient))
            
SDKHook(iClientSDKHook_PreThinkhook_PreThink);
    }
    
    
CreateTimer(SPEC_MESSAGE_DELAYTimerSpecMessage_TIMER_REPEAT);
}

public 
Action:TimerSpecMessage(Handle:hTimer)
{
    new 
Float:fCurTime GetEngineTime();
    for(new 
iClient=1iClient<=MaxClientsiClient++)
    {
        if(!
IsClientInGame(iClient) || IsPlayerAlive(iClient))
            continue;
        
        if(
g_fNextSpecMessage[iClient] > fCurTime)
            continue;
        
        
BuildSpecMessage(iClient);
    }
}

public 
OnClientPutInServer(iClient)
{
    
SDKHook(iClientSDKHook_PreThinkhook_PreThink);
}

public 
hook_PreThink(iClient)
{
    if(
IsPlayerAlive(iClient))
        return;
    
    if(!
UpdateSpectatingTarget(iClient))
        return;
    
    
BuildSpecMessage(iClient);
}

UpdateSpectatingTarget(iClient)
{
    
// Return true if the client is spectating a different player.
    
    
switch(GetEntProp(iClientProp_Send"m_iObserverMode"))
    {
        case 
OBS_MODE_IN_EYEOBS_MODE_CHASE:
        {
            new 
iSpectating GetEntPropEnt(iClientProp_Send"m_hObserverTarget");
            if(
iSpectating != g_iSpectating[iClient])
            {
                
g_iSpectating[iClient] = iSpectating;
                return 
true;
            }
        }
        default:
        {
            if(
g_iSpectating[iClient])
            {
                
// This client was spectating someone, but isn't anymore so clear their message.
                
g_iSpectating[iClient] = 0;
                
ShowSpecMessage(iClient" ");
            }
        }
    }
    
    return 
false;
}

BuildSpecMessage(iClient)
{
    
g_fNextSpecMessage[iClient] = GetEngineTime() + SPEC_MESSAGE_DELAY 0.2;
    
    if(
g_iSpectating[iClient] <= || !IsClientInGame(g_iSpectating[iClient]))
        return;
    
    static 
String:szBuffer[254], iBufLenString:szName[32];
    
iBufLen 0;
    
GetClientName(g_iSpectating[iClient], szNamesizeof(szName));
    
    
iBufLen += FormatEx(szBuffer[iBufLen], sizeof(szBuffer)-iBufLen"\nSpectating %s:\n"szName);
    
    for(new 
iSpectator=1iSpectator<=MaxClientsiSpectator++)
    {
        if(!
IsClientInGame(iSpectator) || IsPlayerAlive(iSpectator))
            continue;
        
        if(
g_iSpectating[iSpectator] != g_iSpectating[iClient])
            continue;
        
        
GetClientName(iSpectatorszNamesizeof(szName));
        
iBufLen += FormatEx(szBuffer[iBufLen], sizeof(szBuffer)-iBufLen"%s\n"szName);
    }
    
    
ShowSpecMessage(iClientszBuffer);
}

ShowSpecMessage(iClient, const String:szMessage[])
{
    
HudMsg(iClient1Float:{0.8, -1.0}, {25500255}, {02550255}, 00.10.1SPEC_MESSAGE_DELAY 0.10.0szMessage);
}

HudMsg(iClientiChannel, const Float:fPosition[2], const iColor1[4], const iColor2[4], iEffectFloat:fFadeInTimeFloat:fFadeOutTimeFloat:fHoldTimeFloat:fEffectTime, const String:szText[], any:...)
{
    if(
GetUserMessageType() != UM_Protobuf)
        return 
false;
    
    
decl String:szBuffer[256];
    
VFormat(szBuffersizeof(szBuffer), szText12);
    
    
decl iClients[1];
    
iClients[0] = iClient;
    
    new 
Handle:hMessage StartMessageEx(g_msgHudMsgiClients1);
    
PbSetInt(hMessage"channel"iChannel);
    
PbSetVector2D(hMessage"pos"fPosition);
    
PbSetColor(hMessage"clr1"iColor1);
    
PbSetColor(hMessage"clr2"iColor2);
    
PbSetInt(hMessage"effect"iEffect);
    
PbSetFloat(hMessage"fade_in_time"fFadeInTime);
    
PbSetFloat(hMessage"fade_out_time"fFadeOutTime);
    
PbSetFloat(hMessage"hold_time"fHoldTime);
    
PbSetFloat(hMessage"fx_time"fEffectTime);
    
PbSetString(hMessage"text"szBuffer);
    
EndMessage();
    
    return 
true;


The plugin works, but there was a small problem, the author prompt please how to adjust the position of the HUD?

__________________
Dreizehnt is offline
Byte
Senior Member
Join Date: Jun 2010
Location: 📦 CCSPlayer
Old 04-30-2017 , 10:54   Re: Hud text is now supported in csgo!
Reply With Quote #48

Didn't realise this was added, this is pretty cool.
I was trying to use something similar to this (ESEA style hud messages) a couple of months ago.
__________________
STEAM: /id/invexbyte | Github: Mo Beigi | Discord: Byte#0017
Community: Invex Gaming | My Plugins: Click Me!

Byte is offline
Santi.
Member
Join Date: Oct 2010
Location: Cordoba(Argentina)
Old 05-18-2017 , 22:05   Re: Hud text is now supported in csgo!
Reply With Quote #49

Any idea of how to make it always appear and updated constantly?? (Like Hud in cs 1.6)
Santi. is offline
Byte
Senior Member
Join Date: Jun 2010
Location: 📦 CCSPlayer
Old 05-19-2017 , 20:56   Re: Hud text is now supported in csgo!
Reply With Quote #50

Quote:
Originally Posted by Santi. View Post
Any idea of how to make it always appear and updated constantly?? (Like Hud in cs 1.6)
Have a repeated timer running every 1 second and have global variables that you change with your data. It will then appear to update in real time.
__________________
STEAM: /id/invexbyte | Github: Mo Beigi | Discord: Byte#0017
Community: Invex Gaming | My Plugins: Click Me!

Byte 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 22:01.


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