Making a script (need help by regging)
 

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

Making a script (need help by regging)

Started by b_w_johan, 18 March, 2004, 13:58:09

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

b_w_johan

heeya all,

im makin my own script like you have read by
(making a script like robocop)

but i have a kind of problem/question...

on the moment i have this part..

-- created by johan at 13th of march 2k4
-- script is called Guard.lua
-- version 0.0.0.1 alpha
-- totally restarted at : 18th march


botname = "guard"            --botname
   function Main()
   frmHub:RegBot(botname)
end

-- user reggen

function DataArrival(curUser,s)
   local s,e, cmd,arg,arg2 = strfind(s,"%s+(%S+)%s+(%S+)%s+(.+)|")
   if cmd == "!add" and curUser.bOperator then
      AddRegUser(arg,arg2,3)
      SendToAll(botname,"deze persoon heeft u reg status gegeven: "..curUser.sName.." hopelijk bent u blij met deze status en komt u vaker terug; "..arg)
      return 1
   elseif cmd == "!addop" and curUser.bOperator then
      AddRegUser(arg,arg2,1)
      SendToAll(botname,"Deze persoon heeft u opstatus gegeven "..curUser.sName.." u kunt nu ook mensen reggen "..arg.." maar overleg eerst met de MASTER!")
      return 1
   elseif cmd == "!addmaster" and curUser.sName == "Johan" then
      AddRegUser(arg,arg2,0)
      SendToAll(bot,"Deze person "..curUser.sName.." heeft  "..arg.." medeowner gemaakt")
      return 1
--   elesif cmd == "!delreg" and curUser.bOperator then
--      DelRegUser(arg,arg2,3)
--      Send:UserPM(bot,"deze persoon"..curUser.sName.." heeft "..arg.."verwijdert van zijn status")
--      return 1
   end
end




by the part below i have put -- sign's so if you copy and use this script... don't remove them there is a error in that part... so in that part there comes my question how can i delete a registered person (and i want this only by done by Me or an master...)

(i now the messages a pers get are in dutch but i didn't want to translate it because its a dutch script...)


and another problem i need a script in wich you will see wich persons are regged and with wich passwords

Don't say use robocop ore something like that because i wan't to make a better thing then robocop..

Greetings,
Johan

thnx for all help i will get already.
 :P
checkout http://wwhublist.com/index.php for my World Wide HubList project!


Cyberia

hihi,
then you have a long, very long way to go m8
good luck  :D

b_w_johan

hmm.. very funny,
i do have a long way to go to replace robocop i now..
but i thought this was request fore scripts not a part of the forum where you can demolish new idea's ...

but if you thuoght this is the only part of my script.. its not.. its the begiinig part of my script wich i used before i started all over.. bt i still need help with deleting a reg and seeing wich users are regd..

greetings,
Johan :P
checkout http://wwhublist.com/index.php for my World Wide HubList project!

plop

QuoteOriginally posted by b_w_johan and another problem i need a script in wich you will see wich persons are regged and with wich passwords
this can cause a big securety leak, if the password of 1 of your op's leak out it has the result that all passwords can leak out.
not a wise thing 2 add.

and indeed you got some more lines 2 code before you can reach the level of robocop.
but i would be the last 2 stop you from trying, good luck and many happy coding hours/month's.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

b_w_johan

ok and is there not an option to ad an aditional password before you could use this command??
and What would you suggest i have to add in this script ??

greetings,
Johan (who will be scripting on thisa thing many years from now =-)) )
checkout http://wwhublist.com/index.php for my World Wide HubList project!

NightLitch

here some part you may want:

--=*=*=*=*=*=*=*=*=*=*=--
--  Password Bot 0.1   --
-- By NightLitch 2003  --
--                     --
-- !getpass      --
--                     --
--=*=*=*=*=*=*=*=*=*=*=--

BOTNAME = "-P-Bot-"
PREFIX = "*"

REGFILE = ("../RegisteredUsers.dat")
REGGEDUSERS = {}

function Main()
	frmHub:RegBot(BOTNAME)
