PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: ArtificialInsanety on 14 January, 2008, 10:06:36

Title: Welcome script
Post by: ArtificialInsanety on 14 January, 2008, 10:06:36
Hey guys, can someone please make a little script that welcomes registered users only(ex: profiles:registered,vip,op,master) in the kickbar and the message is seen by all users when a registered user enters hub.

thanks
/AI
Title: Re: Welcome script
Post by: Mr.T on 14 January, 2008, 16:39:19
Here is a script lua 5.1

--[[
Statbar Messages 1.0
Nillan 2007-03-06
Thnx CrazyGuy fo helping me as always :)
This will send login and kick/ban messages to the statbar for everyone to see
--]]

sBotName = ""

function Main()
sBotName = frmHub:GetHubBotName()
end


NewUserConnected = function(User)
if User.iProfile == -1 then
local sWelcome = "Welcome "..User.sName.." , nice to have you here is kicking because:"
SendToAll(sBotName ,sWelcome)
else
local sOPWelcome = "Welcome "..GetProfileName(User.iProfile).."  "..User.sName.."  nice to have you back is kicking because:"
SendToAll(sBotName ,sOPWelcome)
end
return 1
end

OpConnected = NewUserConnected

function ChatArrival(User, Data)
if User.iProfile >= 0 then
local _,_,sCmd,sWhat = string.find(Data, "%b<>%s%p(%S+)%s(.*)|")
if (sCmd == "drop") then
local _,_,sWho,sWhy = string.find(sWhat, "(%S+)%s(.*)")
if sWhy == nil then
sWho = sWhat
sWhy = "No reason given"
end
local sKickMessage = "User "..sWho.." was removed by: "..User.sName.."  because: "..sWhy.." is kicking because:"
SendToAll(sBotName ,sKickMessage)
elseif sCmd and string.find(sCmd, "ban") then
local _,_,sWho,sWhy = string.find(sWhat, "(%S+)%s(.*)")
if sWhy == nil then
sWho = sWhat
sWhy = "No reason given"
end
local sKickMessage = "User "..sWho.."  was kicked and banned by: "..User.sName.."  because: "..sWhy.." is kicking because:"
SendToAll(sBotName ,sKickMessage)
end
end
end


function ToArrival(User, Data)
if User.iProfile >= 0 then
local _,_,sTo,sPM = string.find(Data, "To%:%s(%S+)%sFrom%:%s%S+%s%$%b<>%s(.*)|")
if sTo == sBotName then
-- command is sent to Bot
local _,_,sCmd,sWhat = string.find(sPM, "%p(%S+)%s(.*)")
if (sCmd == "drop") then
local _,_,sWho,sWhy = string.find(sWhat, "(%S+)%s(.*)")
if sWhy == nil then
sWho = sWhat
sWhy = "No reason given"
end
local sKickMessage = "User "..sWho.."  was kicked by: "..User.sName.."  because: "..sWhy.." is kicking because:"
SendToAll(sBotName ,sKickMessage)
elseif string.find(sCmd, "ban") then
local _,_,sWho,sWhy = string.find(sWhat, "(%S+)%s(.*)")
if sWhy == nil then
sWho = sWhat
sWhy = "No reason given"
end
local sKickMessage = "User "..sWho.." was kicked and banned by: "..User.sName.."  because: "..sWhy.." is kicking because:"
SendToAll(sBotName ,sKickMessage)
end
end
end
end
Title: Re: Welcome script
Post by: speedX on 14 January, 2008, 17:51:53
Mr.T  please use the "code" tags to post any code.
Title: Re: Welcome script
Post by: Mr.T on 14 January, 2008, 17:57:01
where is the code tag cant find it
:)
Title: Re: Welcome script
Post by: Tw?sT?d-d?v on 14 January, 2008, 18:03:19
[ code ] opens   [ / code ] closes


remove spaces between [ & code
Title: Re: Welcome script
Post by: ArtificialInsanety on 14 January, 2008, 20:30:30
Thank you guys ,the script works great