AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Why this plug-in not work (#include <sockets_hz>)? (https://forums.alliedmods.net/showthread.php?t=316660)

abdobiskra 06-03-2019 15:38

Why this plug-in not work (#include <sockets_hz>)?
 
I installed it and it runing but it does not work ... i have a Linux system.
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""127.0.0.1"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); 
    } 



redivcram 06-04-2019 08:40

Re: Why this plug-in not work (#include <sockets_hz>)?
 
Post any error that it gives.

Fuck For Fun 06-04-2019 13:37

Re: Why this plug-in not work (#include <sockets_hz>)?
 
What is CODE's operation?

abdobiskra 06-04-2019 15:42

Re: Why this plug-in not work (#include <sockets_hz>)?
 
Quote:

Originally Posted by redivcram (Post 2654305)
Post any error that it gives.

There are no errors I think problem in the port or plugin or perhaps the steam has blocked such communication?
Quote:

Originally Posted by Fuck For Fun (Post 2654342)
What is CODE's operation?

Quote:

Originally Posted by hackziner
Sum up:
This plugin allows to chat with players of other servers.


HamletEagle 06-04-2019 16:34

Re: Why this plug-in not work (#include <sockets_hz>)?
 
Check if the socket is opened successfully.

abdobiskra 06-05-2019 07:17

Re: Why this plug-in not work (#include <sockets_hz>)?
 
Quote:

Originally Posted by HamletEagle (Post 2654372)
Check if the socket is opened successfully.

Yes it is.
It works now I forgot to install socket in the receiving server.
Thx guys!


All times are GMT -4. The time now is 17:31.

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