AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hud not showing variables (https://forums.alliedmods.net/showthread.php?t=50454)

blackops7799 01-26-2007 19:06

Hud not showing variables
 
No matter what My hud will display everything as 0 even if i change it.

When I use another part of my mod and say /xp it says that my xp is like 400, but the hud is not showing this.

|Jake's Zombie Mod Server|

Level: 0
Exp: 0
Kills: 0

Code:
public plugin_init() {     register_cvar("zm_hud_pos_x","-1.9")     register_cvar("zm_hud_pos_y","0.55")     register_cvar("zm_hud_red","0")     register_cvar("zm_hud_green","175")     register_cvar("zm_hud_blue","0")     register_plugin("Zombie Mod","1","Jake")     set_task(6.0,"activehud",0,"",0,"b") } public activehud() {     new num, players[32]     get_players(players,num,"ac")     for( new i = 0;  i < num; i++ )     {         show_hudmessage(players[i], "|Jake's Zombie Mod Server| ^n^n Level: %i ^n Exp: %i ^n Kills: %i",level[i],xp[i],kills[i])         set_hudmessage(get_cvar_num("zm_hud_red"),get_cvar_num("zm_hud_green"),get_cvar_num("zm_hud_blue"),get_cvar_float("zm_hudhud_pos_x"),get_cvar_float("zm_hud_pos_y"),0,0.0,99.9,0.0,0.0,-1)     }     return PLUGIN_HANDLED }

dutchmeat 01-26-2007 19:10

Re: Hud overwriting other huds
 
You should hook the hud message, and check it, and return plugin_handled

blackops7799 01-26-2007 19:18

Re: Hud overwriting other huds
 
well I made the hud show up but now it is just saying 0 for kills, exp, and level, even if its not.

EDIT: I fixed the plugin because i forgot to uncomment these

Code:
    register_cvar("zm_hud_pos_x","-1.9")     register_cvar("zm_hud_pos_y","0.55")     register_cvar("zm_hud_red","0")     register_cvar("zm_hud_green","175")     register_cvar("zm_hud_blue","0")
I forgot they were commented.. lol

teame06 01-26-2007 19:28

Re: Hud not showing variables
 
set_hudmessage has to go before show_hudmessage

blackops7799 01-26-2007 19:31

Re: Hud not showing variables
 
nope, it works now, ill show you the code to show what i did.

Code:
public plugin_init() {     register_plugin("Zombie Mod","1","Jake")     register_cvar("zm_hud_pos_x","-1.9")     register_cvar("zm_hud_pos_y","0.55")     register_cvar("zm_hud_red","175")     register_cvar("zm_hud_green","0")     register_cvar("zm_hud_blue","0")     set_task(6.0,"activehud",0,"",0,"b") } public activehud() {     new num, players[32]     get_players(players,num,"ac")     for( new i = 0;  i < num; i++ )     {         show_hudmessage(players[i], "|Jake's Zombie Mod Server| ^n^n Level: %i ^n Exp: %i ^n Kills: %i",level[players[i]],xp[players[i]],kills[players[i]])         set_hudmessage(get_cvar_num("zm_hud_red"),get_cvar_num("zm_hud_green"),get_cvar_num("zm_hud_blue"),get_cvar_float("zm_hud_pos_x"),get_cvar_float("zm_hud_pos_y"),0,0.0,99.9,0.0,0.0,-1)     }     return PLUGIN_HANDLED }

I changed
Code:
level[i],xp[i],kills[i]
to
Code:
level[players[i]],xp[players[i]],kills[players[i]]

teame06 01-26-2007 19:40

Re: Hud not showing variables
 
Yes, I saw that but you suppose to use set_hudmessage before show_hudmessage. Which you have show_hudmessage then set_hudmessage. Which is backwards. So I told you that you need to use set_hudmessage before show_hudmessage.

blackops7799 01-26-2007 19:53

Re: Hud not showing variables
 
Ill do that anyway, even though it still works backward.

Thanks for the tips +Karma


All times are GMT -4. The time now is 22:23.

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