AlvareZ_ Posted March 4, 2013 Posted March 4, 2013 What its the problem here? Not debugscript errors local cx1, cy1, cz1 = 1262, -1154, 96 local cpx1, cpy1, cpz1 = 1190, -1195, 58 local cx2, cy2, cz2 = 512.2, -1263.57, 32.53 local cpx2, cpy2, cpz2 = 542.16, -1287.07, 17.24 function firstSlider(source) setTimer(function() setCameraMatrix(source, cx1, cy1, cz1, cpx1, cpy1, cpz1) fadeCamera(source, true, 1.0) end, 1000, 1) setTimer(secondSlider, 4000, 1, source) end end addEventHandler("onPlayerLogin", getRootElement(), firstSlider) function secondSlider(source) setTimer(function() setCameraMatrix(source, cx2, cy2, cz2, cpx2, cpy2, cpz2) fadeCamera(source, true, 1.0) end, 1000, 1) setTimer(thirdSlider, 4000, 1, source) end end addEventHandler("onPlayerLogin", getRootElement(), secondSlider)
Jaysds1 Posted March 4, 2013 Posted March 4, 2013 why don't you just put them in a table? try this: local camTable = { {1262, -1154, 96,1190, -1195, 58}, --cs,cy,cz,cpx,cpy,cpz {512.2, -1263.57, 32.53,542.16, -1287.07, 17.24} } function firstSlider(source) setTimer(function() local cx,cy,cz,cpx,cpy,cpz = unpack(camTable[math.random(#camTable)]) setCameraMatrix(source, cx1, cy1, cz1, cpx1, cpy1, cpz1) fadeCamera(source, true, 1.0) end, 1000, 2) end addEventHandler("onPlayerLogin", getRootElement(), firstSlider)
AlvareZ_ Posted March 4, 2013 Author Posted March 4, 2013 Done, but not work local cx1, cy1, cz1 = 1262, -1154, 96 local cpx1, cpy1, cpz1 = 1190, -1195, 58 local cx2, cy2, cz2 = 512.2, -1263.57, 32.53 local cpx2, cpy2, cpz2 = 542.16, -1287.07, 17.24 function firstSlider() setTimer(function() setCameraMatrix(source, cx1, cy1, cz1, cpx1, cpy1, cpz1) fadeCamera(source, true, 1.0) end, 1000, 1) setTimer(secondSlider, 4000, 1, source) end end addEventHandler("onPlayerLogin", getRootElement(), firstSlider) function secondSlider() setTimer(function() setCameraMatrix(source, cx2, cy2, cz2, cpx2, cpy2, cpz2) fadeCamera(source, true, 1.0) end, 1000, 1) setTimer(thirdSlider, 4000, 1, source) end end addEventHandler("onPlayerLogin", getRootElement(), secondSlider)
AlvareZ_ Posted March 4, 2013 Author Posted March 4, 2013 Jaysds1 debugscripts: bad argument @ ' setCameraMatrix' bad 'player' pointer @ 'fadeCamera'(1) bad argument @ ' setCameraMatrix' bad 'player' pointer @ 'fadeCamera'(1)
Castillo Posted March 4, 2013 Posted March 4, 2013 local camTable = { { 1262, -1154, 96,1190, -1195, 58 }, --cs,cy,cz,cpx,cpy,cpz { 512.2, -1263.57, 32.53,542.16, -1287.07, 17.24 } } function firstSlider ( ) setTimer ( function ( thePlayer ) setCameraMatrix ( thePlayer, unpack ( camTable [ math.random ( #camTable ) ] ) ) fadeCamera ( thePlayer, true, 1 ) end, 1000, 2, source ) end addEventHandler ( "onPlayerLogin", getRootElement(), firstSlider )
AlvareZ_ Posted March 4, 2013 Author Posted March 4, 2013 Thanks you Castillo and Jaysds1, Now working, but sometimes freeze in one camera
Castillo Posted March 4, 2013 Posted March 4, 2013 It doesn't "freeze", it just returns the same random camera twice.
AlvareZ_ Posted March 4, 2013 Author Posted March 4, 2013 i need see first the pos 1, and later the pos 2, can you help me ?
Castillo Posted March 4, 2013 Posted March 4, 2013 local camTable = { { 1262, -1154, 96,1190, -1195, 58 }, --cs,cy,cz,cpx,cpy,cpz { 512.2, -1263.57, 32.53,542.16, -1287.07, 17.24 } } local cameras = { } function firstSlider ( ) cameras [ source ] = 0 setTimer ( function ( thePlayer ) cameras [ thePlayer ] = ( cameras [ thePlayer ] + 1 ) setCameraMatrix ( thePlayer, unpack ( camTable [ cameras [ thePlayer ] ] ) ) fadeCamera ( thePlayer, true, 1 ) end, 1000, 2, source ) end addEventHandler ( "onPlayerLogin", getRootElement(), firstSlider ) Try it.
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