All IP's save same
#1

In my login script, i have everyones ip to save.. however it ends up saving as 255.255.255.255 for all. Here's code:

Код:
new ip[90];
GetPlayerIp(playerid,ip,90);
format(file, sizeof file, "IP: %s\n",ip);
{	fwrite(account, file); }
Reply
#2

Quote:
Originally Posted by cj101
In my login script, i have everyones ip to save.. however it ends up saving as 255.255.255.255 for all. Here's code:

Код:
new ip[90];
GetPlayerIp(playerid,ip,90);
format(file, sizeof file, "IP: %s\n",ip);
{	fwrite(account, file); }
For a start, you don't need a length of 90. 16 will do.
Reply
#3

Is that on OnPlayerDisconnect?
Reply
#4

Quote:
Originally Posted by cj101
In my login script, i have everyones ip to save.. however it ends up saving as 255.255.255.255 for all. Here's code:

Код:
new ip[90];
GetPlayerIp(playerid,ip,90);
format(file, sizeof file, "IP: %s\n",ip);
{	fwrite(account, file); }
try
Код:
//change this line
format(file, sizeof file, "IP: %s\n",ip);

// for this one
format(file, sizeof(file), "IP: %s\n",ip);
Reply
#5

that wouldn't work
Reply
#6

pawn Код:
new IP[20], string[50];
    GetPlayerIp(playerid,IP,sizeof(IP));
    format(string,sizeof(string),"IP: %s\n",IP);
    new File:ftw=fopen("IPlog.txt", io_write);
    fwrite(ftw,string);
    fclose(ftw);
    return 1;
    }
this is what i use, i know it saves to a .txt but you can change the writing path and what ever you need to use
Reply
#7

From experience this can have alot of issues when using it in OnPlayerDisconnect. It seems to return that 255.255.255.255 IP alot.
Reply
#8

well doing anything to do with getting something from the player on the OnPlayerDisconnect callback wont work
Reply
#9

just make a global vraiable like
new IP[MAX_PLAYERS];

Ontop of ur script
and get the ip onPlayerConnect

then save IP[playerid] OnPlayer Disconnect
^^
Reply
#10

lol , has far has i know , %S is for strings (text) , if i'm correct , he/she need's %d

Quote:
Originally Posted by pagie1111
pawn Код:
new IP[20], string[50];
    GetPlayerIp(playerid,IP,sizeof(IP));
    format(string,sizeof(string),"IP: %s\n",IP);
    new File:ftw=fopen("IPlog.txt", io_write);
    fwrite(ftw,string);
    fclose(ftw);
    return 1;
    }
this is what i use, i know it saves to a .txt but you can change the writing path and what ever you need to use
io_write isn't rewrite the whole IPlog.txt every time ?
io_append i guess that is modify the file
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)