PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Tarokkk on 20 December, 2003, 14:37:16

Title: Nest qestion
Post by: Tarokkk on 20 December, 2003, 14:37:16
welcome_op_1 = " "user.iProfile.."neked annyi :D" <-- " " it is syntax error but How I correct it ?

   welcome_op_2 = ""
   welcome_op_3 = ""
   welcome_op_4 = ""
   welcome_op_5 = ""
   welcome_op_6 = ""

---
if ConnectOpmess == 1 then
   function OpConnected(user)
   Pillock = GetProfileName(user.iProfile)
        MessOp = random(5)

      if MessOp == 1 then
        SendToAll(Bot, welcome_op_1)
        
        elseif MessOp == 2 then
        SendToAll(Bot, welcome_op_2)
        
      elseif MessOp == 3 then
        SendToAll(Bot, welcome_op_3)

        elseif MessOp == 4 then
        SendToAll(Bot, welcome_op_4)
        
        elseif MessOp == 5 then
        SendToAll(Bot, welcome_op_5)

        elseif MessOp == 6 then
        SendToAll(Bot, welcome_op_6)

      end
   end
end

-- The variable is in the sttings.ini -- It's only detail
Title:
Post by: plop on 20 December, 2003, 20:24:29
welcome_op_1 = " "..user.iProfile.."neked annyi :D"

thats all, 2 dots were missing.

plop
Title: :(
Post by: Tarokkk on 20 December, 2003, 20:57:47
Syntax Error: attempt to index global `user' (a nil value)
Title:
Post by: tezlo on 20 December, 2003, 21:09:49
there is no user on script start..
what you could do is make it a function

welcome_op_x = function(user) return "whatever "..user.iProfile end

and then SendToAll(Bot, welcome_op_x(user))
Title: -Another qestion Two variables ?
Post by: Tarokkk on 20 December, 2003, 21:59:30
--Welcomes
-- Users
welcome_users = "Hi ?s ?rezd j?l magad"
-- OPs
welcome_op_1 = ""
welcome_op_2 = ""
welcome_op_3 = ""
welcome_op_4 = ""
welcome_op_5 = ""


function NewUserConnected(user)
if Connectusermess == 1 then
SendToAll(Bot, user.sName..""..welcome_users)
end
end
----------------
if ConnectOpmess == 1 then
function OpConnected(user)
Pillock = GetProfileName(user.iProfile)
MessOp = random(5)
SendToAll(Bot,_________) --<--This is the qestion ?( ... What I have to write there ? welcome_op_(??? this is the number Mess OP)
end
end
end


----Thx