[HELP]Help with a command to save ip
#1

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
Reply
#2

Use GetPlayerIp and store the value in a file.
Reply
#3

can i get an example and at what location should i put it? under onplayerconnect?
Reply
#4

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;
}
Reply
#5

can i use them both in my script?
Reply
#6

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);
}
Reply
#7

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]
Reply
#8

By ID is more easy for this case, because you've access for the data for the Player ID more easily than by IP.
Reply
#9

and now can u gimme /aka command according to the player id system u gave
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)