PHP Code:
new buf[] = "127.0.0.1"
new buf2[sizeof buf]
new pos = -1
for(new i = sizeof buf - 2 ; i>= 0; i--)
{
if (buf[i] == '.')
{
pos = i;
break;
}
}
if(pos != -1)
{
copy(buf2,pos + 1,buf)
}
server_print("Buf2 = ^"%s^"^n",buf2)
Try this. I didn't tested it yet. I'm gonna test it in some minutes
Edit: I tested it. It prints:
Buf2 = "127.0.0."
I think that's what you want. If you want it to print Buf2 = "127.0.0", change the "pos + 1" given to
copy() by "pos"
__________________