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

[HELP] Send commands to another server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-15-2018 , 22:17   [HELP] Send commands to another server
Reply With Quote #1

Good evening, friends, I need a north for something I've been trying to do:
  • Filter a command on say (Already ready, easy)
  • Send this command to a list of servers in an .ini, to appear in the say of those servers (create / read the .ini I do not need help, however send this command to the servers in the list I will need.)
  • If anything already exists, I am grateful to be shown for ideas.

Last edited by iceeedr; 07-15-2018 at 22:18.
iceeedr is offline
Send a message via Skype™ to iceeedr
Old 07-15-2018, 22:31
CrAzY MaN
This message has been deleted by asherkin.
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-15-2018 , 22:34   Re: [HELP] Send commands to another server
Reply With Quote #2

No..is not for any server, it will have to be in the list and somehow be required access to it, such as via RCON, or etc ... I do not intend to slowhack.

And the command would be something like, "XXX server needs 2 players", a message, that's because on XXX server someone typed .need 2 ... just an example

Last edited by iceeedr; 07-15-2018 at 22:35.
iceeedr is offline
Send a message via Skype™ to iceeedr
Old 07-16-2018, 03:34
Ghosted
This message has been deleted by asherkin.
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-16-2018 , 09:13   Re: [HELP] Send commands to another server
Reply With Quote #3

Anyone indeed to help, or are we just doing a stand up comedy?
iceeedr is offline
Send a message via Skype™ to iceeedr
Old 07-16-2018, 10:12
EFFx
This message has been deleted by asherkin.
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-16-2018 , 11:38   Re: [HELP] Send commands to another server
Reply With Quote #4

You can do it over RCON with https://forums.alliedmods.net/showthread.php?t=231477
__________________
klippy is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-17-2018 , 22:40   Re: [HELP] Send commands to another server
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
Ok, I'm using as you indicated, initially I found it strange not to work on my linux server, I tried again trying to send the command to my home windows server.
On windows worked everything perfectly (I used changelevel as a command for testing purposes of sending command) but in linux after sending the command I get an "error" timeout, and nothing happens ... any suggestion of what might turn out to be?

Oh, to test again I used an app for android called "noobstrike" that has a function to send Rcon commands, again on the server windows (homemade) I was able to change the map, in linux "timeout".
iceeedr is offline
Send a message via Skype™ to iceeedr
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-17-2018 , 23:47   Re: [HELP] Send commands to another server
Reply With Quote #6

Try changing socket protocol to TCP
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-18-2018 , 23:35   Re: [HELP] Send commands to another server
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
Try changing socket protocol to TCP
Here's the full code.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <sockets>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new g_Socket
new g_Forward

enum _
:Data
{
    
DataHost[32],
    
DataPort,
    
DataPassword[32],
    
DataCommand[192]
}
new 
g_Hostg_Portg_Pass
new g_Rcon[Data]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_Host create_cvar("pug_hltv_host","IP:",FCVAR_NONE// With or without the ":"??
    
g_Port create_cvar("pug_hltv_port","port",FCVAR_NONE)
    
g_Pass create_cvar("pug_hltv_pass","Rcon pass",FCVAR_NONE)
}

RconCommand(Host[],Port,Password[],Command[])
{
    new 
Error;
    
g_Socket socket_open(Host,Port,SOCKET_UDP,Error,SOCK_NON_BLOCKING);
   
    if(
Error != -1)
    {
        new 
Send[256];
        
formatex(Send,sizeof(Send),"%c%c%c%cchallenge rcon",0xFF,0xFF,0xFF,0xFF);
       
        
socket_send2(g_Socket,Send,charsmax(Send));
       
        
copy(g_Rcon[DataHost],charsmax(g_Rcon[DataHost]),Host);
       
        
g_Rcon[DataPort] = Port;
   
        
copy(g_Rcon[DataPassword],charsmax(g_Rcon[DataPassword]),Password);
        
copy(g_Rcon[DataCommand],charsmax(g_Rcon[DataCommand]),Command);
 
        
g_Forward register_forward(FM_StartFrame,"FMStartFrame",true);
    }
    else
    {
        
socket_close(g_Socket);
    }
 
}  
 
public 
FMStartFrame()
{
    if(
socket_is_readable(g_Socket))
    {
        new 
Command[256],Rcon[32],None[64];
   
        
socket_recv(g_Socket,Command,charsmax(Command));
        
parse(Command,None,charsmax(None),None,charsmax(None),Rcon,charsmax(Rcon));
       
        
formatex(Command,sizeof(Command),"%c%c%c%crcon %s ^"%s^" %s",0xFF,0xFF,0xFF,0xFF,Rcon,g_Rcon[DataPassword],g_Rcon[DataCommand]);
        
socket_send2(g_Socket,Command,charsmax(Command));
       
        if(
socket_is_readable(g_Socket))
        {
            new 
Buffer[1024];
            
socket_recv(g_Socket,Buffer,charsmax(Buffer));
           
            
server_print(Buffer);
        }
       
        
socket_close(g_Socket);
       
        
unregister_forward(FM_StartFrame,g_Forward,true);
    }
}

public 
SendMessage()
{
    new 
HOST[32];
    
get_pcvar_string(g_Host,HOST,charsmax(HOST));
    
    new 
Command[60]
    
formatex(Commandcharsmax(Command), "changelevel de_inferno")
            
    new 
Password[32];
    
get_pcvar_string(g_Pass,Password,charsmax(Password));
    
    
RconCommand(HOST,get_pcvar_num(g_Port),Password,Command);

As you can see, I tried to use the changelevel command .. nothing happens .. I tried to send a say also nothing happens .. what's wrong?

Last edited by iceeedr; 07-18-2018 at 23:36.
iceeedr is offline
Send a message via Skype™ to iceeedr
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 01-15-2019 , 08:41   Re: [HELP] Send commands to another server
Reply With Quote #8

I think by the time already can make a "bump" right? haha

No one with a solution to the case?
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-15-2019 , 09:56   Re: [HELP] Send commands to another server
Reply With Quote #9

So wait, it works on Windows but not on Linux? Even when it comes to third party apps sending the request, not just your plugin?
__________________
klippy is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 01-15-2019 , 09:59   Re: [HELP] Send commands to another server
Reply With Quote #10

Quote:
Originally Posted by KliPPy View Post
So wait, it works on Windows but not on Linux? Even when it comes to third party apps sending the request, not just your plugin?
Yes, at that time it happened exactly, I did not test on amx 1.9 (but I do not think anything should have changed in relation to that), and I was able to just send directly to a server already configured, I could not imagine ways to send to the added servers to the .ini file.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Old 01-15-2019, 12:38
CrazY.
This message has been deleted by CrazY.. Reason: nvm
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 07:03.


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