[HELP]Save ip - 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: [HELP]Save ip (
/showthread.php?tid=209857)
[HELP]Save ip -
gabrissxxx - 11.01.2011
Hi guys. I would ask if you can create a system to save the ip of the player. Who is kind enough to post?
Thank guys.
Re: [HELP]Save ip -
Rizard - 11.01.2011
https://sampwiki.blast.hk/wiki/GetPlayerIp
use dubd or something to put it in a file
Re: [HELP]Save ip -
gabrissxxx - 11.01.2011
![Cheesy](images/smilies/biggrin.png)
Thank
Re: [HELP]Save ip -
XCarBOn - 11.01.2011
Tutorial for a Register/Login system wich save player statistics. In the tutorial you learn how to save some things in a text file..
https://sampforum.blast.hk/showthread.php?tid=163746
Re: [HELP]Save ip -
gabrissxxx - 11.01.2011
I do not understand you. I wish the ip you saved in my pc, in a IPlog.
Show me a guide. Goodbye
Re: [HELP]Save ip -
gabrissxxx - 11.01.2011
Carbon, thanks for your work but I would like it without the registration system
Re: [HELP]Save ip -
XCarBOn - 11.01.2011
pawn Код:
public OnPlayerConnect(playerid)
{
new string[256], pname[MAX_PLAYER_NAME], IP[16];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "/User IPs/IP_%s.ini", pname);
dini_Create(string);
dini_Set(string, "UserIP", GetPlayerIP(playerid, IP, sizeof(IP)));
return 1;
}
Just easy: When a player connect his IP will be saved in Your_GTA_Folder/scriptfiles/User IPs as "IP_*username*.ini". When you open the .ini file you see: UserIP *IP of the User*..
I don't tested it. Hope it'll work.
Re: [HELP]Save ip -
DeathOnaStick - 11.01.2011
Quote:
Originally Posted by gabrissxxx
Carbon, thanks for your work but I would like it without the registration system
|
The tutorial shows you how to store variables in a file. Due to the fact that the IP also is a variable, you can just replace the values that are needed in a registration with the IP.
But because you just want to save an IP into one file, I would furthermore suggest the file-functions fopen, and fwrite. If you ask yourself which mode you should chose for fwrite, in my opinion IO_APPEND would make sense in this case.
Re: [HELP]Save ip -
gabrissxxx - 11.01.2011
1 Error and 2 warning:
Код:
C:\Users\Gabri\Desktop\[IWG]\gamemodes\Gamemode[IWG].pwn(403) : warning 202: number of arguments does not match definition
C:\Users\Gabri\Desktop\[IWG]\gamemodes\Gamemode[IWG].pwn(403) : warning 202: number of arguments does not match definition
C:\Users\Gabri\Desktop\[IWG]\gamemodes\Gamemode[IWG].pwn(403) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
PHP код:
dini_Create(string);
dini_Set(string, "UserIP", GetPlayerIp(playerid));
Re: [HELP]Save ip -
HyperZ - 11.01.2011
Quote:
Originally Posted by gabrissxxx
1 Error and 2 warning:
Код:
C:\Users\Gabri\Desktop\[IWG]\gamemodes\Gamemode[IWG].pwn(403) : warning 202: number of arguments does not match definition
C:\Users\Gabri\Desktop\[IWG]\gamemodes\Gamemode[IWG].pwn(403) : warning 202: number of arguments does not match definition
C:\Users\Gabri\Desktop\[IWG]\gamemodes\Gamemode[IWG].pwn(403) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
PHP код:
dini_Create(string);
dini_Set(string, "UserIP", GetPlayerIp(playerid));
|
pawn Код:
public OnPlayerConnect(playerid)
{
new string[256], pname[MAX_PLAYER_NAME], IP[16];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "/User IPs/IP_%s.ini", pname);
GetPlayerIp(playerid, IP, sizeof(IP));
dini_Set(string, "UserIP", IP);
dini_Create(string);
return 1;
}