LoginMsg 1.0 L5.1
 

LoginMsg 1.0 L5.1

Started by atonal, 02 June, 2008, 21:17:59

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

atonal

hello
mutor i habe   LoginMsg 1.0 L5.1    and y habe this massage now  i habe  3 mouns thsi scripts and was working well
100%, now tis working 40%  only for unreg, before was for all user, reg.master.vip, ctc
and now when some reg user conect i habe this massage 

S?ntaxis ...DiXBoT v2.0 Build 2781\scripts\LoginMsg 1.0 L5.1.lua:93: attempt to index field '?' (a nil value)

S?ntaxis ...DiXBoT v2.0 Build 2781\scripts\LoginMsg 1.0 L5.1.lua:90: attempt to index field '?' (a nil value)
and i try to:

   [-1] = {true,"Unregistered User.txt"},
   
  • = {false,"Master.txt"},
       [1] = {false,"Operator.txt"},
       [2] = {false,"Vip.txt"},
       [3] = {false,"Registered User.txt"},
       }

       [-1] = {true,"Unregistered User.txt"},
       
  • = {true,"Master.txt"},
       [1] = {true,"Operator.txt"},
       [2] = {true,"Vip.txt"},
       [3] = {true,"Registered User.txt"},
       }






    --[[
    
    	LoginMsg 1.0 LUA 5.1x [Strict][API 2]
    
    	By Mutor	01/01/08
    
    	Sends a message from text file at user login, per profile.
    	- Option to dit message by command
    	- Option for ops to toggle message on/off per user.
    
    ]]
    
    -- Admins nick for status / error messages
    OpNick = "Mutor"
    -- Botname pulled from the hub or use "CustomName"
    local Bot = SetMan.GetString(21)
    -- Set Login Message s, per profile
    -- [#] = {enabled [true/false],"Path/Filename"},
    local Msgs = {
    	[-1] = {true,"Unregistered User.txt"},
    	[0] = {false,"Master.txt"},
    	[1] = {false,"Operator.txt"},
    	[2] = {false,"Vip.txt"},
    	[3] = {false,"Registered User.txt"},
    	}
    local Exclude = {
    	["zMutor"] = true,
    	["OtherNick"] = false,
    }
    
    OnStartup = function()
    	for i,v in pairs(Msgs) do
    		if v[1] then DoMsg(i) end
    	end
    end
    
    OnError = function(msg)
    	local user = Core.GetUser(OpNick)
    	if user and msg:len() then
    		Core.SendToUser(user,"<"..Bot.."> "..msg.."|")
    	end
    end
    
    UserConnected = function(user)
    	if not Exclude[user.sNick] then
    		local x,s = DoMsg(user.iProfile)
    		if x then
    			Core.SendToUser(user,"<"..Bot.."> "..s.."|")
    		end
    	end
    end
    OpConnected,RegConnected = UserConnected,UserConnected
    
    ChatArrival = function(user,data,tab)
    	local t = {
    	msgtoggle = function(user,data,cmd)
    		local p = user.iProfile
    		if Msgs[p][1] or ProfMan.GetProfile(p) and ProfMan.GetProfile(p).tProfilePermissions.bIsOp then
    			local reply = "enabled"
    			if Exclude[user.sNick] then
    				Exclude[user.sNick] = false
    				reply = "disabled"
    			else
    				Exclude[user.sNick] = true
    			end
    			return "Your login message is "..reply.."."
    		end
    	end,
    	editmsg = function(user,data,cmd)
    		local p = user.iProfile
    		if ProfMan.GetProfile(p) and ProfMan.GetProfile(p).tProfilePermissions.bIsOp then
    			local _,_,prf,msg = data:find("%b<> [%p][%a]+ (%d) ([^|])|")
    			if prf and msg then
    				if DoMsg(tonumber(prof)) then
    					return Msgs[tonumber(prof)][2]:gsub("%.[%a]-$","").." has been updated."
    				end
    			end
    		end
    	end,
    	}
    	if tab then return t end
    	local _,_,to = data:find("^$To: (%S+) From:")
    	local _,_,cmd = data:find("%b<> ["..SetMan.GetString(29).."](%w+)")
    	if cmd then
    		cmd = string.lower(cmd)
    		if t[cmd] then
    			return Core.SendToUser(user,"<"..Bot.."> "..t[cmd](user,data,cmd).."|"),true
    		end
    	end
    end
    
    DoMsg = function(prof,set)
    	if Msgs[prof][1] then
    		local f,e = io.open(Msgs[prof][2])
    		if f and not set then
    			local s = f:read("*a") f:close()
    			if s:len() > 0 then
    				return true,s:gsub("|","&#124;")
    			end
    		else
    			f,e = io.open(Msgs[prof][2],"w")
    			if f then
    				local w = "This is "..Msgs[prof][2]:gsub("%.[%a]-$","")..
    				"'s login message.\n"
    				if set then
    					w = set
    				end
    				f:write(w) f:close()
    				return true
    			else
    				OnError(e:sub(1,-2))
    			end
    		end
    	end
    end
    

atonal

Mutor i habe this profiles for Dixbot  :)
-----------------------------------------------------
Owner
  Master
