Solved Dhud colors

Coding Help/Re-API Supported
Post Reply
User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

Dhud colors

#1

Post by Mark » 5 years ago

How is this done searched everywhere and most say it can't be done?

Examples if you know!

Thanks!
20180903173438_1.jpg

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 5 years ago

For DHUD: You can show only 8 messages at once.

We can do this by making 4 DHUD text messages:
  1. Humans - Blue
  2. vs - White
  3. Zombie - Red
  4. %i -- %i - White
So 4 messages at once will not cause problems as our max is 8. This what i think how they did it.
He who fails to plan is planning to fail

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#3

Post by Mark » 5 years ago

Raheem wrote: 5 years ago For DHUD: You can show only 8 messages at once.

We can do this by making 4 DHUD text messages:
  1. Humans - Blue
  2. vs - White
  3. Zombie - Red
  4. %i -- %i - White
So 4 messages at once will not cause problems as our max is 8. This what i think how they did it.
You got a example how todo this?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#4

Post by Raheem » 5 years ago

OK, here is example:
    1. #include <amxmodx>
    2.  
    3. public plugin_init()
    4. {
    5.     register_plugin("Colored DHUD", "1.0", "Raheem")
    6.    
    7.     set_task(10.0, "ShowMessages", _, _, _, "b")
    8. }
    9.  
    10. public ShowMessages()
    11. {
    12.     set_dhudmessage(0, 0, 255, 0.38, 0.01, 0, 0.0, 9.0)
    13.     show_dhudmessage(0, "Humans")
    14.    
    15.     set_dhudmessage(255, 255, 255, -1.0, 0.01, 0, 0.0, 9.0)
    16.     show_dhudmessage(0, "vs")
    17.    
    18.     set_dhudmessage(255, 0, 0, 0.54, 0.01, 0, 0.0, 9.0)
    19.     show_dhudmessage(0, "Zombies")
    20. }
Screenshot:
  • DHUD.png
Based on this idea you can achieve what you need.
He who fails to plan is planning to fail

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#5

Post by Mark » 5 years ago

Raheem wrote: 5 years ago OK, here is example:
    1. #include <amxmodx>
    2.  
    3. public plugin_init()
    4. {
    5.     register_plugin("Colored DHUD", "1.0", "Raheem")
    6.    
    7.     set_task(10.0, "ShowMessages", _, _, _, "b")
    8. }
    9.  
    10. public ShowMessages()
    11. {
    12.     set_dhudmessage(0, 0, 255, 0.38, 0.01, 0, 0.0, 9.0)
    13.     show_dhudmessage(0, "Humans")
    14.    
    15.     set_dhudmessage(255, 255, 255, -1.0, 0.01, 0, 0.0, 9.0)
    16.     show_dhudmessage(0, "vs")
    17.    
    18.     set_dhudmessage(255, 0, 0, 0.54, 0.01, 0, 0.0, 9.0)
    19.     show_dhudmessage(0, "Zombies")
    20. }
Screenshot:
  • DHUD.png
Based on this idea you can achieve what you need.
Ahh i get it!

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#6

Post by Spir0x » 5 years ago

Oh what about this ?

Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#7

Post by Raheem » 5 years ago

In zombie_escape.cfg set: ze_score_message_type 0
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#8

Post by Spir0x » 5 years ago

and then i can see only Humans vs Zombies ?
where is the score ?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#9

Post by Raheem » 5 years ago

No, he didn't ask for score add. Also i only give a example how this can be done.

You need a full working code with our Mod using this?
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#10

Post by Spir0x » 5 years ago

Yes if possible.

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#11

Post by Raheem » 5 years ago

