Hi,
I need help with this script.
This is script is for redirect users, if they haven't required share.
---------------------------------------------------------------------
function ChatArrival(curUser, message)
if curuser.iProfile == 0 ~= nil then
s,e,cmd,param = string.find(message, "%b<>%s(.+)%s(.+)|")
if param == nil then
s,e,cmd = string.find(message, "%b<>%s(.+)|")
end
if (cmd == "!getshareredir") then
curUser:SendPM(frmHub:GetHubSecAliasName(), "Redir users at now to: "..frmHub:GetShareRedirAddr())
return 1
elseif (cmd == "!setshareredir") then
frmHub:SetShareRedirAddr(param)
curUser:SendPM(frmHub:GetHubSecAliasName(), "You set redir to: "..frmHub:GetShareRedirAddr())
return 1
end
end
---------------------------------------------------------------------
But I want, this: !getshareredir is available for all OPerators, but !setshareredir is available only to Masters!!
Profiles:
Master = 0
OP = 1
Can you someone help with this, please?
not tested but should be something in the line of this ;)
function ChatArrival(curUser, message)
if curuser.iProfile ~= nil then
s,e,cmd,param = string.find(message, "%b<>%s(.+)%s(.+)|")
if param == nil then
s,e,cmd = string.find(message, "%b<>%s(.+)|")
end
if (cmd == "!getshareredir" and curUser.iProfile==1) then
curUser:SendPM(frmHub:GetHubSecAliasName(), "Redir users at now to: "..frmHub:GetShareRedirAddr())
return 1
elseif (cmd == "!setshareredir" and curUser.iProfile==0) then
frmHub:SetShareRedirAddr(param)
curUser:SendPM(frmHub:GetHubSecAliasName(), "You set redir to: "..frmHub:GetShareRedirAddr())
return 1
end
end
end
Hi [NL]Pur,
unfortunately that your script doesn't work, it writes : Syntax C:\PtokaX\scripts\redir.lua:3: attempt to index global `curuser' (a nil value)
thank you very much!
QuoteOriginally posted by Dag
Syntax C:\PtokaX\scripts\redir.lua:3: attempt to index global `curuser' (a nil value)
Lua si case-sensitive... replace curuser with curUser :D
QuoteOriginally posted by PPK
Lua si case-sensitive... replace curuser with curUser :D
Oh yes! :D
Thank you very much PPK and [NL]Pur!!! :))
Hello,
thank you for your advices, but I would have if OP writes !setshareredir -> PM come to him with message about not having a permission.
But without displaying !setshareredir command writen by OP in mainchat too.
THANK YOU VERY MUCH!
QuoteBut I want, this: !getshareredir is available for all OPerators, but !setshareredir is available only to Masters!!
that is what you asked ?
or is everything ok :D
QuoteOriginally posted by [NL]Pur
is everything ok :D
Yes, everything is OK! Script working perfect at the moment! ;)
But I need in to script finish off yet: if OP writes !setshareredir -> PM come to him with message about not having a permission. :)