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

Send message to all servers


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-25-2010 , 14:52   Send message to all servers
Reply With Quote #1

Emm, is there a easy and good method to send messages to all servers via rcon or something like that? the only method i can think is creating a plugin using sockets (something like the plugin that players can send messages between other servers) but i don't want to use sockets, well i don't want to use a plugin for that, just a simple method with a program or something like that using rcon (if exist ofcourse).
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
8088
Veteran Member
Join Date: Jan 2008
Old 07-25-2010 , 15:25   Re: Send message to all servers
Reply With Quote #2

You can use php to perform rcon commands, like this.
__________________
steamID converter with OpenSearch browser plugin
8088 is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-25-2010 , 16:02   Re: Send message to all servers
Reply With Quote #3

Interesing, but i don't know php, isn't there a tool or something that is already created? Becouse... with that code i have to change:

PHP Code:
$response=$server->RconCommand('amx_reloadadmins'); 
Every time that i want to send a message, and also i don't understand how to use that code, i don't think that work with only a .php web, right? And i don't know what is rcon_hl_net.inc. Is something from AMXBANS? The thing is that i don't want to install AMXBANS for only send messages to all servers ><
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 07-25-2010 , 16:41   Re: Send message to all servers
Reply With Quote #4

Check this plugin.
__________________
"There is no knowledge, that is not power"
fezh is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-25-2010 , 17:17   Re: Send message to all servers
Reply With Quote #5

Yes, i know about that plugin but like i mentioned in the first post i don't want a plugin for doing that... i want something like a simple tool or simple php web when i can write a message and send to all my servers.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
stevenisecko138
Senior Member
Join Date: Dec 2008
Location: CA
Old 07-25-2010 , 17:36   Re: Send message to all servers
Reply With Quote #6

like a gobal chat?
stevenisecko138 is offline
Send a message via AIM to stevenisecko138
01101101
BANNED
Join Date: Nov 2009
Location: 9`su 09`n0n7e`r0f76a
Old 07-25-2010 , 17:36   Re: Send message to all servers
Reply With Quote #7

Well, rcon uses socket.
The only other way is to save the cmd in a mysql database and then, the server reads it when it wants. It's a bit silly though.
01101101 is offline
bluechester
AlliedModders Donor
Join Date: Nov 2008
Old 07-25-2010 , 18:17   Re: Send message to all servers
Reply With Quote #8

I know HLStatsX or gameME uses rcon to link chat and messages together.
bluechester is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-25-2010 , 19:11   Re: Send message to all servers
Reply With Quote #9

I want something like 8088 posted... but without need of something like AMXBANS... just a php script that send a message (via rcon) that i write, to my serverS.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
8088
Veteran Member
Join Date: Jan 2008
Old 07-25-2010 , 19:55   Re: Send message to all servers
Reply With Quote #10

Here you go:
PHP Code:
<?php
//8088's rcon form 0.00000001a

//AMXBans's php rcon class is required
require_once('rcon_hl_net.inc');

//create an array with all of the allowed servers
$servers=array(
1=>array ('server 1''ip1:port1''password'),
2=>array ('server 2''ip2:port2''password'),
3=>array ('server 3''ip3:port3''password')
);

//create an array with all of the allowed commands
$commands=array('to admins only'=>'amx_chat''to everyone'=>'say');
?>

<!--create the form-->
<form name="rcon" action="" method="post">
    <label for="command"><strong>message type</strong></label>
    <select id="command" name="command">
        <?php
        
foreach($commands as $type=>$command)
        {
            echo 
'<option value="'.$command.'">'.$type.'</option>';
        }
        
?>
    </select><br>
    <strong>server</strong>
    <?php
    
foreach($servers as $server)
    {
        echo 
'<input type="checkbox" name="server[]" value="'.$server[1].'">'.$server[0];
    }
    
?>
    <br>
    <label for="message"><strong>message</strong></label><input id="message" type"text" name="message">
    <input type="submit" value="send">
</form>

<!--start handling POST data-->
<?php
if(($_POST['message']) && ($_POST['server']))
{
//received a message and at least one server to send it to

    
if(in_array($_POST['command'], $commands))
    {
        
//received a valid command, so let's build the complete rcon command for use
        
$command=$_POST['command'].' "'.$_POST['message'].'"';
        
        foreach(
$_POST['server'] as $post_server)
        {
            foreach(
$servers as $server)
            {
                if(
in_array($post_server$server))
                {
                    
//retrieve the rcon password
                    
$password=$server[2];
                    
                    
//split the ip and port and store them as seperate values
                    
$split_address=explode(':'$post_server);
                    
$ip=$split_address['0'];
                    
$port=$split_address['1'];

                    
//connect to the server
                    
$rcon=new Rcon();
                    
$rcon->Connect($ip$port$password);
                    
                    
//send the command
                    
$response=$rcon->RconCommand($command);
                    
$lines=explode('\n',$response);
                    
                    
//print the result
                    
foreach($lines as $line)
                    {
                    echo 
$line.'<br>';
                    }
                    
$rcon->Disconnect();
                }
            }
        }
    }
}
?>
I haven't tested this with actual servers, but I'm assuming it will work. I'll leave styling it up to you. It doesn't require AMXBans, but it does require the rcon class that is shipped with version 5.x. See attachment.
Attached Files
File Type: inc rcon_hl_net.inc (11.7 KB, 310 views)
__________________
steamID converter with OpenSearch browser plugin

Last edited by 8088; 07-25-2010 at 21:34. Reason: oops, forgot $rcon->Disconnect();
8088 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:44.


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