rublisk19 Posted February 2, 2012 Share Posted February 2, 2012 Hi i started new project gamemode so have some problems. Here my script: setTimer(kaboom, 30000, 0, function() player = getRandomPlayer() x, y, z = getElementPosition(player) model1 = createObject(1654,0,0,0) if ( model1 ) then -- if it was created exports.bone:attachElementToBone(model1, player,3,0,-0.18,0.125,0,180,0) setTimer(kaboom, 15000, 1) end end) function kaboom(player) local x, y, z = getElementPosition ( player ) --Get the players position if x and y and z then createExplosion ( x, y, z, 8, true, 0, true) timers = getTimers ( 1000 ) -- Loop through the timer list for timerKey, timerValue in ipairs(timers) do -- kill the timer killTimer ( timerValue ) end end end I get error : Bad argument @ setTimer expected function 1 got nil Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 function kaboom(player) local x, y, z = getElementPosition ( player ) --Get the players position if (x and y and z) then createExplosion ( x, y, z, 8, true, 0, true) timers = getTimers ( 1000 ) -- Loop through the timer list for timerKey, timerValue in ipairs(timers) do -- kill the timer killTimer ( timerValue ) end end end setTimer(function() player = getRandomPlayer() x, y, z = getElementPosition(player) model1 = createObject(1654,0,0,0) if ( model1 ) then -- if it was created exports.bone:attachElementToBone(model1, player,3,0,-0.18,0.125,0,180,0) setTimer(kaboom, 15000, 1, player) end end, 30000, 0) Link to comment
rublisk19 Posted February 2, 2012 Author Share Posted February 2, 2012 this works good thanks!! Edit: i have question then i create explosion is there any way to make is stronger becouse any explosion don't kill from hit Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 https://wiki.multitheftauto.com/wiki/CreateExplosion Just check the explosion type's, also you can create more than just one to increase the damage. Link to comment
rublisk19 Posted February 2, 2012 Author Share Posted February 2, 2012 yes i maked 2 explosions before you posted Link to comment
rublisk19 Posted February 2, 2012 Author Share Posted February 2, 2012 and other question i make this : setTimer(function() player = getRandomPlayer() x, y, z = getElementPosition(player) model1 = createObject(1654,0,0,0) outputChatBox(player.." become BOMBER!") if ( model1 ) then -- if it was created exports.bone:attachElementToBone(model1, player,3,0,-0.18,0.125,0,180,0) setTimer(kaboom, 5000, 1, player) end end, 10000, 0) this don't show text and doesn't add bomb Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 setTimer(function() player = getRandomPlayer() x, y, z = getElementPosition(player) model1 = createObject(1654,0,0,0) if ( model1 ) then -- if it was created outputChatBox(getPlayerName(player) .." become BOMBER!") exports.bone:attachElementToBone(model1, player,3,0,-0.18,0.125,0,180,0) setTimer(kaboom, 5000, 1, player) end end, 10000, 0) Link to comment
rublisk19 Posted February 2, 2012 Author Share Posted February 2, 2012 OMG shame on me . Thanks 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