Raised This Month: $ Target: $400
 0% 

Simple sockets to get server status


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
faki
Senior Member
Join Date: Jul 2013
Old 12-30-2013 , 14:24   Simple sockets to get server status
Reply With Quote #1

Hello i have this:
Code:
stock get_data(host[])
{
new ip[32], port[10], err;
copy(ip,charsmax(ip),host);
copy(port,charsmax(port),"27015");
if(containi(host,":")!=-1)
strtok(host, ip, charsmax(ip), port, charsmax(port), ':');

new sock = socket_open(ip,str_to_num(port),SOCKET_UDP,err);
if(sock<0 || err)
{
server_print("Socket error");
socket_close(sock);
return;
}

new buffer[1500];
copy(buffer,charsmax(buffer),"^xFF^xFF^xFF^xFF^x54Source Engine Query");
socket_send2(sock,buffer,strlen(buffer)+1);

new r = socket_recv(sock,buffer,sizeof(buffer));
socket_close(sock);
if(r<2)
{
server_print("No data");
return;
}

}
but when i use i get:
Code:
test.sma(238) : warning 209: function "get_data" should return a value
test.sma(250) : warning 209: function "get_data" should return a value
test.sma(253) : warning 209: function "get_data" should return a value
I need small code to get server status if is on = 1 if is off = 0.
Thanks.
faki is offline
 



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:14.


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