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

New custom HUD Messages (CS:GO)


Post New Thread Reply   
 
Thread Tools Display Modes
_GamerX
AlliedModders Donor
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"); 
__________________
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
ESK0
BANNED
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);

ESK0 is offline
hmmmmm
Great Tester of Whatever
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
AlliedModders Donor
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
__________________
_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:
            SM_HUDMSG_TextParamsEx(
            
0,  // CLIENT 0 = ALL
            
5,  // Channel
            
Float:{0.150.02}, //pos
            
{2552550255}, //Color1
            
{2552550255},   //Color2
            
2.0,  //float Holdtime
            
0,   //EFFECT
            
1.0//fxTime
            
0.0//fadeIn
            
0.0//fadeOut
            
"TEXT MSG");


void SM_HUDMSG_TextParamsEx(int iClient 0int iChannel 5float fPosition[2] = {-1.0,-1.0}, int iColor1[4] = {255128255255}, int iColor2[4] = {2550241255}, float fholdtime 1.0,int iEffect 1float fxTime 0.2float fadeIn 0.2float fFadeOutTime 5.0, const char[] szText)
{
    
SetHudTextParamsEx(
    
fPosition[0], //float x
    
fPosition[1], //float y,
    
fholdtime,  //float holdTime
    
iColor1//int color1[4]
    
iColor2//int color2[4]
    
iEffect//int effect
    
fxTime//float fxTime
    
fadeIn//float fadeIn
    
fFadeOutTime);//float fadeOut

    
    
if(iClient != 0)
    {    
        
ShowHudText(iClientiChannelszText);
    }
    else
    {
        for (
int i 1<= MaxClientsi++)
        {
            if(
IsClientInGame(i))
            {
                
ShowHudText(iiChannelszText);
            }
        }
    }


Last edited by e54385991; 08-22-2017 at 05:31.
e54385991 is offline
Send a message via ICQ to e54385991
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 04:13.


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