Trying to get the HLTV working, I checked the code....
I discovered that the code is using cvars to get HLTV Ip and Port ... and is not really detecting it form the status command ...
see below :
public hltv_rcon_cmd(cmd[], id)
{
if (HLTV_id == 0) {
client_print(id, print_console, "* No HLTV currently connected to the server")
}
else
{
new hltv_address = 0
new error
new hltv_cvar_ip[15]
new hltv_cvar_port
new hltv_cvar_rcon[20]
new rconid[13]
new rcv[256],snd[256]
// hltv ip/port/password
get_cvar_string("nxn_hltv_ip",hltv_cvar_ip,15 )
hltv_cvar_port = get_cvar_num("nxn_hltv_port")
get_cvar_string("nxn_hltv_rcon",hltv_cvar_rco n,20)
// Connect to HLTV Proxy
hltv_address = socket_open(hltv_cvar_ip, hltv_cvar_port, SOCKET_UDP, error)
if (error != 0)
{
client_print(id, print_console, "HLTV Proxy Connection Failed - error %i", error)
return PLUGIN_CONTINUE
}
//send challenge rcon and receive response
setc(snd,4,0xff)
copy(snd[4],255,"challenge rcon")
setc(snd[18],1,'^n')
socket_send(hltv_address,snd,255)
socket_recv(hltv_address,rcv,255)
// get hltv rcon challenge number from response
copy(rconid,12,rcv[19])
replace(rconid,255,"^n","")
// send rcon command and close socket
setc(snd,255,0x00)
setc(snd,4,0xff)
format(snd[4],255,"rcon %s ^"%s^" %s^n",rconid,hltv_cvar_rcon,cmd)
socket_send(hltv_address,snd,255)
socket_close(hltv_address)
}
return PLUGIN_CONTINUE
}
wouldn't it be better to do like this?
(Not tested yet.) (especially the code to get the port of the HLTV)
|