end

function DataArrival(curUser,data)
	if( strsub(data, 1, 1) == "<" ) then
		data=strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind( data, "%b<>%s+(%S+)" )
		if (curUser.iProfile==GetProfileIdx("SU+")) then 
			if (cmd == PREFIX.."getpass" ) then
				ShowPasses(curUser,data)
				return 1
			end
		else
			curUser:SendData(BOTNAME,"*** You don't have the sufficient rights to run this command...")
			return 1
		end
	end
end

function ShowPasses(curUser,data)
	local _,_,cmd,nick = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
	if (nick == nil or nick == "") then 
		curUser:SendData(BOTNAME,"Syntax: !getpass  ")
		return 1
	end
	if nick then
		local ViewOne = ""
		curUser:SendData(BOTNAME,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
		LoadRegistredFile(REGGEDUSERS,REGFILE)
		for sNICK,sPASS in REGGEDUSERS do
			if strlower(nick) == strlower(sNICK) then
				curUser:SendData(BOTNAME,"Nick:"..nick)
				curUser:SendData(BOTNAME,"Password: "..sPASS)
				ViewOne = 1
			end
		end
		if ViewOne == "" then
			curUser:SendData(BOTNAME,"Searching:\r\nNick:"..nick.."\r\nPassword: Not Found")
		end
		curUser:SendData(BOTNAME,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
	end
end

function LoadRegistredFile(table,file)
	local handle = openfile(file, "r")
	if (handle) then
    		local line = read(handle)
    		while line do
			s,e,nick,password,status = strfind( line, "(%S+)|(%S+)|(%S+)")
			table[nick] = password
			line = read(handle)
    		end
  		closefile(handle)
	end
end
-- By: NightLitch

/NL
//NL

NightLitch

and your delreg's:

hope you manage to get this working:

-------------------------------------------------------------------------------------------------------------
function doGetReguserLevel(username)
	if not username then username = "" end
	local allprofiles = GetProfiles()
	local index, profile, index2, user
	for index, profile in allprofiles do
		local users = GetUsersByProfile(profile)
		for index2, user in users do
			if strlower(user) == strlower(username) then
				return GetProfileIdx(profile)
			end
		end
	end
	return -1
end -- Thanks to Skrollster for this part :)
-------------------------------------------------------------------------------------------------------------
-- Delete Registrered User --
function dodeluser(curUser,data)
	s,e,arg = strfind( data, "%b<>%s+%S+%s+(.+)" )
	if arg == nil or arg == "" then
		curUser:SendTo(BotName,CmdErrorMsg.." "..Prefix.."deluser :"..CmdErrorPar)
		return 1
	end
	usr = 0
	go = 0
	user = GetItemByName(arg)
	iUserLevel = doGetReguserLevel(arg)
	if iUserLevel then
		usr = 1
		-- MSR --
		if iUserLevel == 0 and (curUser.iProfile) == MSR.Lvl and (curUser.sName) == HubOwner or (curUser.sName) == Scripter then
			go = 99
		-- OPR --
		elseif iUserLevel == 1 and (curUser.iProfile) == MSR.Lvl or (curUser.iProfile) == MOD.Lvl then
			go = 1
		-- VIP --
		elseif (curUser.iProfile) == MSR.Lvl or (curUser.iProfile) == MOD.Lvl or (curUser.iProfile) == OPR.Lvl and iUserLevel == 2 then
			go = 2
		-- REG --
		elseif (curUser.iProfile) == MSR.Lvl or (curUser.iProfile) == MOD.Lvl or (curUser.iProfile) == OPR.Lvl and iUserLevel == 3 then
			go = 3
		-- MOD --
		elseif iUserLevel == 4 and (curUser.iProfile) == MSR.Lvl then
			go = 4
		elseif iUserLevel == 5 and (curUser.iProfile) == MSR.Lvl and (curUser.sName) == HubOwner or (curUser.sName) == Scripter then
			go = 5
		end
	end
	if usr == 1 and go == 99 then
		DelRegUser(arg)
		lang = "Revoked "..MSR.Name.." status for:"
		curUser:SendTo(BotName, " "..lang.." "..arg)
		lang = "just revoked "..MSR.Name.." status from:"
		lang2 = "(OP's eyes only!!!)"
		SendToOps(BotName, curUser.sName.." "..lang.." "..arg.." "..lang2)
		if user ~= nil then
			lang = "You have just lost all your privileges!!!"
			user:SendPM(BotName, " "..lang)
		end
	elseif usr == 1 and go == 1 then
		DelRegUser(arg)
		lang = "Revoked "..OPR.Name.." status for:"
		curUser:SendTo(BotName, " "..lang.." "..arg)
		lang = "just revoked "..OPR.Name.." status from:"
		lang2 = "(OP's eyes only!!!)"
		SendToOps(BotName, curUser.sName.." "..lang.." "..arg.." "..lang2)
		if user ~= nil then
			lang = "You have just lost all your privileges!!!"
			user:SendPM(BotName, " "..lang)
		end
	elseif usr == 1 and go == 2 then
		DelRegUser(arg)
		lang = "Revoked "..VIP.Name.." status for:"
		curUser:SendTo(BotName, " "..lang.." "..arg)
		lang = "just revoked "..VIP.Name.." status from:"
		lang2 = "(OP's eyes only!!!)"
		SendToOps(BotName, curUser.sName.." "..lang.." "..arg.." "..lang2)
		if user ~= nil then
			lang = "You have just lost all your privileges!!!"
			user:SendPM(BotName, " "..lang)
		end
	elseif usr == 1 and go == 3 then
		DelRegUser(arg)
		lang = "Revoked "..REG.Name.." status for:"
		curUser:SendTo(BotName, " "..lang.." "..arg)
		lang = "just revoked "..REG.Name.." status from:"
		lang2 = "(OP's eyes only!!!)"
		SendToOps(BotName, curUser.sName.." "..lang.." "..arg.." "..lang2)
		if user ~= nil then
			lang = "You have just lost all your privileges!!!"
			user:SendPM(BotName, " "..lang)
		end
	elseif usr == 1 and go == 4 then
		DelRegUser(arg)
		lang = "Revoked "..MOD.Name.." status for:"
		curUser:SendTo(BotName, " "..lang.." "..arg)
		lang = "just revoked "..MOD.Name.." status from:"
		lang2 = "(OP's eyes only!!!)"
		SendToOps(BotName, curUser.sName.." "..lang.." "..arg.." "..lang2)
		if user ~= nil then
			lang = "You have just lost all your privileges!!!"
			user:SendPM(BotName, " "..lang)
		end
	elseif usr == 1 and go == 5 then
		DelRegUser(arg)
		lang = "Revoked "..BT.Name.." status for:"
		curUser:SendTo(BotName, " "..lang.." "..arg)
		lang = "just revoked "..BT.Name.." status from:"
		lang2 = "(OP's eyes only!!!)"
		SendToOps(BotName, curUser.sName.." "..lang.." "..arg.." "..lang2)
		if user ~= nil then
			lang = "You have just lost all your privileges!!!"
			user:SendPM(BotName, " "..lang)
		end
	elseif usr == 0 then
		lang = "You can't delete a user that does not exist. The nick you entered is NOT registered."
		SendPmToNick(curUser.sName, BotName, lang)
	elseif usr == 1 and go == 0 then
		lang = "You can NOT delete a user who has the same rank as you or higher."
		curUser:SendTo(BotName, " "..lang)
	end
end

/NL
//NL

plop

QuoteOriginally posted by b_w_johan
ok and is there not an option to ad an aditional password before you could use this command??

greetings,
Johan (who will be scripting on thisa thing many years from now =-)) )
well i vote securety above all, the hub owner can look it up on the console if needed.
if i get a question like that from a user telling me he forgot/lost his password i check his ip, and if they match i delete the account.
simple and safe.

for things 2 add 2 your script, just check the options other scripts have.
i do the same (well mostly it's odin who comes up with the new idea's), just i only use the idea not the code. lol

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk