Raised This Month: $ Target: $400
 0% 

hud help?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sum
Member
Join Date: Oct 2011
Old 05-07-2012 , 18:28   hud help?
Reply With Quote #1

heyo could u make that plugin will show this hud mess. every X seconds please?

Code:
#include <amxmodx>

new const PLUGIN[] = "Hud Messege with Hostname, Current & TimeLeft";
new const VERSION[] = "1.0";
new const AUTHOR[] = "MercedeS";
new const HOTNAME[] = "Hostname";

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
}

public client_putinserver()
{
new map[33];
get_mapname(map,32);
new timeleft = get_timeleft();
set_hudmessage(255, 250, 205, -1.0, 0.0, 1, 6.0, 1.0) ;
show_hudmessage(0, "%s - CURRENT MAP:^n%s^nTIMELEFT: %s", HOTNAME, map, timeleft);
set_task(0.9, "client_putinserver");
}
Sum is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-07-2012 , 22:17   Re: hud help?
Reply With Quote #2

Code:
new Float:repTime = 1.0    // this sets how many seconds you want between each show
set_task(repTime, "showMsg", 0, .flags="b")
PHP Code:
public client_putinserver() 
{
    
showMsg()
}
public 
showMsg()
{
    new 
map[33], timeleft[9]
    
get_mapname(map,32)
    new 
seconds get_timeleft()%60
    
new minutes floatround( (get_timeleft() - seconds) / 60 )
    
format(timeleft8"%d:%d"minutesseconds)
    
set_hudmessage(255250205, -1.00.016.01.0
    
show_hudmessage(0"%s - CURRENT MAP:^n%s^nTIMELEFT: %s"HOTNAMEmaptimeleft)
    return 
1

if my math for determining minutes and seconds is correct.

corrections: -set_task function needs args in order to repeat the task
-you shouldn't put set_task in the client_putinserver function; it'll set the task as many times as people join
-%s signifies you're showing a string. while your variable was defined as an int
-timeleft returns the time left in seconds: not very user friendly, so i put it to a string w/ the min:sec for you (assuming my math is correct)

NOTE: put the first code block into your plugin_init, that will initialize it properly.
ALSO: someone check his set_hudmessage i'm too tired to deal with that bloody function call right now. too man god damn periods and commas. it hurts my eyes

Last edited by Liverwiz; 05-07-2012 at 22:19.
Liverwiz is offline
deadman909
Veteran Member
Join Date: Oct 2008
Old 07-31-2012 , 08:42   Re: hud help?
Reply With Quote #3

Why dont you just used amxx.cfg
You can make new Huds there already and you can set every amount of seconds you want a new one to appear.
__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
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 00:25.


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