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
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 ;)
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?????
I hope this helps you a little bit on the way
suppose you have something like this..
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
thats done the trick thanx mate
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