PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Conversion Requests => Topic started by: Mr.T on 15 April, 2009, 13:05:07

Title: blocker script
Post by: Mr.T on 15 April, 2009, 13:05:07
anybody that can convert this to new api
cmdBlock = "!block"
cmdUBlock = "!unblock"


tBlocked = {}
tCanCommand = {
[-1] = 0,
[0] = 1,
[1] = 1,
[2] = 0,
[3] = 0,
[4] = 0,
[5] = 1,
}

NewUserConnected = function(User)
if tCanCommand[User.iProfile] == 1 then
User:SendData("$UserCommand 1 3 Block user' Downloads$<%[mynick]> "..cmdBlock.." %[nick]&#124;|")
User:SendData("$UserCommand 1 3 Unblock user' Downloads$<%[mynick]> "..cmdUBlock.." %[nick]&#124;|")

end
end
OpConnected = NewUserConnected


ConnectToMeArrival = function(User,Data)
if tBlocked[User.sName] ~= nil then return 1 end
end
RevConnectToMeArrival = ConnectToMeArrival
MultiConnectToMeArrival = ConnectToMeArrival

ChatArrival = function(User,Data)
local _,_,sCmd,sArgs = string.find(Data, "%b<>%s(%S+)%s+(%S+)|")
if sCmd == cmdBlock and tCanCommand[User.iProfile] == 1 then
tBlocked[sArgs] = 1
SendToAll(frmHub:GetHubBotName(), "The nickname "..sArgs.." is now blocked from downloading in this hub")
return 1
elseif sCmd == cmdUBlock and tCanCommand[User.iProfile] == 1 then
if tBlocked[sArgs] ~= nil then
tBlocked[sArgs] = nil
SendToAll(frmHub:GetHubBotName(), "The nickname "..sArgs.." is no longer blocked and can download again")
else
User:SendPM(frmHub:GetHubBotName(), "That nickname ( "..sArgs.." ) wasn't blocked")
end
return 1
end
end
Title: Re: blocker script
Post by: ?StIfFLEr?? on 24 April, 2009, 11:01:18
I think this script is with similar function is already on forums...
try searching there if u really need it...