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

SetHudTextParams help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sejin513
AlliedModders Donor
Join Date: Dec 2008
Location: ._.
Old 04-27-2010 , 23:08   SetHudTextParams help
Reply With Quote #1

i dont know anything about Sourcemod.

i just try it but didnt work.

http://forums.alliedmods.net/showthread.php?t=80584
Code:
//Hud Custom Message 1.2 [With HUD]
#include <sourcemod>
#include <sdktools>
//new Handle:Title
new Handle:MessageTime
new Handle:MessageX
new Handle:MessageY
new Handle:MessageRed
new Handle:MessageGreen
new Handle:MessageBlue
new Handle:MessageAlpha
new Handle:MessageEffect
new Handle:MessageFadeIn
new Handle:MessageFadeOut

public Plugin:myinfo =
{
    name = "Custom Messages",
    author = "[GR]Nick_6893{A}",
    description = "Make a custom hud message using console.",
    version = "1.2",
    url = "www.sourcemod.net"
}

public OnPluginStart()
{
    RegAdminCmd("sm_mess", Command_Mess,  ADMFLAG_RCON, "Makes a message in the center of screen.");
//    Title = CreateConVar("sm_mess_title", "Console", "Sets up the Word/Words before the colon.");
    MessageTime = CreateConVar("sm_mess_time", "3.5", "Sets up the Time for the message to show.");
    MessageX = CreateConVar("sm_mess_x", "-1.0", "Sets up the X for the message to show.");
    MessageY = CreateConVar("sm_mess_y", "0.3", "Sets up the Y for the message to show.");
    MessageRed = CreateConVar("sm_mess_red", "255", "Sets up the Red for the message to show.");
    MessageGreen = CreateConVar("sm_mess_green", "255", "Sets up the Green for the message to show.");
    MessageBlue = CreateConVar("sm_mess_blue", "255", "Sets up the Blue for the message to show.");
    MessageAlpha = CreateConVar("sm_mess_alpha", "255", "Sets up the Alpha for the message to show.");
    MessageEffect = CreateConVar("sm_mess_effect", "0", "Sets up the Effect for the message to show.");
    MessageFadeIn = CreateConVar("sm_mess_fadein", "0.1", "Sets up the Fade in Time for the message to show.");
    MessageFadeOut = CreateConVar("sm_mess_fadeout", "0.2", "Sets up the Fade out Time for the message to show.");
}

public Action:Command_Mess(Client, Arguments)
{
    if(Arguments < 1)
    {
        PrintToConsole(Client, "[SM] Usage: sm_mess <message>");
        return Plugin_Handled;
    }

    decl AllPlayers;
    AllPlayers = GetMaxClients();
    for(new A = 1; A <= AllPlayers; A++)
    {
        if(IsClientConnected(A) && IsClientInGame(A))
        {
//            new String:Header[75];
            new String:Message[85];
            new messtime = GetConVarInt(MessageTime);
            new messx = GetConVarInt(MessageX);
            new messy = GetConVarInt(MessageY);
            new messred = GetConVarInt(MessageRed);
            new messgreen = GetConVarInt(MessageGreen);
            new messblue = GetConVarInt(MessageBlue);
            new messalpha = GetConVarInt(MessageAlpha);
            new messeffect = GetConVarInt(MessageEffect);
            new messfadein = GetConVarInt(MessageFadeIn);
            new messfadeout = GetConVarInt(MessageFadeOut);
//            GetConVarString(Title, Header, 75);
            GetCmdArgString(Message, 85);
//            SetHudTextParams(-1.0, 0.3, float(messtime), 255, 255, 255, 255, 0, float(messtime), 0.3, 0.3);
            SetHudTextParams(float(messx), float(messy), float(messtime), messred, messgreen, messblue, messalpha, messeffect, float(messtime), float(messfadein), float(messfadeout));
//            ShowHudText(A, -1, "%s: %s", Header, Message);
            ShowHudText(A, -1, "%s", Message);
        }
    }
    return Plugin_Handled;
}
i set the X -1 and Y 0.3 but didnt work.

it showing like Y 1.0

and one more ask, how can i add the player only?

ex. sm_mess @red hello?
ex2. sm_mess 2 you are the first one!


maybe, someone make script like that for me. D;

Last edited by sejin513; 04-27-2010 at 23:14.
sejin513 is offline
joeblow1102
Member
Join Date: Apr 2010
Old 04-27-2010 , 23:40   Re: SetHudTextParams help
Reply With Quote #2

I think it's a matter of casting. Instead of GetConVarInt, you want to use GetConVarFloat for messx and messy. What you're doing is getting it as an Int, which I believe Y would be 0 and X would be 1, then casting that as a float. I think you're printing text to X=-1, Y=0.
joeblow1102 is offline
SimonTheOne
Member
Join Date: Apr 2010
Old 04-28-2010 , 01:40   Re: SetHudTextParams help
Reply With Quote #3

use GetConvarFloat for float numbers like:
new messtime = GetConVarFloat(MessageTime);
SimonTheOne is offline
Scone
Senior Member
Join Date: Apr 2010
Location: England
Old 04-28-2010 , 14:52   Re: SetHudTextParams help
Reply With Quote #4

PHP Code:
new Float:messtime GetConVarFloat(MessageTime); 
Don't forget the tag
__________________
Scone is offline
sejin513
AlliedModders Donor
Join Date: Dec 2008
Location: ._.
Old 04-29-2010 , 07:44   Re: SetHudTextParams help
Reply With Quote #5

Thx ;)
sejin513 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 17:43.


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