Jump to content

Making new gamemode NEED HELP!!!


rublisk19

Recommended Posts

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
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

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 :D

Link to comment
   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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...