[ayuda] GetPlayerIp...
#3

Puedes utilizar la funcion de JernejL:
pawn Код:
// please note that this is NOT a perfect inet_aton function, but you will not be able to output the number as a unsigned integer as pawn uses signed int32 only.
// (by specification the returned type of inet_aton should be UNSIGNED int 32)
// example conversion failures:
// 127.0.0.1 -> 2130706433
// 128.68.103.132 -> -2143000700

stock inet_aton(ip[]) {
   
    new ipv = strval(ip) << 24, pos = 0;
   
    while (pos < 15 && ip[pos++] != '.') {}
    ipv += strval(ip[pos]) << 16;
    while (pos < 15 && ip[pos++] != '.') {}
    ipv += strval(ip[pos]) << 8;
    while (pos < 15 && ip[pos++] != '.') {}
    ipv += strval(ip[pos]);
   
    return ipv;
}
y comparar con los valores obtenidos para evitar el transpaso y comparacion de strcmp que seria algo diferente y menos optimo.
Reply


Messages In This Thread
[ayuda] GetPlayerIp... - by OTACON - 19.08.2012, 06:08
Respuesta: [ayuda] GetPlayerIp... - by Bu11Sh0t - 19.08.2012, 17:26
Respuesta: [ayuda] GetPlayerIp... - by TheChaoz - 19.08.2012, 20:59

Forum Jump:


Users browsing this thread: 1 Guest(s)