PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: TTB on 13 April, 2005, 17:05:22

Title: Speed timeBAN LUA4
Post by: TTB on 13 April, 2005, 17:05:22
Hi,

speed timeban for lua4...

-- Made by TTB, 13-04-2005 scripted in LUA4
-- Timeban for low speed with message...
-- usage: #sb
-------------------------------------------

-- ## Start edit here ## --

Bot = "[BOT]PLAY" -- Your bot name
cmd1 = "#sb" -- Command with prefix
time = 30 -- Time of the timeban
speedmin = 100 -- Minimum speed in KBs.

-- Here you can put your extra message if you like. This will send to the victim in PM!
extramessage = "If you don't agree, send an e-mail to: . Please don't spam us with your own mistakes!"

-- ## Don't change script below if you don't know LUA ## --

function DataArrival(curUser, data)
local s,e,cmd, vic, speed = strfind(data, "%b<>%s+(%S+)%s*(%S*)%s*(%d*).*|")
local speed = tonumber(speed)
if cmd == cmd1 then
if not (curUser.bOperator or curUser.iProfile >=4) then
curUser:SendData(Bot, "*** You are not allowed to use this nice command!")
elseif vic == nil or speed == nil then
curUser:SendData(Bot, "*** Syntax error! Usage: "..cmd1.." ")
elseif  speed >= speedmin then
curUser:SendData(Bot, "*** Min. speed is set to "..speedmin.."KBs! "..speed.."KBs even or more!")
elseif (GetItemByName(vic) == nil) then
                        curUser:SendData(Bot, "The user:  '"..vic.."' is not online a.t.m. Speedban command denied!")

else      
                        local victim = GetItemByName(vic)          
                        if victim.iProfile ~= 0 and victim.iProfile ~= 1 and victim.iProfile ~= 4 and victim.iProfile ~= 5 then                        
SendPmToOps(Bot, "*** The user: "..vic.." has been timebanned by "..curUser.sName.." for speed issues! Victim speed: "..speed.." KBs!")
SendToAll(Bot, curUser.sName.." timebanned user "..vic.." for: "..time.." minutes - Reason: Your speed is below "..speedmin.." KBs! In fact, it is "..speed.." KBs. Read PM for more info!")
victim:SendPM(Bot, "You are timebanned for "..time.." minutes by "..curUser.sName.." because: Your speed is below "..speedmin.." KBs. In fact, it is "..speed.." KBs. "..extramessage)
victim:TimeBan(time)
else
curUser:SendData(Bot, "*** You can't kick a crew member!!")
end
end
return 1
end
end