PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: UwV on 04 March, 2005, 04:04:14

Title: !kick &!warn in lua5
Post by: UwV on 04 March, 2005, 04:04:14

-- KickBot Lua5
-- based on plop's set max logins


Botty = "-=KickBot=-"

Mwarns = 3
Mkicks = 3

------------------------

warned = {}
kicked = {}

function ChatArrival(CurUser, Data)
local s,e,Cmd, Vic, Why = string.find(Data, "%b<>%s+(%S+)%s*(%S*)%s*(%S*).*|")
        if Cmd == "!kick" then
                if CurUser.bOperator ~= 1 then
                        CurUser:SendData(Botty, "Sorry "..CurUser.sName.." but You  need to be  OP to kick Ass on this hub..")
                elseif Why == "" and Vic =="" then
                        CurUser:SendData(Botty, "Just kick ?,, hmm maybe tell me who and why ?")
                elseif Why == "" then
       CurUser:SendData(Botty, "Wait a second "..CurUser.sName..", even I need a reason to kick ass.. ok ?")
                elseif (GetItemByName(Vic) == nil) then
                        CurUser:SendData(Botty, "Hmm  "..Vic.." must have felt it coming... and the coward left..")
                else      
                        local Arse = GetItemByName(Vic)          
                        if Arse.iProfile ~= 0 and Arse.iProfile ~= 5 and Arse.iProfile ~= 6 and Arse.iProfile ~= 7 then                        
                                if (kicked[Arse.sName] == nil) then
                                        kicked[Arse.sName] = 1
                                else
                                        kicked[Arse.sName] = kicked[Arse.sName] + 1
                                end
                                if (kicked[Arse.sName] == Mkicks) then
                                                SendToOps(Botty, "Ok,.. "..Vic.." has just been kicked by "..CurUser.sName.." because "..Why..".")
                                                SendToOps(Botty, "That was "..Vic.."'s "..Mkicks.."'th kick, so he/she is now banned. :0/")
                                                Arse:SendPM(Botty, "You have been kicked by "..CurUser.sName.." because : "..Why..".")
                               Arse:SendPM(Botty, "You have been kicked : "..Mkicks.." times,.. and now you are banned.. :0(")
                               Arse:Ban()
                               -- Arse:NickBan()
                               kicked[Arse.sName] = nil
                                else
                                                Arse:SendPM(Botty, "You have been kicked by "..CurUser.sName.." because : "..Why..".")
                                                Arse:SendPM(Botty, "Get kicked "..Mkicks.." times and you will be banned...")
                                                SendToOps(Botty, "Ok,.. "..Vic.." has just been kicked by "..CurUser.sName.." because "..Why..".")
                                                Arse:Kick(CurUser.sName, Why)
                       end
                          else
                                Arse:SendPM(Botty, CurUser.sName.." Has tried to Kick your ass,.. ")
                                Arse:SendPM(Botty, "But,.. I have protected yours... ")
                                Arse:SendPM(Botty, ",..\t so i guess 'we' better show IT who's the boss, huh ? ;0)")
                                CurUser:SendData(Botty, "Bad move "..CurUser.sName..",..  For sure "..Arse.sName.." is gonna kick YOUR ass now... :0/")
                          end
