Problem with args - Page 2
 

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

Problem with args

Started by nErBoS, 19 October, 2003, 02:10:33

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nErBoS

Problem solved, thanks to Skrollster

if anyone have the same problem just do this ..

where you have this

if (strsub(data, 1, 1) == "<") then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")

put this

if (strsub(data, 1, 1) == "<") then
s,e,cmd = strfind(data,"%b<>%s+(%S+)")

Thanks to all you tryed to help me !!

Best regards, nErBoS

P.S:"Great to have you back Skrollster"
--## nErBoS Spot ##--

Skrollster

No,no,no,no..

DO NOT remove that part from your scripts if you don't know what you are doing..

the reason why you should remove it was that you did already do that erlier in the script!!!

nErBoS

Having a problem again with the commands they are only working with ops the users can?t use then ,

where is my data arraival..

function DataArrival(user, data) 
		if (Slots == "Activo") then
			if strfind(data, "%b<>%s+("..Command..").*|") then
			s, e, nr = strfind(data, "%b<>%s+"..Command.."%s+([0-9]+)")
			if s then nr = tonumber(nr) else nr = 1 end
			doSlots(user, nr) return 1
			end
			if strfind(data, "^%$SR") then 
			slotsOnHub(user, data) 
			end
		end
		if (Slots == "Desactivo") then
			user:SendPM(Bot, "O comando !slots est? desactivado.")
			return 1
		end
if (not user.bOperator) then
		----------------------------------- Anti-Pub -------------------------------------------
		if (AntiPUB == "Activo") then
		if (( strsub(data, 1, 1) == "<" ) or ( strsub(data, 1, 4) == "$To:" )) then 
		for key,a in trigs do
		if( strfind( strlower(data), key) ) then 
		local word = strlower(data), key
		SendToAll(Bot, "O utilizador "..user.sName.." foi desconectado e kickado por publicidade." ) 
		user:SendData(Bot, "Foste desconectado e kickado por publicidade.")
		SendPmToOps(Bot, "O utilizador "..user.sName.." foi desconectado e kickado por publicidade.")
		SendPmToOps(Bot, "O IP do utilizador era "..user.sIP.." .")
		SendPmToOps(Bot, "O utilizador escreveu o seguinte: "..word)
		user:Disconnect() 
		user:TempBan()
		end 
		end 
		end
		end
		if (AntiPUB == "Desactivo") then
		return
		end
		----------------------------------- Bad Files -------------------------------------------
		if (BadFiles == "Activo") then
		if( strsub(data, 1, 3) == "$SR" ) then
		_,_,nick = strfind( data, "\05(%S*)|$" )
		local s = 5 + strlen(user.sName)
		local e = strfind(data, "%d+%s%d+/%d+") - 2
		local path = strsub(data, s, e)
		if( nick == Bot and Kicked[user.sName] == nil ) then 
		Kicked[user.sName] = 1 
		Reason = FindWhat(data)
		if (Reason == "Other files") then return end 
		user:SendData(Bot, "V?ce foi desconectado e banido. Raz?o: "..Reason) 
		user:SendData(Bot, "O file em causa encontra-se em: "..path.. ".") 
		user:SendData(Bot, "Desconectado....") 
		user:Disconnect()
		user:TempBan()
		end
		end
		end
		if(BadFiles == "Desactivo") then
		return
		end
		----------------------------------- Open Extra Slot ------------------------------------------
		if (OES == "Activo") then
			if strfind(user.sMyInfoString,"O:%x+") then 
			user:SendData(Bot, "Settings do DC->Sharing , Open extra slot tem de estar em zero.")
			user:SendData(Bot, "Desconectado...")
			user:Disconnect()
			end
		end
		if (OES == "Desactivo") then
			return
		end
end

