I know, this is not maybe question exactly connected with AMX, but I don't know where somebody could help me with these problem.
I am trying to re-programme HLTV control from AMX to PHP.
I used this AMX code to control HLTV which I found in this forum and It functioned when I tryed it on server with amxmodx :
(this code connects cs server to hltv and it sends to hltv information about serverpassword)
PHP Code:
new snd[256]
new serverpass[50]
get_cvar_string("sv_password",serverpass,49)
setc(snd,4,0xff)
copy(snd[4],255,"challenge rcon")
setc(snd[18],1,'^n')
socket_send(socket,snd,255)
socket_recv(socket,rcv,255)
copy(rconid,12,rcv[19])
replace(rconid,255,"^n","")
new rconPass[32]="HLTVrcon"
setc(snd,255,0x00)
setc(snd,4,0xff)
format(snd[4],255,"rcon %s %s serverpassword ^"%s^"^n",rconid,rconPass,serverpass)
socket_send(socket,snd,255)
socket_close(socket)
Now I am trying to implement it to PHP:
PHP Code:
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_connect($socket, '127.0.0.1', '27020');
$msg = "challenge rcon\n";
$len = strlen($msg);
socket_sendto($socket, $msg, $len, 0, '127.0.0.1', 27020);
socket_recvfrom($socket, $buf, 255, 0, '127.0.0.1', '27020');
.
.
.
...and here I ended with problems...
I am sure, that my code isn't right, because I don't know
what means amx command setc (yes I read funcwiki, but I can't understand it)
As you can see, I am not skilled about SOCKETS.
Can somebody help me with re-programing these amx commands to php commands. Or If someone have tutorial/webpage when I can find some useful informations, how to control HLTV via PHP.
Thnx.