Help whith kick and DawgBot
 

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

Help whith kick and DawgBot

Started by DarkElf, 18 October, 2003, 00:06:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DarkElf

Hi, i have a bot (dawgbot 0.8b) and he give to ptokax this error:
Syntax Error: attempt to index local `kickUser' (a string value)

Can you help me?I post the kick string

--// kick
function dokick(curUser,kickUser,reason)
   if curUser.bOperator then
   if GetItemByName(kickUser) then kickUser = GetItemByName(kickUser) end
   kicklevel = GetProfileName(kickUser.iProfile)
   if kicklevel == nil then kicklevel = "Unreg" end
   if reason == nil then reason = "No Reason Given" end
   if userLevels[GetProfileName(curUser.iProfile)] < userLevels[kicklevel] then
   kickUser:SendPM(secbot,"You Have Been Kicked Because: "..reason)
   SendToAll("<<"..secbot..">> The User "..kickUser.sName.." Has Been Kicked Because: "..reason)
   writelog(date().."  <"..curUser.sName.."> Kicked <"..kickUser.sName.."> Because:"..reason)
   kickUser:Disconnect()
   else
   SendPmToNick(curUser.sName,secbot,"The User "..kickUser.sName.." Is Of Equal Or Higher Level Than You, You Lack The Authority")
   end
   end
end
Please sorry my bad english, i'm learning it :-D

\\100Gb ][ MeGaShArE @ I?? - ?u?i?N Owner [/I]
100gb.ifs-fusion.net:666 Only EliTe ShArE min 100gb
-={ I?? - ?u?i?N }=- N??Owner

plop

#1
give this 1 a try, placed comments on the added/changed part.

--// kick  
function dokick(curUser,kickUser,reason)
   if curUser.bOperator then
      if GetItemByName(kickUser) then   -- here checking if the kicked user is in the hub
         kickUser = GetItemByName(kickUser)  
      else -- if not were sending the kicking OP a pm informing that fact
         SendPmToNick(curUser.sName,secbot,"The User "..kickUser.." Is not in the hub")
         return 1 -- no need to continue processing so were canceling
      end
      kicklevel = GetProfileName(kickUser.iProfile)
      if kicklevel == nil then 
         kicklevel = "Unreg" 
      end
      if reason == nil then 
         reason = "No Reason Given" 
      end
      if userLevels[GetProfileName(curUser.iProfile)] < userLevels[kicklevel] then
         kickUser:SendPM(secbot,"You Have Been Kicked Because: "..reason)
         SendToAll("<<"..secbot..">> The User "..kickUser.sName.." Has Been Kicked Because: "..reason)
         writelog(date().." <"..curUser.sName.."> Kicked <"..kickUser.sName.."> Because:"..reason)
         kickUser:Disconnect()
      else
         SendPmToNick(curUser.sName,secbot,"The User "..kickUser.sName.." Is Of Equal Or Higher Level Than You, You Lack The Authority")
      end
   end
end

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

DarkElf

Please sorry my bad english, i'm learning it :-D

\\100Gb ][ MeGaShArE @ I?? - ?u?i?N Owner [/I]
100gb.ifs-fusion.net:666 Only EliTe ShArE min 100gb
-={ I?? - ?u?i?N }=- N??Owner

plop

yea was a tiny error in it, i edited the above post and made the next more safe version.
pick the 1 you like. (if the above now would work, lol).
it's hard 2 test it without the rest of the script.

--// kick  

function dokick(curUser,kickUser,reason)
   if curUser.bOperator then
      kickMe = GetItemByName(kickUser)  -- changing the string kickUser 2 the table with name kickMe, we could be needing the string later
      if kickMe ~= nil then  -- if not nil we can continue doing the kick
         kicklevel = GetProfileName(kickMe.iProfile)
         if kicklevel == nil then 
            kicklevel = "Unreg" 
         end
         if reason == nil then 
            reason = "No Reason Given" 
         end
         if userLevels[GetProfileName(curUser.iProfile)] < userLevels[kicklevel] then
            kickMe:SendPM(secbot,"You Have Been Kicked Because: "..reason)
            SendToAll("<<"..secbot..">> The User "..kickMe.sName.." Has Been Kicked Because: "..reason)
            writelog(date().." <"..curUser.sName.."> Kicked <"..kickMe.sName.."> Because:"..reason)
            kickMe:Disconnect()
         else
            SendPmToNick(curUser.sName,secbot,"The User "..kickMe.sName.." Is Of Equal Or Higher Level Than You, You Lack The Authority")
         end
      else    --if kickMe == nil were sending the kicking OP a pm informing that the user is not in the hub
         SendPmToNick(curUser.sName,secbot,"The User "..kickUser.." Is not in the hub") -- using the string here
      end
   end
end

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

DarkElf

Thanks, now it run :))))
1 milion of thanks :P
Please sorry my bad english, i'm learning it :-D

\\100Gb ][ MeGaShArE @ I?? - ?u?i?N Owner [/I]
100gb.ifs-fusion.net:666 Only EliTe ShArE min 100gb
-={ I?? - ?u?i?N }=- N??Owner

plop

QuoteOriginally posted by DarkElf
Thanks, now it run :))))
1 milion of thanks :P
1 is more then enough.  lol
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk