Raised This Month: $ Target: $400
 0% 

Socket, setc... etc (and PHP)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
4JOKE
Member
Join Date: Jan 2008
Old 01-08-2009 , 18:25   Socket, setc... etc (and PHP)
Reply With Quote #1

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.

Last edited by 4JOKE; 01-08-2009 at 18:31.
4JOKE is offline
Reply



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 09:13.


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