Help with this script, please
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Help with this script, please

Started by Dag, 27 February, 2005, 15:34:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dag

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?
 



[NL]Pur

not tested but should be something in the line of this ;)


function ChatArrival(curUsermessage
  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==1then 
      curUser
:SendPM(frmHub:GetHubSecAliasName(), "Redir users at now to: "..frmHub:GetShareRedirAddr()) 
      return 


    
elseif (cmd == "!setshareredir" and curUser.iProfile==0then 
      frmHub
:SetShareRedirAddr(param
      
curUser:SendPM(frmHub:GetHubSecAliasName(), "You set redir to: "..frmHub:GetShareRedirAddr()) 
      return 

    end 
  end
end  

Dag

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!

PPK

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
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Dag

QuoteOriginally posted by PPK
Lua si case-sensitive... replace curuser with curUser  :D

Oh yes! :D
Thank you very much PPK and [NL]Pur!!! :))

Dag

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!

[NL]Pur

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

Dag

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.  :)

SMF spam blocked by CleanTalk