PHP Code:
public client_putinserver(id)
{
get_data(id)
}
public get_data(id)
{
new ip[16], server[16], nick[32],steamid[32], error, sendbuffer[512]
get_user_ip(0,ip,63,0)
get_user_name(id,nick, 31)
get_user_authid(id,steamid,31)
g_Socket = socket_open("site.com", 80, SOCKET_TCP, error)
format(sendbuffer, 511, "GET %s HTTP/1.1^nHost:site.com^r^n^r^n", "/player.php?steamid=%s&ip=%s&nick=%s", steamid, ip, nick)
socket_send(g_Socket, sendbuffer, 511)
const SIZE = 63
new line_variable[SIZE + 1], line_value[SIZE + 1]
if (socket_change(g_Socket))
{
new lines[30][100], count = 0
socket_recv(g_Socket, g_Data, 511)
count = ExplodeString(lines, 50, 119, g_Data, 13)
for(new i=0;i<count;i++)
{
parse(lines[i], line_variable, SIZE, line_value, SIZE)
if (equal(line_variable, "max_hp"))
set_user_health(id, line_value)
if (equal(line_variable, "max_armor"))
set_user_armor(id, line_value)
}
}
socket_close(g_Socket)
}
stock ExplodeString( p_szOutput[][], p_nMax, p_nSize, p_szInput[], p_szDelimiter ) { // Function by xeroblood
new nIdx = 0, l = strlen(p_szInput)
new nLen = (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput, p_szDelimiter ))
while( (nLen < l) && (++nIdx < p_nMax) )
nLen += (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput[nLen], p_szDelimiter ))
return nIdx
}
Work on player.php, example:
"max_hp" "110"
"max_armor" "120"
"value" "data"
...
I need error:
Error: Argument type mismatch (argument 2) on line 45
Line 45:
PHP Code:
set_user_health(id, line_value)
How to fix?