AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Send client_print to another server (https://forums.alliedmods.net/showthread.php?t=221470)

Podarok 07-22-2013 13:37

Send client_print to another server
 
Can I send a client_print to another server using Sockets (i guess), when a player types a certain command in chat. e.g.:
Client typed : /send
And on the other server we show this :
Code:
client_print(0, print_chat, "A client on XXX.XXX.XXX.XXX wrote /send, ... blah blah blah");

Is that possible ?

wickedd 07-22-2013 13:40

Re: Send client_print to another server
 
Take a look at this.

Podarok 07-23-2013 02:43

Re: Send client_print to another server
 
Not really sure how to use it.

PHP Code:

/*
 * Sends formatted data to a given IP
 * 
 * @param      ip - The IP to send data to
 * @param      format - The format of the data
 * 
 * @note        The port must be at the end of the IP address
 * @note        To send data back to the same server, use "loopback" as the IP and no port at the end of it
 * 
 * @return    Returns 1 on success, 0 on failure
 * 
 */
native scomm_sendf(const ip[], const format[], any:...);

/*
 * Called when the server receives data from another server
 * 
 * @param      data - The string containing data
 * @param      len - The length of the data
 * 
 * @return    Return value is ignored
 * 
 */
forward scomm_receive(data[], len); 

Could someone (or even Exolent) provide an example of how to send a client_print to other server and send also the server's IP and the clients id or name, because I cant understand how this example works :
PHP Code:

#include < amxmodx >
#include < server_comm >

public plugin_init( )
{
    
register_plugin"Server Comm Example""0.0.1""Exolent" );
    
    
register_srvcmd"scomm_send""CmdSend" );
}

public 
scomm_receiveszData[ ], iLen )
{
    
log_amx"Received data: %s"szData );
}

public 
CmdSend( )
{
    if( 
scomm_send"loopback""Test data" ) )
    {
        
server_print"Sent data" );
    }
    else
    {
        
server_print"Could not send data." );
    }
    
    return 
PLUGIN_HANDLED;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 

Or please explain me that one, I had a long break in scripting :/


All times are GMT -4. The time now is 06:22.

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