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

Simple Server Status Script


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
maakera
Member
Join Date: Jul 2009
Old 10-09-2011 , 20:59   Simple Server Status Script
Reply With Quote #1

Hi,

I was searching for a server status script and i couldn't find it anywhere, so i thought i'd make one This is really basic so don't start yelling at me for uploading such pointless stuff

Basically you'd expect these things to be pure PHP or something (like gametracker's or game-monitor's server status scripts), but as i told you, its really basic.

There are 3 cvar's:
* server_status_barcode - (current server's ID, which is used by the PHP side for finding out what server contacted)
* server_status_net_ip - (eg. 127.0.0.1, might work on domains too, haven't tested it. but nontheless a good host should know his own IP)
* server_status_web_location - (It's the place you want to contact. eg /your_dir/server.php)

And thats about it, if all of the data is correct, then it should send you the server's information. Not much though, just players, map and a barcode.

Uploaded it only because, it might help someone do a better job at this.

Here's and example PHP side.

Php script
PHP Code:
$con mysql_connect("127.0.0.1""mysql_user""mysql_pass");
mysql_select_db("mysql_database"$con);
$code $_GET['barcode'];
$map $_GET['map'];
$players $_GET['player_amount'];
mysql_query("INSERT INTO table (barcode, map, players) VALUES ($code, '$map', $players)");
mysql_close($con); 
SMA script
PHP Code:
#include <amxmodx>
#include <sockets>
#include <amxmisc>

#define PLUGIN "Server Status"
#define VERSION "1.0"
#define AUTHOR "Maakera"

new barcodelocationnet_ip
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
barcode register_cvar "server_status_barcode""00000")
    
net_ip register_cvar "server_status_net_ip""127.0.0.1")
    
location register_cvar "server_status_web_location""/cs/GM/php/cs_serv_update.php")
    
send_data();
    
set_task(15.0,"send_data"0""0"a"1);
    
set_task(60.0,"send_data"0""0"b");
}

public 
send_data()
{
new 
serv_socketbuffer[999], loc[255], error_lineweb_ip[100]
new 
map[100], player_amount get_playersnum )
new 
data[] = " HTTP/1.1^nUser-Agent: Counter Strike Server Status Updater^n"
get_pcvar_string(net_ipweb_ip99)
get_pcvar_string(locationloc254)
get_mapname map99 )
serv_socket socket_open web_ip80SOCKET_TCPerror_line )
format(buffer998"GET %s?server_online=1&barcode=%i&map=%s&player_amount=%i^n%sHost: %s^nConnection: Keep-Alive"locget_pcvar_num(barcode), mapplayer_amountdataweb_ipweb_ip)
server_print("Sending data: %s"buffer)
socket_send serv_socketbuffer998 )
socket_close serv_socket )

Thanks,
Attached Files
File Type: sma Get Plugin or Get Source (server_status.sma - 1252 views - 1.4 KB)
__________________

maakera is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-10-2011 , 08:01   Re: Simple Server Status Script
Reply With Quote #2

You don't need PHP/sockets for this, use mysql directly from plugin.
__________________
xPaw is offline
Groven
AlliedModders Donor
Join Date: Apr 2011
Location: Sweden
Old 10-13-2011 , 02:22   Re: Simple Server Status Script
Reply With Quote #3

Any demo?
Groven is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 10-15-2011 , 04:48   Re: Simple Server Status Script
Reply With Quote #4

http://forums.alliedmods.net/showthread.php?t=24572
matsi is offline
Old 01-17-2012, 05:13
reko_o
This message has been deleted by xPaw. Reason: Flooding "thanks" posts
quark
Veteran Member
Join Date: Oct 2011
Location: Your mind.
Old 07-15-2013 , 18:26   Re: Simple Server Status Script
Reply With Quote #5

Can someone tell me if this will work correctly and without much cpu usage?
__________________

Check out My Plugins:
qServerInfo ; ASKTAG
quark is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-07-2020 , 08:10   Re: Simple Server Status Script
Reply With Quote #6

Bad indentation and the plugin seems really simple. Unapproved for now.
__________________
HamletEagle is offline
bitandalib
New Member
Join Date: Dec 2021
Old 12-06-2021 , 09:45   Re: Simple Server Status Script
Reply With Quote #7

Quote:
Originally Posted by maakera View Post
Hi,

I was searching for a server status script and i couldn't find it anywhere, so i thought i'd make one This is really basic so don't start yelling at me for uploading such pointless stuff

Basically you'd expect these things to be pure PHP or something (like gametracker's or game-monitor's server status scripts), but as i told you, its really basic.

There are 3 cvar's:
* server_status_barcode - (current server's ID, which is used by the PHP side for finding out what server contacted)
* server_status_net_ip - (eg. 127.0.0.1, might work on domains too, haven't tested it. but nontheless a good host should know his own IP)
* server_status_web_location - (It's the place you want to contact. eg /your_dir/server.php)

And thats about it, if all of the data is correct, then it should send you the server's information. Not much though, just players, map and a barcode.

Uploaded it only because, it might help someone do a better job at this.

Here's and example PHP side.

Php script
PHP Code:
$con mysql_connect("127.0.0.1""mysql_user""mysql_pass");
mysql_select_db("mysql_database"$con);
$code $_GET['barcode'];
$map $_GET['map'];
$players $_GET['player_amount'];
mysql_query("INSERT INTO table (barcode, map, players) VALUES ($code, '$map', $players)");
mysql_close($con); 
SMA script
PHP Code:
#include <amxmodx>
#include <sockets>
#include <amxmisc>

#define PLUGIN "Server Status"
#define VERSION "1.0"
#define AUTHOR "Maakera"

new barcodelocationnet_ip
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
barcode register_cvar "server_status_barcode""00000")
    
net_ip register_cvar "server_status_net_ip""127.0.0.1")
    
location register_cvar "server_status_web_location""/cs/GM/php/cs_serv_update.php")
    
send_data();
    
set_task(15.0,"send_data"0""0"a"1);
    
set_task(60.0,"send_data"0""0"b");
}

public 
send_data()
{
new 
serv_socketbuffer[999], loc[255], error_lineweb_ip[100]
new 
map[100], player_amount get_playersnum )
new 
data[] = " HTTP/1.1^nUser-Agent: Counter Strike Server Status Updater^n"
get_pcvar_string(net_ipweb_ip99)
get_pcvar_string(locationloc254)
get_mapname map99 )
serv_socket socket_open web_ip80SOCKET_TCPerror_line )
format(buffer998"GET %s?server_online=1&barcode=%i&map=%s&player_amount=%i^n%sHost: %s^nConnection: Keep-Alive"locget_pcvar_num(barcode), mapplayer_amountdataweb_ipweb_ip)
server_print("Sending data: %s"buffer)
socket_send serv_socketbuffer998 )
socket_close serv_socket )

Thanks,
can u learn me how use it? same as example.
thanks alot
bitandalib 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:40.


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