if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
	data=strsub(data,1,strlen(data)-1)
	s,e,cmd = strfind(data,"%b<>%s+(%S+)")
		if (cmd=="!help") then 
			if (GetProfileName(user.iProfile) == "Operador" or GetProfileName(user.iProfile) == "Moderador") then
				user:SendPM(Bot, help:utilizadores())
				user:SendPM(Bot, help:operadores())
				return 1
			elseif (GetProfileName(user.iProfile) == "Administrador" or GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede") then
				user:SendPM(Bot, help:utilizadores())
				user:SendPM(Bot, help:operadores())				
				user:SendPM(Bot, help:administradores())
				return 1
			else
				user:SendPM(Bot, help:utilizadores())
				return 1
			end
		elseif (cmd=="!rede") then 
			Readtextfile(user, rede)
			return 1
		elseif (cmd=="!regras") then 
			Readtextfile(user, regras)
			return 1

		elseif (cmd=="!hubinfo") then 
			HubInfo(user,data)
			return 1

		elseif (cmd=="!myip") then 
			user:SendPM(Bot, "O teu IP ? : "..user.sIP.." !")
			return 1


		elseif (cmd=="!ops")then
			msg = "Lista de Operadores:\r\n\r\n"
			for i = 1, getn(opLevels) do
			local tmp = GetUsersByProfile(opLevels[i])
			foreach(tmp, function(id, op)
				if GetItemByName(op) then
					msg=msg.."\t"..op.."\t\tOnline\r\n"
				else
					msg=msg.."\t"..op.." \t\tOffline\r\n"
				end end)
			end
			user:SendPM(Bot, msg)
			return 1
		elseif (cmd=="!time") then
			GetTime()
			user:SendPM(Bot, Date)
			return 1
	elseif user.bOperator then
		if (cmd=="!userinfo") then 
			UserInfo(user, data)
			return 1
		elseif (cmd=="!kickban") then
			KickBan(user,data)
			return 1
		elseif (cmd=="!warn") then
			Warn(user,data)
			return 1
		elseif (cmd=="!disconnect") then
			Disconnect(user,data)
			return 1
		elseif (cmd=="!kick") then
			Kick(user,data)
			return 1
		elseif (cmd=="!redirect") then
			Redirect(user,data)
			return 1
		elseif (cmd=="!mm") then
			_,_,message = strfind( data, "%b<>%s+%S+%s+(.+)" )
			SendPmToAll(Bot, "\r\n\r\n\----------------------------------------[Assunto do Hub]----------------------------------------\r\n\r\n"..message.."\r\n\r\nMensagem enviada por: "..user.sName)
			return 1
		elseif (cmd=="!mmop") then
			_,_,message = strfind( data, "%b<>%s+%S+%s+(.+)" )
			SendPmToOps(Bot, "\r\n\r\n\----------------------------------------[Mensgem para OPs]----------------------------------------\r\n\r\n"..message.."\r\n\r\nMensagem enviada por: "..user.sName)
			return 1
		elseif (cmd=="!clrtempban") then
			ClearTempBan()
			SendPmToOps(Bot, "A lista de ban?s temporarios foi limpa por : " .. user.sName)
			return 1
		elseif (cmd=="!mred") then
			MudarMoradaRedir(user,data)
			return 1
		elseif (cmd=="!mshare") then
			MudarShare(user,data)
			return 1
		elseif (cmd=="!mnome") then
			MudarNomeHub(user,data)
			return 1
		elseif (cmd=="!mdesc") then
			HubDesc(user,data)
			return 1
		elseif (cmd=="!mregmorada") then
			MudarMoradaReg(user,data)
			return 1
		elseif (cmd=="!redtodos") then
			RedirecionarTodos(user,data)
			return 1
		elseif (cmd=="!mmaxusers") then
			MudarMaxUsers(user,data)
			return 1
		elseif (cmd=="!argredtodos") then
			MudarRedAll(user,data)
			return 1
		elseif (cmd=="!argredcheio") then
			MudarRedFull(user,data)
			return 1
		elseif (cmd=="!clrpermban") then
			if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede") then
			SendPmToOps(Bot, "A lista de ban?s permanentes foi limpa por : " .. user.sName)
			return 0
			else
			user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
			end
			return 1
		elseif (cmd=="!restart") then
			if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede") then
			SendPmToOps(Bot, "O Hub vai ser reinicializado por : " .. user.sName)
			return 0
			else
			user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
			end
			return 1
		elseif (cmd=="!restartscripts") then
			if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede") then
			SendPmToOps(Bot, "Os scripts do Hub v?o ser reinicializado por : " .. user.sName)
			return 0
			else
			user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
			end
			return 1
		elseif (cmd=="!gag") then
			local arg = GetArgML(data)
			if arg == nil then 
			user:SendData(Bot, "O utilizador "..arg.." n?o foi encontrado !") 
			else
			local gagged = GetItemByName(arg) 
			gagged:SendPM(Bot, "Foste impedido de falar no Main-Chat !")
			SendPmToOps(Bot, "O utilizador "..gagged.sName.." foi impedido de falar no Main-Chat por "..user.sName.." !")
			end
			return 0
		elseif (cmd=="!ungag") then
			local arg = GetArgML(data)
			if arg == nil then 
			user:SendData(Bot, "O utilizador "..arg.." n?o foi encontrado !") 
			else
			local gagged = GetItemByName(arg) 
			gagged:SendPM(Bot, "J? podes falar de novo no Main-Chat !")
			SendPmToOps(Bot, "O utilizador "..gagged.sName.." foi de novo autorizado a falar no Main-Chat por "..user.sName.." !")
			end
			return 0
		elseif (cmd=="!timeban") then
			TimeBan(user,data)
			return 1
		elseif (cmd=="!ban") then
			Ban(user,data)
			return 1
		elseif (cmd=="!aduser") then
			RegistrarUsers(user, data)
			return 1
		elseif (cmd=="!rmuser") then
			RemoverRegistro(user, data)
			return 1
		elseif (cmd=="!banip") then
			BanIP(user,data)
			return 0
		elseif (cmd=="!unban") then
			UnBan(user, data)
			return 0
		elseif (cmd=="!bloquear") then 
			SendAddGag(user,data) 
			return 1 
		elseif (cmd=="!desbloquear") then 
			SendDelGag(user,data) 
			return 1 
		elseif (cmd=="!bloqueados") then 
			SendGetGag(user,data) 
			return 1 
		elseif (cmd=="!banlist") then
			Readtextfile(user, Banlist)
			return 1
		elseif (cmd=="!rmban") then
			RemoveBan(user, data)
			return 1
		elseif (cmd=="!rmkick") then
			RemoveKick(user, data)
			return 1
		elseif (cmd=="!kicklist") then
			Readtextfile(user, Kicklist)
			return 1
		elseif (cmd=="!lmbanlist") then
			LimparBan(user, data)
			return 1
		elseif (cmd=="!lmkicklist") then
			LimparKicks(user, data)
			return 1
		end
	end
end
		----------------------------------- Client Kick -------------------------------------------
		if strsub(data,1,6) == "$Kick " then
			return 1
		end
		if strfind(data,"is kicking") then
			local _,_, kicker,name,reason = strfind(data,"<%S+>%s(%S*)%sis kicking%s(%S*)%sbecause:%s(.*)")
			local userToBeKicked = GetItemByName(name)
			local operador = GetItemByName(kicker)
			SendToAll(Bot, "O utilizador "..userToBeKicked.sName.." foi kickado por "..operador.sName.." porque: "..reason)
			userToBeKicked:SendPM(Bot, "Foste kickado por "..operador.sName.." porque: "..reason)
			appendto(Kicklist) 
			write("\r\n"..userToBeKicked.sName.."\t"..userToBeKicked.sIP.."\t"..operador.sName.."\t"..reason.."\t"..GetTime()) 
			writeto() 
			userToBeKicked:TempBan()
			return 1
		end
		if strfind(data,"You are being kicked because:") then
			return 1
		end
		----------------------------------- Gag Downloads -------------------------------------------
		if strsub(data,1,12) == "$ConnectToMe" then 
         	local _,_, From,ToIp = strfind(data,"$ConnectToMe%s+(%S+)%s+(%d+.%d+.%d+.%d+):.*")          
              	readfrom(Gags)                
		while 1 do 
		local line = read() 
		if line then          
		ip = strsub(line, strfind(line, "|") + 1) 
		if ip == ToIp then 
		return 1          
		end 
		else       
		break 
		end 
		end 
		end 
		readfrom()
end

can anyone help me ??

Best regards, nErBoS
--## nErBoS Spot ##--

nErBoS

I have this problem sometimes its works perfectly somtimes the users commands stop working. It?s possible to be a bug in the software hub ?? i doubt problay is mine please help !
--## nErBoS Spot ##--

kepp

In your case i wouln't use
if (not user.bOperator) then
It's not needed

i would have put the
if user.bOperator then
at the top, above all commands.
(Can't see much of your script, else i could show about where)

You've created new functions for each command of yours.
In that function, Let me take one for etc:

elseif (cmd=="!mmaxusers") then
      MudarMaxUsers(user,data)
return 1

^^ -- That is the function you've created, Nothing wrong with it

function MudarMaxUsers(user,data)
if not user.bOperator then -- Notice this line
-- ToDO

^ --- so, let's say this command is for user's, Then, if im right, both users and Op's are able to use it... As you stated "if user.bOperator" before...

Sorry, i need som more coffee now...
though, i hope this helped you at least a little, wether im wrong or right on the subject..
Cause i do exactly the same as i've tried to explain in my script
Guarding    

nErBoS

#30
I agree with everthing you said keep but the script gives me this error trow time to time, that was i a questioned, if isn?t a bug on the software !!

Best regards, nErBoS
--## nErBoS Spot ##--

SMF spam blocked by CleanTalk