need help with my Bot
 

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

need help with my Bot

Started by Themaster, 16 November, 2004, 16:57:07

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Themaster

i have a problem when i do my command in my PM. the only thing i can do is +help.
That i want is i can use all my command on my PM in the script...plz PPL do help me on that

if strsub(data, 1, 5) == "$To: " then
      local s,e,to,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
      if to == BotName then
		local data=strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind(data,"$%b<>%s+(%S+)")
			if user.iProfile == 1 or user.iProfile == 0 then
			local Commands = (AlmHelp(user, data, cmd) or OpHelp(user, data, cmd) or Masterhelp(user, data, cmd))
			return Commands
			end
      end
         if to == OpChat then
            if user.bOperator then
               local s,e,msg = strfind(text,"^%b<>%s+(.+)")
               OpChatRoom(user,msg)
            end
         end
      if to == PmToOps then
			local data=strsub(data,1,strlen(data)-1)
			local _,_,message = strfind(data,"$%b<>%s+(.+)")
			SendPmToOps(OpChat, "The user "..user.sName.." wants to inform us about : "..message)
			user:SendPM(PmToOps,"Your Message has been delivered to  "..OpChat.." and Ops will handle it  !! ")
         end
      end
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

bastya_elvtars

local Commands = (AlmHelp(user, data, cmd) or OpHelp(user, data, cmd) or Masterhelp(user, data, cmd))

use a table instead

tbl={[-1]=AlmHelp,[1]=OpHelp,[0]=Masterhelp}

and return tbl[user.iProfile](user,data,cmd)
Everything could have been anything else and it would have just as much meaning.

Themaster

i have all my command :
assert(dofile("blade/Commands.lua", "blade/Commands.lua not found"))

do you mean i shell made it a table ???
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

bastya_elvtars

QuoteOriginally posted by Themaster
i have all my command :
assert(dofile("blade/Commands.lua", "blade/Commands.lua not found"))

do you mean i shell made it a table ???

it is faster any way but dunno exactly
Everything could have been anything else and it would have just as much meaning.

Themaster

Ok...But My problem is i still not can add a user in PM on my script....That is my biggest Problem
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

my problem is i can't get add user function work in PM to the bot and the other command i have made...help me ppl

function DataArrival(user,data)
   if (strsub(data,1,7) == "$MyINFO") then
      Tag,Speed,Share = Parse(data)
      TagCheck(Tag,Speed,Share,user)
   end
   if (strsub(data, 1, 1) == "<" ) then
   local data = strsub(data,1,strlen(data)-1)
   local _,_,prefix,cmd=strfind(data, "%b<>%s+(%S)(%S+)")
      if Tprefix[prefix] and cmd then
         prefixcmd = Tprefix[prefix]..cmd
         local Commands = Commands(user, data, cmd)
         return Commands
      	elseif Kennylizednicks[user.sName] == 1 then
            text=kennytext[random(1, getn(kennytext))]
				SendToAll(user.sName, text)
				return 1
         end
      end
  	[COLOR=red]if strsub(data, 1, 5) == "$To: " then
      local s,e,whoTo,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
      if whoTo == BotName then
		local data=strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind(data,"$%b<>%s+(%S+)")
			if user.iProfile == 1 or user.iProfile == 0 then
         local Commands = Commands(user, data, cmd)
			return Commands
			end
      end[/COLOR]       if whoTo == OpChat then
         if user.bOperator then
            local s,e,msg = strfind(text,"^%b<>%s+(.+)")
            OpChatRoom(user,msg)
         end
      end
      if whoTo == PmToOps then
			local data=strsub(data,1,strlen(data)-1)
			local _,_,message = strfind(data,"$%b<>%s+(.+)")
			SendPmToOps(OpChat, "The user "..user.sName.." wants to inform us about : "..message)
			user:SendPM(PmToOps,"Your Message has been delivered to  "..OpChat.." and Ops will handle it  !! ")
         end
      end
   local tmp = strsub(data,1,1)
	if tmp == "<" then
		local s, e, str = strfind(data,"%b<> (.*)|")
		if not iscommand(str) then
			if (user.bOperator) then
				DoUpdOpStats(user,str)
			else
				DoUpdUserStats(user,str)
			end
		end
	end
	if (strsub(data,1,1) == "<" ) then 
		data=strsub(data,1,strlen(data)-1) 
		s,e,cmd = strfind( data,"%b<>%s+(%S+)" ) 
			if (cmd=="stats")then
				pm = 0
				ShowTop15(user)
			end
	end
end
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

#6
please PPL i do need Help to get it work...

My problem is a whoto function

whoto BotName.....

