Raised This Month: $ Target: $400
 0% 

Constant HUD Display


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 10-26-2005 , 22:12   Constant HUD Display
Reply With Quote #1

I'm trying to make a constant hud display for my Ninja Mod. Soemthing similar to superhero mod where it shows your lvl and xp etc.

I need to have it say like

[(Ninja Class Here) Ninja] Level: (current Level) XPcurrent)/(amount needed for next lvl)


My Classes are

Code:
#define CLASS_NOTHING 0 #define CLASS_STRONG 1 #define CLASS_FAST 2 #define CLASS_STEALTHY 3 #define CLASS_BALANCED 4

Playerclass,lvl,and xp are

Code:
new PlayerClass[33] new PlayerXP[33] new PlayerLevel[33]

Here's what I have now, but it's not working at all.

Code:
public ShowHUD(id)         {       new HUD[51]         format(HUD, 50, "[%s Ninja]Level: %i XP/ %i", CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id])           message_begin(MSG_ONE, msgtext, {0,0,0}, id)       write_byte(0)       write_string(HUD)       message_end()       return PLUGIN_CONTINUE }
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-26-2005 , 22:17  
Reply With Quote #2

You could do a set_task() on the person when they client_putinserver, and then lift it when they client_disconnect, (by using remove_task)
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-26-2005 , 22:35  
Reply With Quote #3

If you want a constant XP display of the type that WC3 uses, then you should probably hook the message and resend it everytime it comes in.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 10-27-2005 , 20:47  
Reply With Quote #4

I got it to display constantly, but it doesn't update?
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-27-2005 , 21:05  
Reply With Quote #5

Post the newest code and I'll try to fix it.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 10-27-2005 , 21:28  
Reply With Quote #6

Ok didn't want to post all the code so here's the .sma

[/small]
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-27-2005 , 21:34  
Reply With Quote #7

Code:
msgtext = get_user_msgid("StatusText")

Isn't StatusText used for when a player looks at another player and then pops up their name ?
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-27-2005 , 21:35  
Reply With Quote #8

I renamed public precache to public plugin_precache (what's actually called)

Removed the new round part, and added a set task when the person joins. If they leave, it stops.

Here it is, not sure if it'll work though:

PS It's a good idea to stop using the AMXX Studio indenter, especially with that coding style.
Attached Files
File Type: sma Get Plugin or Get Source (ninjamod.sma - 667 views - 16.9 KB)
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 10-27-2005 , 22:05  
Reply With Quote #9

Thank you a bunch, Hawk. Will test this later after I finish homework
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 10-27-2005 , 22:38  
Reply With Quote #10

You should just do what Avalanche said:
Quote:
Originally Posted by XxAvalanchexX
If you want a constant XP display of the type that WC3 uses, then you should probably hook the message and resend it everytime it comes in.
This is what your DeathMsg event function would look like:
Code:
public DeathMsg()     {     if(get_cvar_num("amx_ninjaon") == 1)         {         return PLUGIN_CONTINUE     }         new attacker = read_data(1)         if(PlayerClass[attacker] == CLASS_NOTHING) {         return PLUGIN_CONTINUE     }         if(PlayerLevel[attacker] == 6) {         return PLUGIN_CONTINUE     }         PlayerXP[attacker] += get_cvar_num("amx_ninja_xppk")           if(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])         {                 PlayerLevel[attacker] += 1                 client_print(attacker, print_chat, "[Ninja Mod] Congratulations! You are now level %i!", PlayerLevel[attacker])                 ShowHUD(attacker) // <--     }     return PLUGIN_CONTINUE }
Do the same in the ResetHUD event.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 23:47.


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