Raised This Month: $146 Target: $400
 36% 

New custom HUD Messages (CS:GO)


Post New Thread Reply   
 
Thread Tools Display Modes
_GamerX
Senior Member
Join Date: Jun 2011
Location: Fun Server
Old 04-24-2017 , 13:43   Re: New custom HUD Messages (CS:GO)
Reply With Quote #21

Add this for destroying created hud messages (prevent crash server)
PHP Code:
    DispatchKeyValue(ent"OnUser1""!self,Kill,,2.0,-1");
    
AcceptEntityInput(ent"FireUser1"); 
__________________
My profile: http://steamcommunity.com/id/gamerxcz/
If you would like to create your own plugin do not hesitate to contact me ;)
SourceMod CZ/SK Podpora https://discord.gg/FsT2g3G
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
ESK0
Veteran Member
Join Date: May 2014
Location: Czech Republic
Old 05-27-2017 , 15:24   Re: New custom HUD Messages (CS:GO)
Reply With Quote #22

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

int g_iEnt = -1;

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_hudtext"HudADMFLAG_CONFIG);
}
public 
void OnMapStart()
{
  
g_iEnt = -1;
}
public 
Action Hud(int clientint args)
{
    if (
args 2)
    {
        
ReplyToCommand(client"[SM]Usage: !hud <player> <message> [OPTIONALS -->] <size 1 - 3> <red (RGB)> <green (RGB)> <blue (RGB)> <x pos> <y pos> <hold time> <fadein time> <fateout time>");
        return 
Plugin_Handled;
    }
    
char arg[64];
    
GetCmdArg(1argsizeof(arg));

    
char target_name[MAX_TARGET_LENGTH];
    
int target_list[MAXPLAYERS], target_count;
    
bool tn_is_ml;

    
target_count ProcessTargetString(argclienttarget_listMAXPLAYERSCOMMAND_FILTER_CONNECTEDtarget_namesizeof(target_name), tn_is_ml);
    if (
target_count <= 0)
    {
        
ReplyToCommand(client"Target invalid");
        return 
Plugin_Handled;
    }
    
char arg2[32];
    
GetCmdArg(2arg2sizeof(arg2));
    
int arg3 GetCmdArgInt(3);
    
int arg4 GetCmdArgInt(4);
    
int arg5 GetCmdArgInt(5);
    
int arg6 GetCmdArgInt(6);
    
float arg7 GetCmdArgFloat(7);
    
float arg8 GetCmdArgFloat(8);
    
float arg9 GetCmdArgFloat(9);
    
float arg10 GetCmdArgFloat(10);
    
float arg11 GetCmdArgFloat(11);
    for (
int i 0target_counti++)
    {
        
PrintToHud(target_list[i], arg2arg3arg4arg5arg6arg7arg8arg9arg10arg11);
    }
    return 
Plugin_Handled;
}
int GetCmdArgInt(int arg)
{
  
char sBuffer[32];
  
GetCmdArg(argsBuffersizeof(sBuffer));
  return 
StringToInt(sBuffer);
}
float GetCmdArgFloat(int arg)
{
  
char sBuffer[32];
  
GetCmdArg(argsBuffersizeof(sBuffer));
  return 
StringToFloat(sBuffer);
}
int PrintToHud(int client, const char[] messageint size 2int red 255int green 255int blue 255float x = -1.0float y = -1.0float holdtime 5.0float fadeintime 1.0float fadeouttime 1.0)
{
    if(
g_iEnt == -1)
    {
      
g_iEnt CreateEntityByName("game_text");
    }
    
char color[32];
    
Format(colorsizeof(color), "%i %i %i"redgreenblue);

    if (
size == 1)
        
size 2;
    else if (
size == 2)
        
size 1;

    
char channel[32];
    
char fadein[32];
    
char fadeout[32];
    
char sholdtime[32];
    
char sy[32];
    
char sx[32];
    
IntToString(sizechannelsizeof(channel));
    
FloatToString(fadeintimefadeinsizeof(fadein));
    
FloatToString(fadeouttimefadeoutsizeof(fadeout));
    
FloatToString(holdtimesholdtimesizeof(sholdtime));
    
FloatToString(ysysizeof(sy));
    
FloatToString(xsxsizeof(sx));
    
DispatchKeyValue(g_iEnt"channel"channel);
    
DispatchKeyValue(g_iEnt"color"color);
    
DispatchKeyValue(g_iEnt"color2""0 0 0");
    
DispatchKeyValue(g_iEnt"effect""0");
    
DispatchKeyValue(g_iEnt"fadein"fadein);
    
DispatchKeyValue(g_iEnt"fadeout"fadeout);
    
DispatchKeyValue(g_iEnt"fxtime""0.25");
    
DispatchKeyValue(g_iEnt"holdtime"sholdtime);
    
DispatchKeyValue(g_iEnt"message"message);
    
DispatchKeyValue(g_iEnt"spawnflags""0");
    
DispatchKeyValue(g_iEnt"x"sx);
    
DispatchKeyValue(g_iEnt"y"sy);
    
DispatchKeyValue(g_iEnt"OnUser1""!self,Kill,,2.0,-1");
    
AcceptEntityInput(g_iEnt"FireUser1");
    
DispatchSpawn(g_iEnt);
    
SetVariantString("!activator");
    return 
AcceptEntityInput(g_iEnt"display"client);

__________________
Feel free to add me for private plugins My steam profile.
ESK0 is offline
hmmmmm
Member
Join Date: Mar 2017
Location: ...
Old 05-27-2017 , 19:13   Re: New custom HUD Messages (CS:GO)
Reply With Quote #23

Does changing size work in csgo? From what I've tried it was the same size in every channel
hmmmmm is offline
_GamerX
Senior Member
Join Date: Jun 2011
Location: Fun Server
Old 06-22-2017 , 13:58   Re: New custom HUD Messages (CS:GO)
Reply With Quote #24

Quote:
Originally Posted by hmmmmm View Post
Does changing size work in csgo? From what I've tried it was the same size in every channel
Not possible
__________________
My profile: http://steamcommunity.com/id/gamerxcz/
If you would like to create your own plugin do not hesitate to contact me ;)
SourceMod CZ/SK Podpora https://discord.gg/FsT2g3G
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
e54385991
AlliedModders Donor
Join Date: Aug 2013
Old 07-07-2017 , 02:50   Re: New custom HUD Messages (CS:GO)
Reply With Quote #25

PHP Code:
SMHudMsg(01Float:{0.150.02}, {255128255255}, {2550241255}, 20.10.118.00.0"your text");


void SM_HUDMSG_TextParamsEx(int iClient 0int iChannel 5float fPosition[2] = {-1.0,-1.0}, int iColor1[4] = {255128255255}, int iColor2[4] = {2550241255}, int iEffect 1float fFadeInTime 0.2float fFadeOutTime 0.2float fHoldTime 5.0float fEffectTime 0.2, const char[] szText)
{
    
SetHudTextParamsEx(fPosition[0], fPosition[1], fHoldTimeiColor1iColor2iEffect ,fFadeOutTimefHoldTimefEffectTime)
    
    if(
iClient != 0)
    {    
        
ShowHudText(iClientiChannelszText);
    }
    else
    {
        for (
int i 1<= MaxClientsi++)
        {
            if(
IsClientInGame(i))
            {
                
ShowHudText(iiChannelszText);
            }
        }
    }


Last edited by e54385991; 07-07-2017 at 02:57.
e54385991 is offline
Send a message via ICQ to e54385991
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:36.


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