when i past a +time on PM to the Bot i Get The help function instead
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

#7
What is my problem on the DataArrival..

i have a assert command file

Please help me
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

#8
Hi,

Your DataArrival is a bit confused. Question why do you do this "return Commands" ?? Do you now that, when you do that you are comming out of DataArrival the rest of the conditions won't be checked.

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

Themaster

no i did not no that... maybe i need a edit on it
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

#10
can some whon edit my DataArrival so it work again...
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

Hi,

Its your script you have to understand why is not working. We are here to help. Now tell us why did you have this...

        local Commands = Commands(user, data, cmd)
			return Commands

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

Themaster

to connect to my command's i have it on

assert(dofile("blade/Commands.lua", "blade/Commands.lua not found"))

Maybe is wrong..
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

#13
Hi,

OK, if i have understood you are saying that when you do this "local Commands = Commands(user, data, cmd)" you are calling the function that has this "assert(dofile("blade/Commands.lua", "blade/Commands.lua not found"))". Am i right ???

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

Themaster

yes something like that....but it dosen't work wright..
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

Hi,

Yes its wrong, the function dofile() only "shares" code from other files, that is why that you see many dofile() in the begin of a script. When you share tables or other vars you must have the var with the same name on the script you did the dofile(). About sharing functions you should put the dofile() in the beggining of your script code (NOTE: when you make a dofile() the function can't have the same functions as the script).

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

Themaster

What is my problem i can't use all my command in PM ???
That is my problem
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

Hi,

The problem is not that, the problem is that you are using in the wrong away the function dofile() . Read my post with attention.

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

Themaster

Ok i but now i have test Something and it now come that on my main chat

[22:41:58] <-Wesly?->  	 You are not allowed to use this command
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

Hi,

In the file that you have the commands function, you have only the commands functions right ??? Show me how is the function of choosing the command function.

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

Themaster

#20
assert(dofile("blade/Commands.lua", "blade/Commands.lua not found"))

arrLink = {}
pmArray={}
awayArray={}
MainArray={}
AddRegUser = {}
ChatOpStat={}
ChatUserStat={}
kicks = {}
warn = {}
Kennylizednicks = {}
Mutes = {}

function DataArrival(user,data)
   if (strsub(data,1,7) == "$MyINFO") then
      Tag,Speed,Share = Parse(data)
      TagCheck(Tag,Speed,Share,user)
   end
   if (strsub(data, 1, 1) == "<" ) then
   local data = strsub(data,1,strlen(data)-1)
   local _,_,prefix,cmd=strfind(data, "%b<>%s+(%S)(%S+)")
      if Tprefix[prefix] and cmd then
         prefixcmd = Tprefix[prefix]..cmd
         local Commands = Commands(user, data, cmd)
         return Commands
      	elseif Kennylizednicks[user.sName] == 1 then
            text=kennytext[random(1, getn(kennytext))]
				SendToAll(user.sName, text)
				return 1
         elseif Mutes[user.sName] == 1 then
				user:SendData(BotName,"You are muted. your message has been blocked ! ! !")
				return 1
         end
      end
      if strsub(data, 1, 5) == "$To: " then
      local s,e,whoTo,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
      if whoTo == BotName then
		local data=strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind(data,"$%b<>%s+(%S+)")
			if user.iProfile == 1 or user.iProfile == 0 then
         local Commands =Commands(user, data, cmd)
			return Commands
			end
      end  
      if whoTo == OpChat then
         if user.bOperator then
            local s,e,msg = strfind(text,"^%b<>%s+(.+)")
            OpChatRoom(user,msg)
         end
      end
      if whoTo == PmToOps then
			local data=strsub(data,1,strlen(data)-1)
			local _,_,message = strfind(data,"$%b<>%s+(.+)")
			SendPmToOps(OpChat, "The user "..user.sName.." wants to inform us about : "..message)
			user:SendPM(PmToOps,"Your Message has been delivered to  "..OpChat.." and Ops will handle it  !! ")
         end
      end
   local tmp = strsub(data,1,1)
	if tmp == "<" then
		local s, e, str = strfind(data,"%b<> (.*)|")
		if not iscommand(str) then
			if (user.bOperator) then
				DoUpdOpStats(user,str)
			else
				DoUpdUserStats(user,str)
			end
		end
	end
	if (strsub(data,1,1) == "<" ) then 
		data=strsub(data,1,strlen(data)-1) 
		s,e,cmd = strfind( data,"%b<>%s+(%S+)" ) 
			if (cmd=="stats")then
				pm = 0
				ShowTop15(user)
			end
	end
end
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Themaster

#21
here are my Command
function Commands(user, data, cmd)
   if cmd == "myip" then
      user:SendData(BotName, " ?Your IP Are? --->"..user.sIP)
      return 1
   elseif cmd == "version" then
      user:SendData(BotName, "  "..Version  ..Build  .. Creator)
      return 1
   elseif cmd == "away" then
      s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
      if (not (arg)) then
      arg = "Default away msg"
      end
      SendToAll(BotName,date("user "..user.sName.." told us at %T that he is away! He left this message: ")..arg.." .")
      awayArray[user.sName]=arg
      return 1
	elseif cmd == "back" then
		if (awayArray[user.sName]==nil) then
		end
		SendToAll(BotName,date("user "..user.sName.." returned at %T and back from ")..arg..".")
		awayArray[user.sName]=nil
      return 1
   elseif cmd == "rules" then
      user:SendPM(BotName, filecontents)
      Readtextfile(user, "rules.txt")
      return 1
   elseif cmd =="newdk" then
      user:SendPM(BotName,filecontents)
      Readtextfile(user,"new dk.txt")
      return 1
   elseif cmd == "newen" then
      user:SendPM(BotName,filecontents)
      Readtextfile(user,"new en.txt")
      return 1
   elseif cmd == "network" then
      user:SendData(BotName, filecontents)
      Readtextfile(user, "network.txt")
      return 1
   elseif cmd == "link" then
		local s,e,sLink,sDesc = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(.+)")
		if (sLink == nil or sDesc == nil) then
			user:SendPM(BotName, "Syntax Error, addlink  , you must write a link and a description.")
		elseif (arrLink[strlower(sLink)] ~= nil) then
			user:SendPM(BotName, "The Link "..sLink.." is already in our Link List.")
		else
			arrLink[strlower(sLink)] = {["BY"] = user.sName, ["DESC"] = sDesc}
			user:SendPM(BotName, "The Link "..sLink.." has been added to our Link List, thank you.")
			if (uLaterPtokax == 1) then
				OnExit()
			end
		end
		return 1
		elseif user.bOperator and cmd == "dellink" then
			local s,e,sLink = strfind(data, "%b<>%s+%S+%s+(.+)")
			if (sLink == nil) then
				user:SendPM(BotName, "Syntax Error, dellink , you must write a link.")
			elseif (arrLink[strlower(sLink)] == nil) then
				user:SendPM(BotName, "The Link "..sLink.."isn't in our Link List.")
			else
				arrLink[strlower(sLink)] = nil
				user:SendPM(BotName, "The Link "..sLink.." has been removed from our Link List.")
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
		return 1
		elseif cmd == "showlink" then
			local sTmp,sLink,arrTable = "The Link List of our HUB:\r\n\r\n"
			for sLink, arrTable in arrLink do
				sTmp = sTmp.."LINK: "..sLink.." POSTED BY: "..arrTable["BY"].." DESCRIPTION: "..arrTable["DESC"].."\r\n"
			end
			user:SendPM(BotName, sTmp)
		return 1
   elseif cmd == "help" then
      if user.iProfile == 0 then
         MasterHelp(user)
      elseif user.iProfile == 1 then
         OpHelp(user)
      else
         AlmHelp(user)
         return 1
      end
      return 1
   elseif cmd == "adduser" then
     	local s,e,cmd,mode,AddName,AddPass = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)" )
      local usr=GetItemByName(AddName)
      if mode == "reg" then
      level = 3
      level1 = "REG"
      elseif mode == "vip" then
      level = 2
      level1 = "VIP" 
      elseif mode == "op" then
      level = 1
      level1 = "Operator" 
      elseif mode == "adm" then
      level = 0
      level1= "Master" 
      end
      if AddPass == nil or mode == nil then
         user:SendData(BotName,"Wrong Syntax read the help menu before you try to use commands !")
		elseif not strfind(AddPass, "%d") then
			user:SendData(BotName,"Hello "..user.sName.." ,For security issues , please use some numbers in the password ! !")
     	elseif strfind(AddPass, "?") then
			user:SendData(BotName,"Hello "..user.sName.." ,The password can not be with spaces ! !")
      elseif strlen(AddPass) < 3 then
         user:SendData(BotName,"Hello "..user.sName.." the inserted password is to short, below 3 characters is not allowed")
     	else
     		for i = 1, getn(Symbol) do
   			pass = gsub(AddPass, Symbol[i], "")
			end
         AddRegUser(AddName, pass, level) 
        		SendToOps(BotName,"Op-Msg : "..user.sName.." *** have succesfully registered the user > "..AddName.." <  as "..level1.."!! ***")
            local user=GetItemByName(AddName)
        		if user ~= nil then
					user:SendPM(BotName," "..
					"\r\nWelcome to "..frmHub:GetHubName().."\r\n\r\n"..
					"Please add these details to your favourites:\r\n\r\n"..
					"Hub Name:\t "..frmHub:GetHubName().."\r\n"..
					"User Name:\t"..AddName.."\r\n"..
					"Password:\t"..pass.."\r\n\r\n"..
					"Enjoy your stay .......")
					SendToAll(BotName,"We have a new "..level1.." in the hub and it is "..AddName)
				end
      	end         
		return 1 
   elseif cmd == "flood" then
      Flood(user,data)
      return 1
   elseif cmd == "userinfo" then
      local s,e,Name = strfind( data, "%b<>%s+%S+%s+(.+)")
         UserInfo(user, GetItemByName(Name))
         return 1
   elseif cmd=="warn" then
		local s,e,cmd,Name,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s*(.*)" ) 
		local victim = GetItemByName(Name)
			if victim ~= nil then
			victim:SendPM(user.sName, "You are being warned because: "..reason)
			SendToAll(BotName, user.sName.." is warning <"..Name.."> because: "..reason)
			return 1
			else
			user:SendData(BotName" No such nick in the userlist !! ")
			end
   elseif cmd=="unregme" then
		frmHub:DelRegUser(user.sName)
		SendPmToNick(user.sName, BotName, "You have now deleted "..user.sName.." as a reguser")
		return 1
   elseif cmd == "hubinfo" then 
		hubinfo(user)
		return 1
   elseif cmd=="ban" then
		Ban(user, data, cmd)
		return 1
   elseif cmd=="nameban" then
		NameBan(user, data, cmd)
      return 1
   elseif cmd=="kick" then
		Kick(user, data, cmd)
		return 1
	elseif cmd=="showbanlog" then
		ReadKickBan(user, data)
		return 1
