Raised This Month: $ Target: $400
 0% 

How to add current map name to the hud?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Naza1923
New Member
Join Date: Aug 2018
Old 08-05-2018 , 21:46   How to add current map name to the hud?
Reply With Quote #1

My HUD Looks like:

[My server name]


[my tag]
[hp]
[anti infection vest]
[zombie class]
[ammo packs]

And i want to show which map is the current one below ammo packs or anywhere.

hud code:

PHP Code:
{
    
    static 
name[33]
    
get_user_name(idname32)
    
        
//    Show    health,    class    and    ammo    packs    
        
set_hudmessage(red,    green,    blue,    0.02,    0.18,    0,    6.0,    1.1,    0.0,    0.0,    -1)
        
ShowSyncHudMsg(ID_SHOWHUD,    g_MsgSync2,    "[Zombie Plague]^n^n[Nombre: %s]^n[Vida: %d]^n[Chaleco: %d]^n[Clase: %s]^n[AmmoPacks: %d]"namepev(ID_SHOWHUDpev_health), get_user_armor(id), class, g_ammopacks[ID_SHOWHUD]) 
    } 
Naza1923 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 08-05-2018 , 22:08   Re: How to add current map name to the hud?
Reply With Quote #2

get_mapname().
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Naza1923
New Member
Join Date: Aug 2018
Old 08-06-2018 , 08:21   Re: How to add current map name to the hud?
Reply With Quote #3

Quote:
Originally Posted by EFFx View Post
get_mapname().
Added get_mapname() like this

PHP Code:
{
    
    static 
name[33]
    
get_user_name(idname32)
    
        
//    Show    health,    class    and    ammo    packs    
        
set_hudmessage(red,    green,    blue,    0.02,    0.18,    0,    6.0,    1.1,    0.0,    0.0,    -1)
        
ShowSyncHudMsg(ID_SHOWHUD,    g_MsgSync2,    "[SPG Zombie Plague Clasico]^n^n[Nombre: %s]^n[Mapa: %s]^n[Vida: %d]^n[Chaleco: %d]^n[Clase: %s]^n[AmmoPacks: %d]"nameget_mapname(), pev(ID_SHOWHUDpev_health), get_user_armor(id), class, g_ammopacks[ID_SHOWHUD]) 
    } 
But when compiling got this error

PHP Code:
zombie_plague40.sma<8373error 088 number of arguments does not match definition 
Line 8373 is the one starting on "ShowSyncHudMsg"

Last edited by Naza1923; 08-06-2018 at 08:22.
Naza1923 is offline
shauli
Member
Join Date: Jun 2018
Old 08-06-2018 , 08:28   Re: How to add current map name to the hud?
Reply With Quote #4

Quote:
Originally Posted by Naza1923 View Post
Added get_mapname() like this

PHP Code:
{
    
    static 
name[33]
    
get_user_name(idname32)
    
        
//    Show    health,    class    and    ammo    packs    
        
set_hudmessage(red,    green,    blue,    0.02,    0.18,    0,    6.0,    1.1,    0.0,    0.0,    -1)
        
ShowSyncHudMsg(ID_SHOWHUD,    g_MsgSync2,    "[SPG Zombie Plague Clasico]^n^n[Nombre: %s]^n[Mapa: %s]^n[Vida: %d]^n[Chaleco: %d]^n[Clase: %s]^n[AmmoPacks: %d]"nameget_mapname(), pev(ID_SHOWHUDpev_health), get_user_armor(id), class, g_ammopacks[ID_SHOWHUD]) 
    } 
But when compiling got this error

PHP Code:
zombie_plague40.sma<8373error 088 number of arguments does not match definition 
Line 8373 is the one starting on "ShowSyncHudMsg"
You should use it like this:
PHP Code:
new mapname[32];
get_mapname(mapnamecharsmax(mapname)); 
Also, you should put it in plugin_init and save the map name on a global variable, then use this variable on your hudmessage. The map name never changes after the plugin_init, so you should only call this native once per map.
shauli is offline
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 08-06-2018 , 10:26   Re: How to add current map name to the hud?
Reply With Quote #5

Code:
{         static name[33]     new mapname[32]     get_mapname(mapname, charsmax(mapname))     get_user_name(id, name, 32)             set_hudmessage(red,    green,    blue,    0.02,    0.18,    0,    6.0,    1.1,    0.0,    0.0,    -1)     ShowSyncHudMsg(ID_SHOWHUD,    g_MsgSync2,    "[SPG Zombie Plague Clasico]^n^n[Nombre: %s]^n[Mapa: %s]^n[Vida: %d]^n[Chaleco: %d]^n[Clase: %s]^n[AmmoPacks: %d]^n[Map : %s]", name, pev(ID_SHOWHUD, pev_health), get_user_armor(id), class, g_ammopacks[ID_SHOWHUD], mapname) }
__________________
CrAzY MaN is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 08-06-2018 , 22:49   Re: How to add current map name to the hud?
Reply With Quote #6

Use that native once in plugin_init() instead.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx 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 21:12.


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