[HELP]Help with a command to save ip -
StrikerZ - 09.08.2016
Is there any cmd which saves player's ip in a file/log so that after that i can make /aka cmd which will search ips from that log
Re: [HELP]Help with a command to save ip -
Freaksken - 09.08.2016
Use
GetPlayerIp and store the value in a file.
Re: [HELP]Help with a command to save ip -
StrikerZ - 10.08.2016
can i get an example and at what location should i put it? under onplayerconnect?
Re: [HELP]Help with a command to save ip -
F1N4L - 10.08.2016
This work, but is Ip only.
Код:
//By IP
stock SaveIP(const Ip[])
{
new Str[20], File: FileIp = fopen("SaveIP.txt", io_append);
format(Str, 20, "%s\r\n", Ip);
fwrite(FileIp, Str);
fclose(FileIp);
return true;
}
//By ID
stock SaveIP(playerid)
{
new Str[20], GetIp[16], File: FileIp = fopen("SaveIP.txt", io_append);
GetPlayerIp(playerid, GetIp, 16);
format(Str, 20, "%s\r\n", GetIp);
fwrite(FileIp, Str);
fclose(FileIp);
return true;
}
Re: [HELP]Help with a command to save ip -
StrikerZ - 10.08.2016
can i use them both in my script?
Re: [HELP]Help with a command to save ip -
F1N4L - 10.08.2016
Quote:
Originally Posted by Sunehildeep
can i use them both in my script?
|
Yeah! It's working and just put in GM.
Examples:
By ID (easy):
Код:
public OnPlayerConnect...
{
SaveIP(playerid);
}
Re: [HELP]Help with a command to save ip -
StrikerZ - 10.08.2016
see i want this system cuz i want to save ips of players in a file and then i will make /aka command which will get the ip's of player from that file. So for this the ID one should be good or the IP one? [u posted 2 so tell me the best one for this sytem]
Re: [HELP]Help with a command to save ip -
F1N4L - 10.08.2016
By ID is more easy for this case, because you've access for the data for the Player ID more easily than by IP.
Re: [HELP]Help with a command to save ip -
StrikerZ - 10.08.2016
and now can u gimme /aka command according to the player id system u gave
Re: [HELP]Help with a command to save ip -
F1N4L - 10.08.2016
I make a new form for this system. I haven't tested it.
Код:
//put in onplayerconnect
stock SaveAKA(playerid)
{
new Str[30], GetIp[16], GetName[24], File: FileAKA;
GetPlayerIp(playerid, GetIp, 16);
GetPlayerName(playerid, GetName, 24);
format(Str, 30, "%s.txt", GetIp);
FileAKA = fopen(Str, io_append);
format(Str, 30, "%s\r\n", GetName);
fwrite(FileAKA, Str);
fclose(FileAKA);
return true;
}
//put in a command admin
//showid is your ID for show the names
//playerid is ID of other player
stock GetAKA(showid, playerid)
{
new Str[30], GetIp[16], GetLine[100], File: FileAKA;
GetPlayerIp(playerid, GetIp, 16);
format(Str, 30, "%s.txt", GetIp);
if(!fexist(Str)) return false;
FileAKA = fopen(Str, io_read);
for(new i = 0; i < fread(FileAKA, GetLine); ++ i)
{
SendClientMessage(showid, -1, GetLine);
}
return true;
}