08.12.2014, 10:52
(
Последний раз редактировалось RedFusion; 08.12.2014 в 20:54.
)
I just made this IP String to IP Bytes Function with this string library.
Example Usage:
pawn Код:
GetIPBytes(const ip_input[], ip_output[])
{
new octet_string[4][4],
octet_count = strexplode(octet_string, ip_input, ".");
for(new i; i < octet_count; i ++)
ip_output{i} = strval(octet_string[i]);
return octet_count;
}
pawn Код:
#include <a_samp>
#include <strlib>
new bool: g_PlayerAdmin [MAX_PLAYERS char];
public OnPlayerConnect(playerid)
{
new ip_string[16],
ip_bytes[4 char];
GetPlayerIp(playerid, ip_string, sizeof ip_string);
GetIPBytes(ip_string, ip_bytes);
g_PlayerAdmin{playerid} = (ip_bytes{0} == 127 && ip_bytes{1} == 0 && ip_bytes{2} == 0 && ip_bytes{3} == 1) ? (true) : (false);
}