PHP Code:
new bothost,botcmd[2049];
public socket_init()
{
new ip[64],port,erre,user[32],pass[100]
new cmd[300];
get_cvar_string("cm_bot_host",ip,63)
port = get_cvar_num("cm_bot_port")
get_cvar_string("cm_bot_user",user,31)
get_cvar_string("cm_vot_pass",pass,99)
bothost = socket_open(ip,port,SOCKET_TCP,erre)
if (erre == 0) {
remove_task( RETRY );
server_print("Socket Reopened");
}
format(cmd,299,"USER asd^r^nPASS asd^r^n")
socket_send(bothost,cmd,512)
new params[ 1 ];
params[ 0 ] = bothost;
set_task( 0.5 , "socket_read" , TASK_RECV , params , sizeof( params ) , "b" );
}
new socket_status[50]
public socket_read(botcmd[])
{
if ( socket_change( bothost ) )
{
socket_recv(bothost,botcmd,2048)
if (equal(botcmd,"")) {
server_print("[Network] Connection with Bot has been lost");
new params[9];
params[1] = RETRY;
set_task( 0.25 , "socket_init" , RETRY , params , sizeof( params ) , "b" );
remove_task( TASK_RECV );
}
...
Post Changed

Well i am getting a live streaming connection between the server and my bot with this script... but when i am closing the Bot, and the pawn script is trying to reenstablish connection it freezes for a while.. why that? i am closing the "retry" task when the server is connecting
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))