PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: yoonohoo on 29 May, 2005, 15:45:08

Title: Welcome message
Post by: yoonohoo on 29 May, 2005, 15:45:08
Can some1 make a script (rightclick) where the user can change their welcome statement.

Like found in Guarding.

Many thanks
Title:
Post by: Dessamator on 29 May, 2005, 18:30:28
click on my signature !
Title:
Post by: yoonohoo on 29 May, 2005, 21:24:51
I did searched prior to your useless reply but unfortunately couldn't find a simple script.
If you want to help you're most welcome but don't waste my time with foolish replies.

Thank you.
Title:
Post by: Dessamator on 29 May, 2005, 22:02:45
QuoteOriginally posted by yoonohoo
I did searched prior to your useless reply but unfortunately couldn't find a simple script.
If you want to help you're most welcome but don't waste my time with foolish replies.

Thank you.

have u searched in the finished lua 5 scripts?, have u searched in the lua 5 requested scripts   section ? if so then u really need to fine tune ur searching techniques, either way ,Check here (http://board.univ-angers.fr/thread.php?threadid=4182&boardid=26&sid=560e9fd2cef093c98c693ff35e3c2177)

as for right click, u can add it on ur own , lua 5 check the how to section, if u really cant, then ill be glad to do so !
Title:
Post by: yoonohoo on 29 May, 2005, 23:20:31
Thank you for the link.
Quoteas for right click, u can add it on ur own , lua 5 check the how to section, if u really cant, then ill be glad to do so !
As for lua coding I've seen the "how to" and thats way, way out of my capabilities...see my sig! Me like windows :)) I was even considering using Guarding with only that function enabled (Using already Robocop, Lucifer and R&R).
So if help is at hand: simple script for all users to be able to change their welcome message with rc.
Many thanks.
Title:
Post by: bastya_elvtars on 29 May, 2005, 23:42:20
Preparing for my exam, so zust posting the needed functions from lawmaker... pray somebody will do it for you. Not a big deal, but unfortunately no time here.

function SendToUser(user,env,who,mesg)
user:SendData(parseenv(user,env,who)..mesg)
end

function addwelcome(user,data,env)
if levaddwelcome~=0 then
if CheckUserLevel(user) >= levaddwelcome then
local _,_,pt1,pt2=string.find(data,"%b<>%s+%S+%s+(.+)%s:%s(.+)")
if pt1 and pt2 then
if announce[user.sName] then
else
announce[user.sName]={}
end
table.insert(announce[user.sName],pt1.." [USER] "..pt2)
savewelcome()
SendToUser(user,env,Bot,"Successfully added the message.")
else
SendToUser(user,env,Bot,"Incorrect usage, correct is: +addwelcome pt1 : pt2")
end
else
SendToUser(user,env,Bot,"You do not have sufficient rights to run that command! |")
end
else
SendToUser(user,env,Bot,"That command is disabled.")
end
end

function showwelcome(user,data,env)
if levshowwelcome~=0 then
if CheckUserLevel(user) >= levshowwelcome then
local _,_,param=string.find(data,"%b<>%s+%S+%s+(%S+)")
local msg=""
if param then
if announce[param] and table.getn(announce[param])>0 then
msg=msg.."Here you go, announces of "..param..":\r\n==============================\r\n"
for a=1,table.getn(announce[param]) do
local u=string.gsub(announce[param][a],"%b[]",param)
msg=msg..a..". "..u.."\r\n"
end
msg=msg.."=============================="
user:SendPM(Bot,msg)
else
SendToUser(user,env,Bot,"Unknown user,or has no messages!")
end
else
if announce[user.sName] and table.getn(announce[user.sName])>0 then
msg=msg.."Here you go, your announces :\r\n==============================\r\n"
for a=1,table.getn(announce[user.sName]) do
local u=string.gsub(announce[user.sName][a],"%b[]",user.sName)
msg=msg..a..". "..u.."\r\n"
end
msg=msg.."=============================="
user:SendPM(Bot,msg)
else
SendToUser(user,env,Bot,"You have no announces!")
end
end
else
SendToUser(user,env,Bot,"You do not have sufficient rights to run that command! |")
end
else
SendToUser(user,env,Bot,"That command is disabled.")
end
end

function savewelcome()
local f=io.open("lawmaker/inifiles/announce.ini","w+")
local msg="announce={\n"
for a,b in announce do
msg=msg.."[\""..a.."\"]={"..parsing(b).."},\n"
end
msg=msg.."}"
f:write(msg)
f:close()
end

function saveleave()
local f=io.open("lawmaker/inifiles/leave.ini","w+")
local msg="goodbye={\n"
for a,b in goodbye do
msg=msg.."[\""..a.."\"]={"..parsing(b).."},\n"
end
msg=msg.."}"
f:write(msg)
f:close()
end

function parsing(arr)
local msg=""
for b=1,table.getn(arr) do
msg=msg.."\""..arr[b].."\","
end
return msg
end

function delwelcome(user,data,env)
if levdelwelcome~=0 then
if CheckUserLevel(user) >= levdelwelcome then
local _,_,arg=string.find(data,"%b<>%s+%S+%s+(.+)")
if arg then
string.gsub(arg,"(%d+)",function(idx)
local id=tonumber(idx)
if announce[user.sName][id] then
SendToUser(user,env,Bot,"Announce #"..id.." deleted!")
tos.remove(announce[user.sName],id)
if table.getn(announce[user.sName])==0 then announce[user.sName]=nil end
savewelcome()
else
SendToUser(user,env,Bot,"Announce #"..id.." not found!")
end
end)
else
SendToUser(user,env,Bot,"Invalid use! Usage: +delwelcome ")
end
else
SendToUser(user,env,Bot,"You do not have sufficient rights to run that command! |")
end
else
SendToUser(user,env,Bot,"That command is disabled.")
end
end

function addleave (user,data,env)
if levaddleave~=0 then
if CheckUserLevel(user) >= levaddleave then
local _,_,msg=string.find(data,"%b<>%s+%S+%s+(.+)")
if msg then
if goodbye[user.sName] then
else
goodbye[user.sName]={}
end
table.insert(goodbye[user.sName],"[USER] "..msg)
saveleave()
SendToUser(user,env,Bot,"Successfully added the message.")
else
SendToUser(user,env,Bot,"Incorrect usage, correct is: +addleave ")
end
else
SendToUser(user,env,Bot,"You do not have sufficient rights to run that command! |")
end
else
SendToUser(user,env,Bot,"That command is disabled.")
end
end

function delleave(user,data,env)
if levdelleave~=0 then
if CheckUserLevel(user) >= levdelleave then
local _,_,arg=string.find(data,"%b<>%s+%S+%s+(.+)")
if arg then
string.gsub(arg,"(%d+)",function(idx)
local id=tonumber(idx)
if goodbye[user.sName][id] then
SendToUser(user,env,Bot,"Announce #"..id.." deleted!")
tos.remove(goodbye[user.sName],id)
if table.getn(leave[user.sName])==0 then leave[user.sName]=nil end
saveleave()
else
SendToUser(user,env,Bot,"leave #"..id.." not found!")
end
end)
else
SendToUser(user,env,Bot,"Invalid use! Usage: +delleave ")
end
else
SendToUser(user,env,Bot,"You do not have sufficient rights to run that command! |")
end
else
SendToUser(user,env,Bot,"That command is disabled.")
end
end

function showleave(user,data,env)
if levshowleave~=0 then
if CheckUserLevel(user) >= levshowleave then
local _,_,param=string.find(data,"%b<>%s+%S+%s+(%S+)")
local msg=""
if param then
if goodbye[param] and table.getn(goodbye[param])>0 then
msg=msg.."Here you go, leave leaves of "..param..":\r\n==============================\r\n"
for a=1,table.getn(goodbye[param]) do
local u=string.gsub(goodbye[param][a],"%b[]",param)
msg=msg..a..". "..u.."\r\n"
end
msg=msg.."=============================="
user:SendPM(Bot,msg)
else
SendToUser(user,env,Bot,"Unknown user,or has no messages!")
end
else
if goodbye[user.sName] and table.getn(goodbye[user.sName])>0 then
msg=msg.."Here you go, your leave leaves :\r\n==============================\r\n"
for a=1,table.getn(goodbye[user.sName]) do
local u=string.gsub(goodbye[user.sName][a],"%b[]",user.sName)
msg=msg..a..". "..u.."\r\n"
end
msg=msg.."=============================="
user:SendPM(Bot,msg)
else
SendToUser(user,env,Bot,"You have no leaves!")
end
end
else
SendToUser(user,env,Bot,"You do not have sufficient rights to run that command! |")
end
else
SendToUser(user,env,Bot,"That command is disabled.")
end return 1
end
Title:
Post by: yoonohoo on 30 May, 2005, 00:19:16
Thank you and good luck

I've just realised Robocop has a line to enter custom cmd
customCMDs = function(user) --// You can put your custome commands here  user:SendData("$UserCommand 1 3 zCUSTOM\\Test$<%[mynick]> !test||") -- Example lineIf that's of any help to make it easier