All IP's save same - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: All IP's save same (
/showthread.php?tid=90383)
All IP's save same -
CJ101 - 07.08.2009
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); }
Re: All IP's save same -
Hecky - 07.08.2009
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.
Re: All IP's save same -
ruarai - 08.08.2009
Is that on OnPlayerDisconnect?
Re: All IP's save same -
snoob - 08.08.2009
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);
Re: All IP's save same -
ruarai - 08.08.2009
that wouldn't work
Re: All IP's save same -
pagie1111 - 08.08.2009
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
Re: All IP's save same -
JaTochNietDan - 08.08.2009
From experience this can have alot of issues when using it in OnPlayerDisconnect. It seems to return that 255.255.255.255 IP alot.
Re: All IP's save same -
ruarai - 08.08.2009
well doing anything to do with getting something from the player on the OnPlayerDisconnect callback wont work
Re: All IP's save same -
saiberfun - 08.08.2009
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
^^
Re: All IP's save same -
Dj_maryo1993 - 08.08.2009
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