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

my bot

Started by rstandley, 25 March, 2004, 23:48:09

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rstandley

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

kepp

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    

rstandley

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?????

kepp

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
Guarding    

rstandley

thats done the trick thanx mate

gazzer

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.

SMF spam blocked by CleanTalk