Raised This Month: $ Target: $400
 0% 

hud and cvars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
omgitsme
Veteran Member
Join Date: Mar 2010
Old 08-08-2010 , 07:37   hud and cvars
Reply With Quote #1

hey, 2 questions about huds
how can i make cvars show up in the hud? eg mp_timelimit sv_nextmap and stuff? is it the same as hostname? like in amxx.cfg %hostname% so %mp_timelimit% or something? and why dosen't this work?
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Hud"
#define VERSION "1.0"
#define AUTHOR "Omgitsme"


public plugin_init()
{
    register_plugin("Hud", "1.0", "Omgitsme")
}

public client_connect(id)
{
    if(!is_user_alive(id))
    set_hudmessage(255, 255, 255, 0.70, 0.0, 0, 6.0, 0)
    show_hudmessage(id, "Message")
}
i want it to be, so whenever the person is dead. it will show the hud message until there alive, but it dosen't show at all -_-
__________________
omgitsme is offline
Send a message via Skype™ to omgitsme
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 08-08-2010 , 11:22   Re: hud and cvars
Reply With Quote #2

2. client_connect is called when the player is downloading.

You should use the event DeathMsg to detect when a player die.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
omgitsme
Veteran Member
Join Date: Mar 2010
Old 08-08-2010 , 14:29   Re: hud and cvars
Reply With Quote #3

ok, thanks. and how about making cvars show up in huds?
__________________
omgitsme is offline
Send a message via Skype™ to omgitsme
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-08-2010 , 18:13   Re: hud and cvars
Reply With Quote #4

Not hundred percent sure if this will work, but I think it should

timelimit = get_cvar_num("mp_timelimit")


set_hudmessage(255, 255, 255, 0.70, 0.0, 0, 6.0, 0)
show_hudmessage(id, "The timelimit is %i", timelimit)
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
omgitsme
Veteran Member
Join Date: Mar 2010
Old 08-09-2010 , 06:18   Re: hud and cvars
Reply With Quote #5

ok. i'll try it in a min. but does it show how much time is left until the map changes, or does it acctually show what it is set to?
__________________
omgitsme is offline
Send a message via Skype™ to omgitsme
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 08-10-2010 , 09:38   Re: hud and cvars
Reply With Quote #6

The above example shows what's the cvar set to.Browse in your timeleft plugin and modify it to show hud msg instead of print_chat.
SpeeDeeR is offline
Zpoke
Senior Member
Join Date: Aug 2009
Location: Sweden
Old 08-10-2010 , 19:21   Re: hud and cvars
Reply With Quote #7

PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#define PLUGIN "Hud"
#define VERSION "1.0"
#define AUTHOR "Omgitsme"
public plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
register_event("DeathMsg""eDeath""a");
}
public 
eDeath(id)
{
 
set_hudmessage(00255, -1.0, -1.006.012.0)
 
show_hudmessage(id"YOUR MESSAGE HERE")

didnt added cvar since i don't know what you mean
Zpoke is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-11-2010 , 00:06   Re: hud and cvars
Reply With Quote #8

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Hud"
#define VERSION "1.0"
#define AUTHOR "Omgitsme"

new timeleft
new float:timeleft2
public plugin_init()
{
    register_plugin("Hud", "1.0", "Omgitsme")
    set_task(0.9, "gettingtime", 2, _, _, "b")
    set_task(0.9, "timeleftmessage", 1, _, _, "b")
}

public gettingtime()
{
timeleft=get_timeleft()
timeleft2=timeleft/60
floatround(timeleft2, floatround_floor)
timeleft=(timeleft %60)
}

public timeleftmessage()
{    
new players[32], num, player
get_players(players, num)
for(new i;i<num;i++)
{    player=players[i]
    if(!is_user_alive(player))
    {
        set_hudmessage(255, 255, 255, 0.70, 0.0, 0, 6.0, 0.9)
        show_hudmessage(player, "Time left on this map is %i:%i", timeleft2, timeleft)
    }
}
}
I keep getting a tag mismatch error for floatround, any ideas? If that get's fixed then this is his code I guess, so don't say make your own thread plz.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-11-2010 , 00:13   Re: hud and cvars
Reply With Quote #9

Quote:
Originally Posted by nikhilgupta345 View Post
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Hud"
#define VERSION "1.0"
#define AUTHOR "Omgitsme"

new timeleft
new float:timeleft2
public plugin_init()
{
    register_plugin("Hud", "1.0", "Omgitsme")
    set_task(0.9, "gettingtime", 2, _, _, "b")
    set_task(0.9, "timeleftmessage", 1, _, _, "b")
}

public gettingtime()
{
timeleft=get_timeleft()
timeleft2=timeleft/60
floatround(timeleft2, floatround_floor)
timeleft=(timeleft %60)
}

public timeleftmessage()
{    
new players[32], num, player
get_players(players, num)
for(new i;i<num;i++)
{    player=players[i]
    if(!is_user_alive(player))
    {
        set_hudmessage(255, 255, 255, 0.70, 0.0, 0, 6.0, 0.9)
        show_hudmessage(player, "Time left on this map is %i:%i", timeleft2, timeleft)
    }
}
}
I keep getting a tag mismatch error for floatround, any ideas? If that get's fixed then this is his code I guess, so don't say make your own thread plz.
Make your own thread and tell us what you are trying to do. There are several things wrong with your code.
__________________
fysiks 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 00:17.


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