end
                return 1

        elseif Cmd == "!warn" then
                if CurUser.bOperator ~= 1 then
                        CurUser:SendData(Botty, "Sorry "..CurUser.sName.." but You  need to be  OP to warn anybody on this hub..")                                
                elseif Why == "" and Vic =="" then
                        CurUser:SendData(Botty, "Just warn ?,, hmm maybe tell me who and why ?")
                elseif Why == "" then
       CurUser:SendData(Botty, "Wait a second "..CurUser.sName..", even I need a reason to warn for.. ok ?")
                elseif (GetItemByName(Vic) == nil) then
                        CurUser:SendData(Botty, "Sorry ,  "..Vic.." is  offline, so not here to be warned.  ")
                else
                        local Arse = GetItemByName(Vic)
                        if Arse.iProfile ~= 0 and Arse.iProfile ~= 5 and Arse.iProfile ~= 6 and Arse.iProfile ~= 7 then                        
                                if (warned[Arse.sName] == nil) then
                                        warned[Arse.sName] = 1
                                else
                                        warned[Arse.sName] = warned[Arse.sName] + 1
                                end
                                if (warned[Arse.sName] == Mwarns) then
                                        SendToOps(Botty, "Ok,.. "..Vic.." has just been warned by "..CurUser.sName.." because "..Why..".")
                                        SendToOps(Botty, "That was "..Vic.."'s "..Mwarns.."'th warn, so he/she got kicked. :0o")
                                        Arse:SendPM(Botty, "You have been warned by "..CurUser.sName.." because :")
                                        Arse:SendPM(Botty, "-> "..Why..".")
                       Arse:SendPM(Botty, "You have been warned : "..Mwarns.." times,.. and now you are kicked,.. ")
                                        Arse:SendPM(Botty, "Get kicked "..Mkicks.." times and get banned :0(")
                       warned[Arse.sName] = nil
                                        if (kicked[Arse.sName] == nil) then
                                               kicked[Arse.sName] = 1
                                        else
                                               kicked[Arse.sName] = kicked[Arse.sName] + 1
                                        end
                                else
                                        Arse:SendData(Botty, "You have been warned by "..CurUser.sName.." because : "..Why..",")
                                        Arse:SendData(Botty, "Get warned "..Mwarns.." times and you will be Kicked.")
                                        SendToOps(Botty, "Ok,.. "..Vic.." has just been warned by "..CurUser.sName.." because "..Why..".")
                       end
                         else
                                Arse:SendPM(Botty, "Hmm, interesting for some reason "..CurUser.sName.." Has tried to warn you,.. ")
                                CurUser:SendData(Botty, "Bad move "..CurUser.sName..",..  OP's can't warn anyone at that level !!  ;0)")
                        end
                end
                return 1
        end
end

this line is a "admin" protection set to my profiles.dat
if Arse.iProfile ~= 0 and Arse.iProfile ~= 5 and Arse.iProfile ~= 6 and Arse.iProfile ~= 7 then
to protect only masters (in standard profiles.dat)
 use :
if Arse.iProfile ~= 0 then


Title:
Post by: kunal on 30 May, 2005, 08:38:59
can u add right click cmds 4 it
Title:
Post by: Krysalis on 02 July, 2005, 19:51:29
Hmm..
i?ve found 2 errors, could fix myself
may anyone need this too

---In the reason no sentences, ' only the first word of the reason come.  

change string

local s,e,Cmd, Vic, Why = string.find(Data, "%b<>%s+(%S+)%s*(%S*)(.*)")

---user dont be kicked after tree warnes.
---addet ban
 

Change this part:

if (warned[Arse.sName] == Mwarns) then
                                        SendToAll(Botty, Vic.." wurde verwarnt von "..CurUser.sName..", Grund "..Why..".")
                                        SendToAll(Botty, "Das wars "..Vic.."'s "..Mwarns..". verwarnung, nun wirst du gekickt. :0o")
                                        Arse:SendPM(Botty, "Du wurdest verwarnt von "..CurUser.sName.." weil :")
                                        Arse:SendPM(Botty, "-> "..Why..".")
                       CurUser:SendData("Du hast "..Arse.sName.." verwarnt")
Arse:SendPM(Botty, Mkicks.."x  wurdest du verwarnt, nun wirst du gekickt :(")
                       warned[Arse.sName] = nil
                                        Arse:Ban()
if (kicked[Arse.sName] == nil) then
                                               kicked[Arse.sName] = 1
                                        else
                                               kicked[Arse.sName] = kicked[Arse.sName] + 1
                                        end
                                else
                                        Arse:SendData(Botty, "Du bist verwarnt worden von "..CurUser.sName.." weil : "..Why..",")
                                        Arse:SendData(Botty, warned[Arse.sName].." Verwarnungen, noch eine und du wirst gekickt.")
                                    CurUser:SendData("Du hast "..Arse.sName.." verwarnt")
    SendToOps(Botty, Vic.." wurde gerade verwarnt von "..CurUser.sName..", Grund "..Why..".")
                       end

 Greets
Title:
Post by: kunal on 10 September, 2005, 12:03:15
pls could u translate it in english