PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: DorianG on 24 January, 2004, 16:23:10

Title: Problem with DelRegUser command
Post by: DorianG on 24 January, 2004, 16:23:10
I want that an Operator can't delreg some specified users profiles. I have tried to create a command, but i have had some problem. I have written there. But Ptokax tell me that is an error. Can you halp me?


if (cmd=="!delreg" or cmd=="!DelReg" or cmd=="!Delreg" or cmd=="!Unreg" or cmd=="!unreg") then
            s,e,cmd,str = strfind(data, "%b<>%s(%S+)%s(%S+)")
            local usr = GetItemByName(str)
            if (usr.bOperator or usr.iProfile == 2) then
               user:SendPM(BotName, "Non puoi deregistrare "..usr.." fa parte di una classe protetta")
                SendPmToNick(usr, BotName, "L'operatore "..user.sName.." ha provato a deregistrarti")
            else
               SendPmToNick(usr, BotName, "Sei stato deregistrato da: "..user.sName)
               DelRegUser(usr)
               SendPmToOps(BotName, "L'utente "..usr.." ? stato deregistrato da: "..user.sName)
            end   
         end
Title:
Post by: DorianG on 24 January, 2004, 16:28:28
Ptokax tell me..... Syntax Error: attempt to concat local `usr' (a table value).
Title:
Post by: plop on 24 January, 2004, 20:07:38
QuoteOriginally posted by DorianG
Ptokax tell me..... Syntax Error: attempt to concat local `usr' (a table value).
usr is a table so if you want delete that you got 2 grab the right thing from the table.
usr.sName in your case.

plop
Title:
Post by: DorianG on 24 January, 2004, 20:51:42
Excuse me but i haven't understood. Can you write me the solution at my problem. Sorry But i'm at the first experience with LUA.  :)
Title:
Post by: NightLitch on 24 January, 2004, 21:02:55
user:SendPM(BotName, "Non puoi deregistrare "..usr.." fa parte di una classe protetta")

"..usr.."

should be

"..usr.sName.."
Title:
Post by: DorianG on 25 January, 2004, 04:36:51
oh yes. Now is ok! :D Thanks you are very glad ;)