Open ze_core.sma and find:
    1. // Score Message Task
    2. public Score_Message(TaskID)
    3. {
    4.     switch(get_pcvar_num(g_pCvarScoreMessageType))
    5.     {
    6.         case 0: // Disabled
    7.         {
    8.             return
    9.         }
    10.         case 1: // DHUD
    11.         {
    12.             set_dhudmessage(get_pcvar_num(g_pCvarColors[Red]), get_pcvar_num(g_pCvarColors[Green]), get_pcvar_num(g_pCvarColors[Blue]), -1.0, 0.01, 0, 0.0, 9.0)
    13.             show_dhudmessage(0, "%L", LANG_PLAYER, "SCORE_MESSAGE", g_iZombiesScore, g_iHumansScore)
    14.         }
    15.         case 2: // HUD
    16.         {
    17.             set_hudmessage(get_pcvar_num(g_pCvarColors[Red]), get_pcvar_num(g_pCvarColors[Green]), get_pcvar_num(g_pCvarColors[Blue]), -1.0, 0.01, 0, 0.0, 9.0)
    18.             show_hudmessage(0, "%L", LANG_PLAYER, "SCORE_MESSAGE", g_iZombiesScore, g_iHumansScore)
    19.         }
    20.     }
    21. }
Replace it with:
    1. // Score Message Task
    2. public Score_Message(TaskID)
    3. {
    4.     switch(get_pcvar_num(g_pCvarScoreMessageType))
    5.     {
    6.         case 0: // Disabled
    7.         {
    8.             return
    9.         }
    10.         case 1: // DHUD
    11.         {
    12.             set_dhudmessage(0, 0, 255, 0.38, 0.01, 0, 0.0, 9.0)
    13.             show_dhudmessage(0, "Humans")
    14.            
    15.             set_dhudmessage(255, 255, 255, -1.0, 0.01, 0, 0.0, 9.0)
    16.             show_dhudmessage(0, "vs")
    17.            
    18.             set_dhudmessage(255, 0, 0, 0.54, 0.01, 0, 0.0, 9.0)
    19.             show_dhudmessage(0, "Zombies")
    20.            
    21.             set_dhudmessage(255, 255, 255, -1.0, 0.045, 0, 0.0, 9.0)
    22.             show_dhudmessage(0, "%i --------- %i", g_iHumansScore, g_iZombiesScore)
    23.         }
    24.         case 2: // HUD
    25.         {
    26.             set_hudmessage(get_pcvar_num(g_pCvarColors[Red]), get_pcvar_num(g_pCvarColors[Green]), get_pcvar_num(g_pCvarColors[Blue]), -1.0, 0.01, 0, 0.0, 9.0)
    27.             show_hudmessage(0, "%L", LANG_PLAYER, "SCORE_MESSAGE", g_iZombiesScore, g_iHumansScore)
    28.         }
    29.     }
    30. }
And then go to zombie_escape.cfg and edit the score info cvar, make it: ze_score_message_type 1
He who fails to plan is planning to fail

User avatar
Mark
VIP
VIP
United States of America
Posts: 283
Joined: 5 years ago
Location: Des Moines/USA
Contact:

#12

Post by Mark » 5 years ago

This is what i did. I dont care about hud message.
  1. // Score Message Task
  2. public Score_Message(TaskID)
  3. {
  4.     set_dhudmessage(0, 0, 255, 0.40, 0.01, 0, 0.0, 9.0)
  5.     show_dhudmessage(0, "HumanS")
  6.    
  7.     set_dhudmessage(255, 255, 255, -1.0, 0.01, 0, 0.0, 9.0)
  8.     show_dhudmessage(0, "[VS]%L", LANG_PLAYER, "SCORE_MESSAGE", g_iHumansScore, g_iZombiesScore)
  9.    
  10.     set_dhudmessage(255, 0, 0, 0.54, 0.01, 0, 0.0, 9.0)
  11.     show_dhudmessage(0, "ZombieS")
  12. }
then in serverfiles/cstrike/addons/amxmodx/data/lang
  1. SCORE_MESSAGE = ^n[%i] ----------- [%i]
Only uses 3 messages and works nice.

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 5 guests