PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: DorianG on 20 February, 2004, 14:59:06

Title: Set Level For AddReg
Post by: DorianG on 20 February, 2004, 14:59:06
I would want to set LVL, but RegOP doesn't work that, I would want. Also if I tell it that RegOp can be equal to 5 or to 6. If I go to record a user with one of these levels, the Bot doesn't record me it.
I mistake something?

RegOp = {"5","6"}


function AddRegOp(user, data)
s,e,cmd,str,pwd,lvl = strfind(data, "%b<>%s(%S+)%s(%S+)%s(%S+)%s(%S+)")
if cmd ~= nil and str ~= nil and pwd ~= nil and lvl ~= nil then
local usr = GetItemByName(str)
if lvl == RegOP then
if (usr.iProfile == -1) then
AddRegUser(str,pwd,lvl)
user:SendPM(BotName, "User "..usr.sName.." is  registered with success, by " ..user.sName)
else
user:SendPM(BotName, "User "..usr.sName.." was registered")
end
else
user:SendPM(BotName, "you are not allowed to register this user level")
end
else
user:SendPM(BotName, "Plaese, put this command !addreg " )
end
return 1
end
Title:
Post by: kepp on 20 February, 2004, 18:34:22
?ou are comparing the lvl with the table structure..

To getinto a specific place in a table you can do in many ways, here's one

RegOp = {"6","5"}

--// print(RegOp) Bad Code

Result = "table: 0x8063cb0"


good one :

print(RegOp[1])

Result: "6"

good luck!
Title:
Post by: DorianG on 20 February, 2004, 20:28:56
Sorry but i haven't understood..
if you write me a code I would be more contented ;)
Title:
Post by: DorianG on 20 February, 2004, 20:50:53
Ok i have understood now
Title:
Post by: DorianG on 20 February, 2004, 21:24:43
THank you very much :)