Raised This Month: $32 Target: $400
 8% 

Server Information


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 07-09-2020 , 22:39   Server Information
Reply With Quote #1

Hey AM!

I was looking for a plugin feature that could show multiple server's information through a HUD. The information would be consisting of
Code:
[HostName] [IP] [Map: MapName] [Players: NumberOfPlayers/NumberOfSlots]
for all the servers. Is it possible to implement this feature successfully?

Best regards.
__________________
MaNaReaver is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-09-2020 , 22:49   Re: Server Information
Reply With Quote #2

You would need to use Server Queries to get information from the servers. I'm quite sure there is code around here to do this stuff.
__________________
fysiks is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 07-10-2020 , 11:03   Re: Server Information
Reply With Quote #3

Quote:
Originally Posted by MaNaReaver View Post
Hey AM!

I was looking for a plugin feature that could show multiple server's information through a HUD. The information would be consisting of
Code:
[HostName] [IP] [Map: MapName] [Players: NumberOfPlayers/NumberOfSlots]
for all the servers. Is it possible to implement this feature successfully?

Best regards.
PHP Code:
/* This plugin is made by xakintosh with Amxmodx Studio 1.4.3 (final) */
// Thanks to @He3aBucuM
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new hud_rgbhud_xhud_yhud_effects,maxplayers,hudsynccurr_uptime[22], g_round 1;

public 
plugin_init() {
    
register_plugin("Server Side Info","1.6","xakintosh")
    
hud_rgb register_cvar"srv_hud_rgb""0, 255, 255" )
    
hud_x register_cvar"srv_hud_x""-1.0" )
    
hud_y register_cvar"srv_hud_y""0.02" )
    
hud_effects register_cvar"srv_hud_effects""0" )
    
hudsync CreateHudSyncObj()
    
maxplayers get_maxplayers()
    
set_task(0.1"Fwd_StartFrame"1""0"b")
    
set_task(0.1"check_uptime"___"b")
    
register_forward(FM_StartFrame"Fwd_StartFrame")
    
register_event("HLTV""event_newround""a""1=0""2=0");
}
public 
event_newround() {
    
g_round++
}
public 
Fwd_StartFrame(id) {
    new 
timestring[31]
    
get_time("%H:%M:%S",timestring,8)
    static 
Float:GameTimeFloat:FramesPer 0.0
    
static Float:Fps
    GameTime 
get_gametime()
    if(
FramesPer >= GameTime)
        
Fps += 1.0;
    else {
        
FramesPer FramesPer 1.0
        
for( new id 1id <= maxplayersid++ ) { 
            new 
ip[42],redgreenblue
            
new map[64], szHostName64 ]
            
get_mapname(map,63)
            
read_argv1szHostName63 );
            new 
players 
            players 
get_playersnum()
            
get_hud_color(redgreenblue)
            
get_user_ip(0ip311)
            
set_hudmessage(red,green,blue,get_pcvar_float(hud_x),get_pcvar_float(hud_y),get_pcvar_num(hud_effects),6.0,1.0)
            
ShowSyncHudMsg(id,hudsync," IP: %s ^nRound: %d | %s | %s | %d/32 ^n.::%s::.",ip,g_round,timestring,map,playersszHostName)
        }
        
Fps 0.0
    
}
}
get_hud_color(&r, &g, &b) {
    new 
color[20]
    static 
red[5], green[5], blue[5]
    
get_pcvar_string(hud_rgbcolorcharsmax(color))
    
parse(colorredcharsmax(red), greencharsmax(green), bluecharsmax(blue))
    
str_to_num(red)
    
str_to_num(green)
    
str_to_num(blue)
}
/*
static GetTotalAdmins() {
    new iPlayers[32],iNum,Admins
    get_players(iPlayers,iNum)
    for(new Count;Count < iNum;Count++)
        if(is_user_admin(iPlayers[Count]))
        Admins++
    return Admins
}*/
public check_uptime() {
    new 
Float:ft Float:engfunc(EngFunc_Time)
    new 
it floatround(ft)
    new 
= (it 60) % 60
    
new = (it 3600) % 24
    
new it 86400
    format
(curr_uptime21"%id:%ih:%im"dhm)

Supremache is offline
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 07-10-2020 , 16:46   Re: Server Information
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
You would need to use Server Queries to get information from the servers. I'm quite sure there is code around here to do this stuff.
Thanks, but I can't understand how to implement this. Are there any include files or headers that I need to include to use those keywords? I believe that sockets would be useful to implement such a request, but i lack the knowledge on using the module effectively.

Quote:
Originally Posted by Supremache View Post
PHP Code:
/* This plugin is made by xakintosh with Amxmodx Studio 1.4.3 (final) */
// Thanks to @He3aBucuM
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new hud_rgbhud_xhud_yhud_effects,maxplayers,hudsynccurr_uptime[22], g_round 1;

public 
plugin_init() {
    
register_plugin("Server Side Info","1.6","xakintosh")
    
hud_rgb register_cvar"srv_hud_rgb""0, 255, 255" )
    
hud_x register_cvar"srv_hud_x""-1.0" )
    
