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

Get server hostname & chat log (Sockets Module ?) [HELP]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kuma77
Senior Member
Join Date: Sep 2014
Location: Behind PC
Old 01-20-2015 , 20:22   Get server hostname & chat log (Sockets Module ?) [HELP]
Reply With Quote #1

Hi ,

Guys my problems is i cant open socket from a server .
First , my idea is to show chat btw 2 servers its like to mix them i mean , on my server 1 i can see what players type on server 2 .

can someone explain this code by hackziner .

PHP Code:
#include <amxmodx>
#include <sockets_hz>

#define PLUGIN "Multi Server Chat System"
#define VERSION "0.1"
#define AUTHOR "hackziner"

#define DEFAULT_SOCKET_PORT 18107

new ListeningSocket;
new 
SendingSocket;

new 
HostName[32];
new 
PartnerServerIp[32];
new 
PartnerServerCvar;

public 
plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    new 
Error;
    
ListeningSocket socket_listen("127.0.0.1"DEFAULT_SOCKET_PORTSOCKET_UDPError);
    
socket_unblock(ListeningSocket);
    
    
register_clcmd("say""HandleSay");
    
PartnerServerCvar register_cvar("partner_server""82.232.102.55"FCVAR_SERVER); //Partner Server.
    
    
get_cvar_string("hostname"HostNamesizeof HostName 1);
    
get_pcvar_string(PartnerServerCvarPartnerServerIpsizeof PartnerServerIp 1);
    
    
set_task(1.0"RecvMessage"0""0"b");
}

public 
plugin_end() 
    
socket_close(ListeningSocket);

public 
HandleSay(id)
{
    static 
Args[256], Name[32], Buffer[512], Error;
    
read_args(Argssizeof Args 1);
    
    
get_user_name(idNamesizeof Name 1);
    
    
format(Buffersizeof Buffer 1"[%s]%s : %s"HostNameNameArgs);
    
    
SendingSocket socket_open(PartnerServerIpDEFAULT_SOCKET_PORTSOCKET_UDPError);
    
    
socket_send(SendingSocketBuffersizeof Buffer 1);
    
socket_close(SendingSocket);
}

public 
RecvMessage()
{
    static 
Message[512];
    if(
socket_change(ListeningSocket,1))
    {
        
socket_recv(ListeningSocketMessagesizeof Message 1);
        
client_print(0print_chat"%s"Message);
    }

i tried this but nothing do & i try to mix this with xREDIRECT plugin by x OR , failed

no one say me its impossible cuz i saw one servers use that.
__________________
SPACE TIME

Last edited by Kuma77; 01-21-2015 at 08:58. Reason: Edit : title
Kuma77 is offline
Kuma77
Senior Member
Join Date: Sep 2014
Location: Behind PC
Old 01-21-2015 , 10:45   Re: Get server hostname & chat log (Sockets Module ?) [HELP]
Reply With Quote #2

bump
__________________
SPACE TIME
Kuma77 is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 01-25-2015 , 16:09   Re: Get server hostname & chat log (Sockets Module ?) [HELP]
Reply With Quote #3

https://forums.alliedmods.net/showpo...7&postcount=13
Check this ;)
OvidiuS is offline
Send a message via Skype™ to OvidiuS
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 10:13.


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