;* Socket Chat * ;* If 2 persons have this script, they can talk using sockets * ;* Note: One of the person need to by the server, the server need to type ; /achat and them client need to type: /schat * alias achat if ($1) { socklisten achat $$1 | echo -s Now listenning port $1 for connection } ;this listen a port that you specify, this for server alias schat if ($2) { sockopen schat $$1 $$2 | echo -s Now trying to connect to $1 Port: $2 } ;this open a socket to a host/ip of server with the server port ;this is used for client on *:socklisten:achat: { ;this listenning the socket achat for connections, if a connection happen, the connection ;will be accepted. This only triggered on server sockaccept schat sockclose $sockname ;this close the sockname because no more connections are accepted and accept schat window -ne @Schat ;open a mIRC window with editbox to input and recieving data echo $colour(info) @Schat Connected } on *:sockopen:schat: { ;this is triggered only by the client if ($sockerr) { echo -s Unable to connect, check if host/ip and port are correct | return } ;check if error happen else { window -ne @Schat | echo $colour(info) @Schat Connected } } ;* Now the rest of events are for server and client * on *:sockclose:schat: { echo $colour(info) @Schat Disconnected ;this is triggered when other part close the connection } on *:sockread:schat: { sockread %schat echo @schat %schat unset %schat } on *:input:@schat: { if ($sock(schat)) { sockwrite -n schat ( $+ $me $+ ) $1- | echo @schat ( $+ $me $+ ) $1- } ;when you input something on @schat if schat socket is $true you will sockwrite to the socket halt } on *:close:@schat: { if ($sock(schat)) { sockclose schat echo -s Closed Schat } }