SuperUser
Operator
KVIP
VIP
Reg
------------------------------------------------------
and the scripts have


[-1] = {true,"Unregistered User.txt"},
   
  • = {false,"Master.txt"},
       [1] = {false,"Operator.txt"},
       [2] = {false,"Vip.txt"},
       [3] = {false,"Registered User.txt"},
    -----------------------------------------------

    yuo think is because i have more profile set ? becasue scripts have only 5

    are yuo can ex`lain more easy , please  i nead this scripts

    thanks for yuo big help  ;)

atonal

Thank brother,  dont wokrk for me , is very bad, the scripts was ok now o goint to put away
i try for more then i?one our to try to fix with the profiles i put all profiles in order

and nothin happen

habe good day and thanks for yuo help

Snooze

oh my...

Exchange the profile table with:

local Msgs = {
	[-1] = {true,"Unregistered User.txt"},
   	[0]= {false,"Owner.txt"},
	[1] = {false,"Master.txt"},
   	[2] = {false,"SuperUser.txt"},
   	[3] = {false,"Operator.txt"},
   	[4] = {false,"KVIP.txt"},
   	[5] = {false,"VIP.txt"},
   	[6] = {false,"Reg.txt"},
	}


Remember to edit the true/false part and Textfile name as needed..


/Snooze

atonal

Now the login massage is working 100%  this was good help    i hpe yuo make one for Dixbot

Yor are the best atonal25

Snooze

You're welcome..

I have indeed made this possible in DiXBoT.

The code is finished and it's being tested as we speak:

Commands:

--------------------------------------------------------------------------------
	HUB CONFIG\MOTD:
	--------------------------------------------------------------------------------
	!dxbmotd                 	:View/Set DiXBoT MOTD True/False per Profile.
	!dxbmotdhelp             	:View the DiXBoT MOTD Help
	!dxbmotdpm               	:View/Set DiXBoT MOTD in PM True/False per Profile.
	!dxbmotdset              	:View/Set DiXBoT MOTD Message per Profile.
	!pxmotd                  	:View/Set PtokaX MOTD True/False
	!pxmotdpm                	:View/Set PtokaX MOTD in PM True/False
	!pxmotdset               	:View/Set PtokaX MOTD Message.
	::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Options for DiXBoT MOTDs:

#HUBNAME#	Will be replaced with Hub Name
#HUBADDY#	Will be replaced with Hub Address
#HUBPORT#	Will be replaced with the Default(first) Hub TCP Port
#HUBPORTS#	Will be replaced with ALL Hub TCP Ports
#HUBSHARE#	Will be replaced with the total hub share
#HUBUPTIME#	Will be replaced with the Hub uptime
#HUBUSERS#	Will be replaced with the total usercount

#USERNAME#	Will be replaced with the users Nick
#USERIP#	Will be replaced with the users IP
#USERPROF#	Will be replaced with the users ProfileName
#USERSHARE#	Will be replaced with the users share
#USERMAIL#	Will be replaced with the users Mail
#USERTAG#	Will be replaced with the users Tag
#USERCLIENT#	Will be replaced with the users Client + Client Version
#USERHUBS#	Will be replaced with the users Total Hubcount.
#USERSLOTS#	Will be replaced with the users Total Slotcount.


Thanks,
Snooze

SMF spam blocked by CleanTalk