AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Socket, setc... etc (and PHP) (https://forums.alliedmods.net/showthread.php?t=83381)

4JOKE 01-08-2009 18:25

Socket, setc... etc (and PHP)
 
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_INETSOCK_DGRAMSOL_UDP);
socket_connect($socket'127.0.0.1''27020');
  
$msg "challenge rcon\n";
$len strlen($msg);
socket_sendto($socket$msg$len0'127.0.0.1'27020);
socket_recvfrom($socket$buf2550'127.0.0.1''27020');
.
.
.
...and 
here I ended with problems...
I am surethat my code isn't right, because I don't know
what means amx command setc 
(yes I read funcwikibut 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.


All times are GMT -4. The time now is 09:13.

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