rusztamas Posted May 7, 2017 Share Posted May 7, 2017 (edited) local szefpozicio = {"2485.87524, -1666.34705, 13.34380", "2487.87526, -1666.34705, 13.34380"} local szef = createObject (2634, tonumber(szefpozicio[0])) local szefrectangle = createColRectangle (2485.8720703125, -1665.8211669922, 5, 5) function szefopen(jatekos) if isElementWithinColShape (jatekos, szefrectangle) then moveObject (szef, 5000, tonumber(szefpozicio[1])) outputChatBox (math.random(1, 2)) end end addCommandHandler ("felfeszit", szefopen) It supposed to open on command enter "felfeszit". But: WARNING: teszt\bankrob.CodeS.lua:2: Bad argument @ 'createObject' [Expected vector3 at argument 2, got nil] Edited May 7, 2017 by rusztamas Link to comment
Avagard Posted May 7, 2017 Share Posted May 7, 2017 (edited) this should work local szefpozicio = {2485.87524, -1666.34705, 13.34380,2487.87526, -1666.34705, 13.34380} local szef = createObject (2634, tonumber(szefpozicio[0])) local szefrectangle = createColRectangle (2485.8720703125, -1665.8211669922, 5, 5) function szefopen(jatekos) if isElementWithinColShape (jatekos, szefrectangle) then moveObject (szef, 5000, tonumber(szefpozicio[1])) outputChatBox (math.random(1, 2)) end end addCommandHandler ("felfeszit", szefopen) Edited May 7, 2017 by Avagard 1 Link to comment
undefined Posted May 7, 2017 Share Posted May 7, 2017 (edited) local szefpozicio = { {2485.87524, -1666.34705, 13.34380}, {2487.87526, -1666.34705, 13.34380} } local szef = createObject (2634, unpack(szefpozicio[1])) local szefrectangle = createColRectangle (2485.8720703125, -1665.8211669922, 5, 5) function szefopen(jatekos) if isElementWithinColShape (jatekos, szefrectangle) then moveObject (szef, 5000, unpack(szefpozicio[2])) outputChatBox (math.random(1, 2)) end end addCommandHandler ("felfeszit", szefopen) Edited May 7, 2017 by ZoRRoM 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now