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

Help Please


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Guppy488
Member
Join Date: Jul 2010
Location: Guppy's Scripting Lab
Old 08-29-2010 , 08:26   Help Please
Reply With Quote #1

hi,can anyone tell me how to set hud message Bottom Left Of Screen that last a Whole Round,and won't be Covered by Anything Else.

and has a command attached to it,example: amx_hudmessage <your message> and Default Color can be set in .sma or using cvars?
Guppy488 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-29-2010 , 09:20   Re: Help Please
Reply With Quote #2

Please use descriptive topic titles. I recommend you change it to something related to your problem so future users can benefit from your same problem and solution.

I can't promise it won't conflict with HUDs from other plugins.

Usage: amx_hudmessage "Your message here"

Always use quotes to be safe.

PHP Code:
#include <amxmodx>
#include <amxmisc>

const TaskHUD 13579;

new const 
RGBColor[] = 
{
    
0,
    
212
    
255
}

new const 
Float:HUDPos[] = 
{
    
0.05,
    
0.85
}

new 
g_szHUDMsg128 ];
new 
g_SyncHUD;

public 
plugin_init() 
{
    
register_concmd"amx_hudmessage" "cmd_SetHUD" ADMIN_KICK "Set Round HUD Msg" ); 

    
register_logevent"fw_RoundEnd" "1=Round_End" );
    
    
g_SyncHUD CreateHudSyncObj();
}

public 
fw_RoundEnd()
{
    
remove_taskTaskHUD );
}

public 
cmd_SetHUDid level cid )
{
    if ( 
cmd_accessid level cid ) )
    {
        
read_argvg_szHUDMsg charsmaxg_szHUDMsg ) );
        
set_task5.0 "ShowHUD" TaskHUD __"b" );
        
ShowHUD();
    }

    return 
PLUGIN_HANDLED;
}

public 
ShowHUD()
{
    
set_hudmessageRGBColor] , RGBColor] , RGBColor] , HUDPos] , HUDPos] , __6.0 __, -);
    
ShowSyncHudMsgg_SyncHUD g_szHUDMsg );

__________________

Last edited by Bugsy; 08-29-2010 at 09:58.
Bugsy is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 08-29-2010 , 09:49   Re: Help Please
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Hud Message"
#define VERSION "1.0"
#define AUTHOR "SpeeD"
#define TASK_ID 13337

new cvarHudColor,cvarHudCoords,arg[128],id
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("amx_hudmessage","hudmsg",ADMIN_CVAR)
    
cvarHudColor register_cvar("amx_hudmessage_color","255 0 0")
    
cvarHudCoords register_cvar("amx_hudmessage_coords","0.01 0.91")
    
register_logevent("round_start",2,"1=Round_Start")
    
register_logevent("round_end",2,"1=Round_End")
}

public 
GetHudColorcvar, &r, &g, &)
{
    static 
color[16], piece[5];
    
get_pcvar_stringcvarcolor15 );
    
    
strbreakcolorpiece4color15 );
    
str_to_numpiece );
    
    
strbreakcolorpiece4color15 );
    
str_to_numpiece );
    
str_to_numcolor );
}

public 
GetHudCoordscvar, &Float:x, &Float:)
{
    static 
coords[16], piece[10];
    
get_pcvar_stringcvarcoords15 );
    
    
strbreakcoordspiece9coords15 );
    
str_to_floatpiece );
    
str_to_floatcoords );
}

public 
hudmsg(id,level,cid)
{
    if (!
cmd_access(id,level,cid,1))
        return 
PLUGIN_HANDLED
    
    read_argv
(1,arg,charsmax(arg))
    return 
PLUGIN_HANDLED
}

public 
round_start()
{
    
    
set_task(0.1,"showhudmsg",TASK_ID,_,_,"b")
}

public 
round_end()
{
    
remove_task(TASK_ID)
}
public 
showhudmsg()
{
    static 
rgb
    GetHudColor
cvarHudColorrg)
    static 
Float:xFloat:y
    GetHudCoords
cvarHudCoordsx)
    
set_hudmessage(rgb,y001.00.0,0.0,-1)
    
show_hudmessage(0"%s",arg)

Code:
Cvars:
amx_hudmessage_color
amx_hudmessage_coords

Commands:
amx_hudmessage

Last edited by SpeeDeeR; 08-29-2010 at 09:54.
SpeeDeeR is offline
Guppy488
Member
Join Date: Jul 2010
Location: Guppy's Scripting Lab
Old 08-29-2010 , 09:57   Re: Help Please
Reply With Quote #4

@SpeeDeeR
so if i type in console amx_hudmessage "hello everyone"
it will stay on bottom of the screen for 1 whole round?
@Bugsy
how to set the color?

Last edited by Guppy488; 08-29-2010 at 10:01.
Guppy488 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-29-2010 , 10:03   Re: Help Please
Reply With Quote #5

You can use this calculator to get the RGB color values (top right-hand section with 3 # text boxes). If you want red, green, or blue just set the appropriate value to 255 and both others to 0. 255 255 255 = white, 0 0 0 = black.

Place values here:
PHP Code:
new const RGBColor[] = 
{
    
0//red
    
212,  //green
    
255 //blue

Same idea for HUD position
PHP Code:
new const Float:HUDPos[] = 
{
    
0.05//x position
    
0.85  //y position

__________________
Bugsy is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 08-29-2010 , 10:04   Re: Help Please
Reply With Quote #6

YEs it will(comma) the whole round (full stop)
SpeeDeeR is offline
Guppy488
Member
Join Date: Jul 2010
Location: Guppy's Scripting Lab
Old 08-30-2010 , 00:51   Re: Help Please
Reply With Quote #7

thanks all,i may use both of yours ... now i could add on with your ideas to my own first complicated plugin...tho i'm making for private use >_>
Guppy488 is offline
Guppy488
Member
Join Date: Jul 2010
Location: Guppy's Scripting Lab
Old 08-30-2010 , 01:02   Re: Help Please
Reply With Quote #8

@bugsy
how do i set Hud On Middle Right of the screen?

Will My name will be shown in the hud message? i don't want my name to be shown :S
Guppy488 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-30-2010 , 08:52   Re: Help Please
Reply With Quote #9

Quote:
Originally Posted by Guppy488 View Post
@bugsy
how do i set Hud On Middle Right of the screen?

Will My name will be shown in the hud message? i don't want my name to be shown :S
Play with the HUDPos values. Your name will not be in the HUD msg. If you have AMXX-Studio there is a generator that can easily provide coordinates (Generators->Hudmessage Generator. Try using 0.60 , -1.0

PHP Code:
new const Float:HUDPos[] = 
{
    
0.6,
    -
1.0

__________________
Bugsy is offline
Guppy488
Member
Join Date: Jul 2010
Location: Guppy's Scripting Lab
Old 09-01-2010 , 00:18   Re: Help Please
Reply With Quote #10

Thanks Bugsy,you've helped me alot ^^

Last edited by Guppy488; 09-01-2010 at 00:24.
Guppy488 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 18:44.


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