View Single Post
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 04-08-2017 , 14:08   Re: New custom HUD Messages (CS:GO)
Reply With Quote #20

Hi, I was trying to make command to print that hud message but i cant make it work, this is the code:
PHP Code:
public void OnPluginStart()
{
    
RegAdminCmd("sm_hudtext"HudADMFLAG_CONFIG);
}

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);
//        ReplyToCommand(client, "COMMAND ACTIVETED");
    
}
    return 
Plugin_Handled;
}

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)
{
    
int ent 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(ent"channel"channel);
    
DispatchKeyValue(ent"color"color);
    
DispatchKeyValue(ent"color2""0 0 0");
    
DispatchKeyValue(ent"effect""0");
    
DispatchKeyValue(ent"fadein"fadein);
    
DispatchKeyValue(ent"fadeout"fadeout);
    
DispatchKeyValue(ent"fxtime""0.25");
    
DispatchKeyValue(ent"holdtime"sholdtime);
    
DispatchKeyValue(ent"message"message);
    
DispatchKeyValue(ent"spawnflags""0");
    
DispatchKeyValue(ent"x"sx);
    
DispatchKeyValue(ent"y"sy);
    
DispatchSpawn(ent);
    
SetVariantString("!activator");
    return 
AcceptEntityInput(ent"display"client);

Thanks in advance.
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 04-08-2017 at 14:08.
Papero is offline