it not all my command i can't pass it
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

Hi,

Try to use this data arrival...

function DataArrival(user,data)
   if (strsub(data,1,7) == "$MyINFO") then
      Tag,Speed,Share = Parse(data)
      TagCheck(Tag,Speed,Share,user)
   end
   if (strsub(data, 1, 1) == "<" ) then
   local data = strsub(data,1,strlen(data)-1)
   local _,_,prefix,cmd=strfind(data, "%b<>%s+(%S)(%S+)")
      if Tprefix[prefix] and cmd then
         prefixcmd = Tprefix[prefix]..cmd
         Commands(user, data, cmd)
      	elseif Kennylizednicks[user.sName] == 1 then
            text=kennytext[random(1, getn(kennytext))]
				SendToAll(user.sName, text)
				return 1
         elseif Mutes[user.sName] == 1 then
				user:SendData(BotName,"You are muted. your message has been blocked ! ! !")
				return 1
         end
      end
      if strsub(data, 1, 5) == "$To: " then
      local s,e,whoTo,from,text = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
      if whoTo == BotName then
		local data=strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind(data,"$%b<>%s+(%S+)")
			if user.iProfile == 1 or user.iProfile == 0 then
         Commands(user, data, cmd)
			end
      end  
      if whoTo == OpChat then
         if user.bOperator then
            local s,e,msg = strfind(text,"^%b<>%s+(.+)")
            OpChatRoom(user,msg)
         end
      end
      if whoTo == PmToOps then
			local data=strsub(data,1,strlen(data)-1)
			local _,_,message = strfind(data,"$%b<>%s+(.+)")
			SendPmToOps(OpChat, "The user "..user.sName.." wants to inform us about : "..message)
			user:SendPM(PmToOps,"Your Message has been delivered to  "..OpChat.." and Ops will handle it  !! ")
         end
      end
   local tmp = strsub(data,1,1)
	if tmp == "<" then
		local s, e, str = strfind(data,"%b<> (.*)|")
		if not iscommand(str) then
			if (user.bOperator) then
				DoUpdOpStats(user,str)
			else
				DoUpdUserStats(user,str)
			end
		end
	end
	if (strsub(data,1,1) == "<" ) then 
		data=strsub(data,1,strlen(data)-1) 
		s,e,cmd = strfind( data,"%b<>%s+(%S+)" ) 
			if (cmd=="stats")then
				pm = 0
				ShowTop15(user)
			end
	end
end

Try out this DataArrival.

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

Themaster

#23
It still dead on my PM i got only this in my main
[15:35:55] <-Wesly?->  	 You are not allowed to use this command
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

nErBoS

Hi,

That appears in all your commands ?? Or a particular command ?? If is a particular command then it should be some error on the command function.

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

SMF spam blocked by CleanTalk