Author Topic: my bot  (Read 2310 times)

0 Members and 1 Guest are viewing this topic.

Offline rstandley

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
my bot
« on: 25 March, 2004, 23:48:09 »
i have been reading through the how to make your own bot threads and have come to some problems i have made my basic bot with basic kick and ban commands but.... how do i make it so only an op can use them and see the commands as any old user can kick at the moment

PtokaX forum

my bot
« on: 25 March, 2004, 23:48:09 »

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #1 on: 25 March, 2004, 23:55:08 »
by using if user.iProfile

Each profile has an identical index, such as an OP has 1
Master has 0
VIP has 2
Reg has 3
unreg has -1

so, to prevent other users from being able to use your commands, you can check it with

if user.iProfile ~= 0 or user.iProfile ~= 1 then
    user:SendData("YOu are not allowed to use this command")
else
    --// Todo
end

"==" <-- Equal   "~="   <--- The opposit, Not equal

Have Fun ;)
Guarding    

Offline rstandley

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
(No subject)
« Reply #2 on: 26 March, 2004, 00:08:09 »
ok that looks like it makes sence but as im still newbie at this.... you say i need that in my script but do i need that in each section of kick ban and temp

elseif (cmd==prefix.."kick") then
         s,e,cmd,whotokick = strfind(data,"%s+(%S+)%s+(%S+)")
         if whotokick == nil then
            return 1
         else
            user = GetItemByName(whotokick)
            user:Disconnect() --without tempban
         end
      elseif (cmd==prefix.."temp") then
         s,e,cmd,whotokick = strfind(data,"%s+(%S+)%s+(%S+)")
         if whotokick == nil then
            return 1
         else
            user = GetItemByName(whotokick)
            user:TimeBan(TimeToBan) --ban for specified
         end
      elseif (cmd==prefix.."ban") then
         s,e,cmd,whotokick = strfind(data,"%s+(%S+)%s+(%S+)")
         if whotokick == nil then
            return 1
         else
            user = GetItemByName(whotokick)
            user:Ban() --perm ban




thats what i have for kick commands so would i need your command in each section or?????

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #3 on: 26 March, 2004, 06:34:02 »
I hope this helps you a little bit on the way

suppose you have something like this..

Code: [Select]
function DataArrival(user, data)
if strsub(data,1,1)=="<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if user.bOperator then --This line here would now be used +kick and +ban
if (cmd=="+kick") then
--// Todo
elseif (cmd=="+ban") then
--Todo
end
end
if user.iProfile == 2 or user.iProfile == 3 then
if (cmd=="+lol") then
--//todo
elseif (cmd=="+hehe") then
--//todo
end
end
end
end
Guarding    

Offline rstandley

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
(No subject)
« Reply #4 on: 26 March, 2004, 09:25:00 »
thats done the trick thanx mate

Offline gazzer

  • Double Ace
  • *
  • Posts: 138
  • Karma: +0/-0
(No subject)
« Reply #5 on: 26 March, 2004, 17:12:55 »
oh great gods of lua (i mean r-standishley)
now ya mastering lua with aid from these cool guys.
how about fixing the damm triv bot lol
-=U=K=?=E=T=-???? the friendly network from good old blighty.

PtokaX forum

(No subject)
« Reply #5 on: 26 March, 2004, 17:12:55 »