Help with ip script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Help with ip script

Started by Creative, 18 August, 2007, 17:49:23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Creative

Hello guys,
               I want some help in ip script. Actually when a user logins with a nick and if he changes his nick style,
for example if i login with nick "CREATIVE" then it saves the ip but if i login with nick "creative" and if i change my ip again, then it still shows the old ip. I want a to modify the script so that it stores the latest ip in the table even if the nick style is changed.

--User Settings----------------------------------------------------------------------------------------------------------------
--
--//-- Botname pulled from the hub
Bot = frmHub:GetHubBotName()
Prefix = "+"				-- Command Prefix
IpCmd = "ip"			-- Get IP User Command
IpMenu = Ip			-- Menu name pulled form hub, uses hub name for menu
SubMenu0 ="IP Log"		-- Custom submenu
IPFile="IPLog.dat"
--//--Set your profiles here.
--profile_idx, Commands/Menus enabled [0=no 1=yes], "Profile Name"
IpProfiles = {
[-1] = {1,"Unregistered User"},
[0] = {1,"Master"},
[1] = {1,"Operator"},
[2] = {1,"Vip"},
[3] = {1,"Registered User"},
[4] = {1,"Moderator"},
[5] = {1,"NetFounder"},
}
--
--End User Settings-------------------------------------------------------------------------------------------------------------

function Main()
	if loadfile(IPFile) ~= nil then
		dofile(IPFile)
	else
		IPLog ={}
		Save_File(IPFile,IPLog,"IPLog")
	end
end

function OnExit()
Save_File(IPFile,IPLog,"IPLog")
end

function NewUserConnected(user, data)
        local sClock = os.date("%I:%M:%S %p") 
	local timein=os.date("%A , %B %d %Y").." at "..sClock
	IPLog[user.sName]={
                           ["sIP"] = user.sIP,
                           ["sLastSeen"] =timein}
	Save_File(IPFile,IPLog,"IPLog")
	if IpProfiles[user.iProfile][1] == 1 then
		Commands(user)
		
	end
end

OpConnected = NewUserConnected

UserDisconnected = function (user)
local sClock = os.date("%I:%M:%S %p") 
	local timein=os.date("%A , %B %d %Y").." at "..sClock
	IPLog[user.sName]={
                           ["sIP"] = user.sIP,
                           ["sLastSeen"] =timein}
	Save_File(IPFile,IPLog,"IPLog")
end

OpDisconnected = UserDisconnected

function ChatArrival(user, data)
	local s,e,pre,cmd = string.find(data, "%b<>%s+(%p)(%S+)")
	local s,e,addy = string.find(data, "%s(%d+%.%d+%.%d+%.%d+)|$")
	local s,e,nick = string.find(data, "%s(%S+)|$")
	if IpProfiles[user.iProfile][1] == 1 then
				if pre and pre==Prefix then
					if (string.lower(cmd)==IpCmd) then



						if nick and nick ~= addy then



							for i,v in pairs(IPLog) do
								--if string.lower(i) == string.lower(nick) then
                                                                if string.find(string.lower(i),string.lower(nick),1,1)then
for i,v in pairs(frmHub:GetOnlineUsers()) do

				v:SendData(user.sName, pre..cmd.." "..nick)
			end

									local reply2="Nick:- "..i.." \t "..
									"IP Address:-"..v.sIP.."  "
									user:SendData(Bot,reply2)
									return 1

								end

							end
							
						end
						
							
						
							
                                                              for i,v in pairs(IPLog) do
								if v.sIP==addy then
for i,v in pairs(frmHub:GetOnlineUsers()) do

				v:SendData(user.sName, pre..cmd.." "..addy)
			end
									local reply1="Nick:- "..i.." \t "..
									"IP Address:-"..v.sIP.."  "
									user:SendData(Bot,reply1)
									return 1
								
							



end

end
							
						
					elseif (pre==Prefix) and (cmd==IpCmd) and not addy then
							user:SendData(Bot,"\r\n\r\n\tSyntax Error, Syntax = "..Prefix..IpCmd.." <IP or Nick>\r\n")
					
					end
				end
	end


if IpProfiles[user.iProfile][1] == 1 then
				if pre and pre==Prefix then
					if (string.lower(cmd)=="lastseen") then
						if nick and nick ~= addy then

							for i,v in pairs(IPLog) do
								if string.lower(i) == string.lower(nick) then
for i,v in pairs(frmHub:GetOnlineUsers()) do

				v:SendData(user.sName, pre..cmd.." "..nick)
			end
                                                                local status = v.sLastSeen
if GetItemByName(i) then
 

									local reply2=""..i.." is currently online"					
user:SendData(Bot,reply2)
return 1
else

local reply2=""..i.." was last seen on "..status..""							
		user:SendData(Bot,reply2)
									return 1

end								
end
							end
							
						end
						
							
						
							
                                                              
							
						
					end
				end
	end





end



Save_Serialize = function(tTable, sTableName, hFile, sTab)
	sTab = sTab or "";
	hFile:write(sTab..sTableName.." = {\n" );
	for key, value in pairs(tTable) do
		local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
		if(type(value) == "table") then
			Save_Serialize(value, sKey, hFile, sTab.."\t");
		else
			local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
			hFile:write( sTab.."\t"..sKey.." = "..sValue);
		end
		hFile:write( ",\n");
	end
	hFile:write( sTab.."}");
end

Save_File = function(file,table , tablename )
	local hFile = io.open (file , "w")
	Save_Serialize(table, tablename, hFile);
	hFile:close()
end

Creative

Sorry sir, but again this time my friend gave me this script, he wanted some changes to be done........... anyways, i hope that u help me in this  :-\

Josecar

I don't know Mutor's script (maybe with the name), but the main idea in one of mine is charging ip's of users in an array (subarray), inserting the last used in first place. The size of the array configurable, 10 or more, and discarding the last one when it oversizes. Then you can make commands for searching, show it in getinfos, accurate rangebans, etc.  In actual times...


CrazyGuy

I will second this motion to have it added to the rules and a punishment on violation.
Credit to who deserves it. As Mutor indicated already, ALL scripts are freeware which means you can use em without any costs/trouble and they can all be found here on the board. Over half of all the scripts here are created on request without the actual scripter even using it/having interrest in it. The least one can do in return is to give credit to the creator(s).

Yahoo

i will also second it
all scripter put there efforts to satisfy our (users) request and some people remove the credits. its not at all fair common guys grow up let the scripter atleast get the credit for the script as they do not charge us for there hardword they are just asking for credits


"BoRN FIGhTEr"

SMF spam blocked by CleanTalk