hud_y register_cvar"srv_hud_y""0.02" )
    
hud_effects register_cvar"srv_hud_effects""0" )
    
hudsync CreateHudSyncObj()
    
maxplayers get_maxplayers()
    
set_task(0.1"Fwd_StartFrame"1""0"b")
    
set_task(0.1"check_uptime"___"b")
    
register_forward(FM_StartFrame"Fwd_StartFrame")
    
register_event("HLTV""event_newround""a""1=0""2=0");
}
public 
event_newround() {
    
g_round++
}
public 
Fwd_StartFrame(id) {
    new 
timestring[31]
    
get_time("%H:%M:%S",timestring,8)
    static 
Float:GameTimeFloat:FramesPer 0.0
    
static Float:Fps
    GameTime 
get_gametime()
    if(
FramesPer >= GameTime)
        
Fps += 1.0;
    else {
        
FramesPer FramesPer 1.0
        
for( new id 1id <= maxplayersid++ ) { 
            new 
ip[42],redgreenblue
            
new map[64], szHostName64 ]
            
get_mapname(map,63)
            
read_argv1szHostName63 );
            new 
players 
            players 
get_playersnum()
            
get_hud_color(redgreenblue)
            
get_user_ip(0ip311)
            
set_hudmessage(red,green,blue,get_pcvar_float(hud_x),get_pcvar_float(hud_y),get_pcvar_num(hud_effects),6.0,1.0)
            
ShowSyncHudMsg(id,hudsync," IP: %s ^nRound: %d | %s | %s | %d/32 ^n.::%s::.",ip,g_round,timestring,map,playersszHostName)
        }
        
Fps 0.0
    
}
}
get_hud_color(&r, &g, &b) {
    new 
color[20]
    static 
red[5], green[5], blue[5]
    
get_pcvar_string(hud_rgbcolorcharsmax(color))
    
parse(colorredcharsmax(red), greencharsmax(green), bluecharsmax(blue))
    
str_to_num(red)
    
str_to_num(green)
    
str_to_num(blue)
}
/*
static GetTotalAdmins() {
    new iPlayers[32],iNum,Admins
    get_players(iPlayers,iNum)
    for(new Count;Count < iNum;Count++)
        if(is_user_admin(iPlayers[Count]))
        Admins++
    return Admins
}*/
public check_uptime() {
    new 
Float:ft Float:engfunc(EngFunc_Time)
    new 
it floatround(ft)
    new 
= (it 60) % 60
    
new = (it 3600) % 24
    
new it 86400
    format
(curr_uptime21"%id:%ih:%im"dhm)

This would work great for a single server, but are there ways to show information from another server as well?
__________________
MaNaReaver is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 07-10-2020 , 17:36   Re: Server Information
Reply With Quote #5

IIRC xRedirect has this functionality.
__________________
gabuch2 is offline
thEsp
BANNED
Join Date: Aug 2017
Old 07-10-2020 , 17:41   Re: Server Information
Reply With Quote #6

https://forums.alliedmods.net/showthread.php?t=142858
Huh?
thEsp is offline
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 07-10-2020 , 18:56   Re: Server Information
Reply With Quote #7

Quote:
Originally Posted by Gabe Iggy View Post
IIRC xRedirect has this functionality.
Yeah, but xRedirect isn't supported anymore, and both xRedirect and ARedirect crash because of sockets module.

Quote:
Originally Posted by thEsp View Post
Thanks, I read through it, and got a basic overview of the native function. However, is there a way to feed the "sq_server" command / CmdServer function, IPs from the plugin itself, instead of having it inputted by players?
__________________
MaNaReaver is offline
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 07-13-2020 , 04:43   Re: Server Information
Reply With Quote #8

Quote:
Originally Posted by MaNaReaver View Post
Thanks, I read through it, and got a basic overview of the native function. However, is there a way to feed the "sq_server" command / CmdServer function, IPs from the plugin itself, instead of having it inputted by players?
Anything that can help me get this working? Thanks again.
__________________
MaNaReaver is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 07-13-2020 , 12:32   Re: Server Information
Reply With Quote #9

Quote:
Originally Posted by MaNaReaver View Post
xRedirect isn't supported anymore
The redirect function got patched but the rest of the plugin (like server info) still works .
__________________
gabuch2 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 03:13.


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