AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Constant HUD Display (https://forums.alliedmods.net/showthread.php?t=19851)

Kensai 10-26-2005 22:12

Constant HUD Display
 
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) XP:(current)/(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 }

Hawk552 10-26-2005 22:17

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)

XxAvalanchexX 10-26-2005 22:35

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.

Kensai 10-27-2005 20:47

I got it to display constantly, but it doesn't update?

Hawk552 10-27-2005 21:05

Post the newest code and I'll try to fix it.

Kensai 10-27-2005 21:28

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

[/small]

Zenith77 10-27-2005 21:34

Code:
msgtext = get_user_msgid("StatusText")

Isn't StatusText used for when a player looks at another player and then pops up their name ?

Hawk552 10-27-2005 21:35

1 Attachment(s)
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.

Kensai 10-27-2005 22:05

Thank you a bunch, Hawk. Will test this later after I finish homework 8)

v3x 10-27-2005 22:38

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.


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

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