Raised This Month: $12 Target: $400
 3% 

Solved Add a text on top of this (admins online hud)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pizzadaking
Member
Join Date: Oct 2019
Old 04-06-2020 , 07:23   Add a text on top of this (admins online hud)
Reply With Quote #1

I just want to know how to type something else on top of :
PHP Code:
pos += formatex(g_msg[pos], 511-pos"Admins Online: %d"g_iAdminCount

Full code:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx> 
#include <engine>

#define PLUGIN  "Show Admins Online" 
#define VERSION "1.1" 
#define AUTHOR  "vato loco [GE-S] & Alka" 

new bool:g_bAdminNick
new bool:is_admin_connected[33]
new 
g_msg[512]

new 
g_admin_enable
new g_online_color
new g_offline_color
new g_msg_xypos

new g_SyncAdmin
new g_iAdminCount 
new g_iMaxPlayers

new g_ClassName[] = "admin_msg"

public plugin_init() 

    
register_pluginPLUGINVERSIONAUTHOR )
    
    
register_think(g_ClassName,"ForwardThink")
    
    
g_admin_enable register_cvar("sa_plugin_on","1")
    
g_online_color register_cvar("sa_online_color","0 130 0")
    
g_offline_color register_cvar("sa_offline_color","255 0 0")
    
g_msg_xypos register_cvar("sa_msg_xypos","0.02 0.2")
    
    
g_SyncAdmin CreateHudSyncObj()
    
g_iMaxPlayers get_maxplayers()
    
    new 
iEnt create_entity("info_target")
    
entity_set_string(iEntEV_SZ_classnameg_ClassName)
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 2.0)


public 
client_putinserver(id)
{
    if(
get_user_flags(id) & ADMIN_KICK)
    {
        
is_admin_connected[id] = true
        g_iAdminCount
++
        
set_admin_msg()
    }
    if(
g_iAdminCount == 0)
        
set_admin_msg()
}

public 
client_disconnect(id)
{
    if(
is_admin_connected[id])
    {
        
is_admin_connected[id] = false
        g_iAdminCount
--
        
set_admin_msg()
    }
}

public 
client_infochanged(id)
{
    if(
is_admin_connected[id])
    {
        static 
NewName[32], OldName[32]
        
get_user_info(id"name"NewName31)
        
get_user_name(idOldName31)
        
        if(!
equal(OldNameNewName))
        {
            
g_bAdminNick true
        
}
    }
}

public 
set_admin_msg()
{
    static 
g_iAdminName[32], posi
    pos 
0
    pos 
+= formatex(g_msg[pos], 511-pos"Admins Online: %d"g_iAdminCount)
    
    for(
<= g_iMaxPlayers i++)
    {    
        if(
is_admin_connected[i])
        {
            
get_user_name(ig_iAdminName31)
            
pos += formatex(g_msg[pos], 511-pos"^n%s"g_iAdminName)
        }
    }
}

public 
admins_online() 
{
    if(
get_pcvar_num(g_admin_enable))
    {
        static 
rgbFloat:x,Float:y
        HudMsgPos
(x,y)
        
        if (
g_iAdminCount 0)
        {
            
HudMsgColor(g_online_colorrgb)
            
set_hudmessage(rgbxy__4.0__4)
            
ShowSyncHudMsg(0g_SyncAdmin"%s"g_msg)
        }
        else
        {
            
HudMsgColor(g_offline_colorrgb)
            
set_hudmessage(rgbxy__4.0__4)
            
ShowSyncHudMsg(0g_SyncAdmin"%s"g_msg)
        }
    }
    return 
PLUGIN_HANDLED


public 
ForwardThink(iEnt)
{
    
admins_online()
    
    if(
g_bAdminNick)
    {
        
set_admin_msg()
        
g_bAdminNick false
    
}
        
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 2.0)
}

public 
HudMsgColor(cvar, &r, &g, &b)
{
    static 
color[16], piece[5]
    
get_pcvar_string(cvarcolor15)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
str_to_num(color)
}

public 
HudMsgPos(&Float:x, &Float:y)
{
    static 
coords[16], piece[10]
    
get_pcvar_string(g_msg_xyposcoords15)
    
    
strbreak(coordspiece9coords15)
    
str_to_float(piece)
    
str_to_float(coords)


Last edited by Pizzadaking; 04-06-2020 at 09:52. Reason: SOLVED
Pizzadaking is offline
Pizzadaking
Member
Join Date: Oct 2019
Old 04-06-2020 , 07:25   Re: Add a text on top of this (admins online hud)
Reply With Quote #2

so for example i tried adding this code ( sorry if its wrong my scripting skills are really low almost none)


Quote:
pos += formatex(g_msg[pos], 511-pos, "Type /admin to learn how you can get admin !")
pos += formatex(g_msg[pos], 511-pos "TOP 1 = VIP + FULL ADMIN | TOP 2 = LITE ADMIN | TOP 3 = V.I.P")
in top of this :
Quote:
pos += formatex(g_msg[pos], 511-pos, "Admins Online: %d", g_iAdminCount)
but i get errors help pls
Pizzadaking is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-06-2020 , 07:32   Re: Add a text on top of this (admins online hud)
Reply With Quote #3

PHP Code:
pos += formatex(g_msg[pos], 511-pos "TOP 1 = VIP + FULL ADMIN | TOP 2 = LITE ADMIN | TOP 3 = V.I.P"
to
PHP Code:
pos += formatex(g_msg[pos], 511-pos"TOP 1 = VIP + FULL ADMIN | TOP 2 = LITE ADMIN | TOP 3 = V.I.P"
511-pos ,
__________________
GitHub
SteamWishlist

六四天安門事件

Last edited by +ARUKARI-; 04-06-2020 at 07:34.
+ARUKARI- is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-06-2020 , 08:46   Re: Add a text on top of this (admins online hud)
Reply With Quote #4

Use ^n inside the message to move the text after the symbol on a new line.
__________________

Last edited by OciXCrom; 04-06-2020 at 08:47.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Pizzadaking
Member
Join Date: Oct 2019
Old 04-06-2020 , 09:52   Re: Add a text on top of this (admins online hud)
Reply With Quote #5

Lol thanks i wasnt paying much attention ! SOLVED , also thanks @ocixrom u always seem to help me
Pizzadaking is offline
Pizzadaking
Member
Join Date: Oct 2019
Old 04-06-2020 , 09:58   Re: Add a text on top of this (admins online hud)
Reply With Quote #6

How can i change the color of the 2 texts i added to make it for example pink or purple ? OciXCrom can u help ?
Pizzadaking is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-06-2020 , 09:58   Re: Add a text on top of this (admins online hud)
Reply With Quote #7

Only 1 color per text. You will need multiple HUD messages for more colors, which I don't advise doing.
__________________

Last edited by OciXCrom; 04-06-2020 at 09:58.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Pizzadaking
Member
Join Date: Oct 2019
Old 04-06-2020 , 10:06   Re: Add a text on top of this (admins online hud)
Reply With Quote #8

Hm ok thanks a lot
Pizzadaking is offline
Reply


Thread Tools
Display Modes

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 10:57.


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