Jump to content

setTimer problem


Waffeleisen

Recommended Posts

Hello Guys, i have try to make an respawn script and collected commands and so on from the wiki. The problem is, thers no Error and idk whats wrong with it. Im not so very experience about scripting.

source = thePlayer 
  
function spawnPlayer()  
local x, y, z = getElementPosition(source) 
spawnPlayer(source, x, y, z) 
fadeCamera(source, true) 
setCameraTarget(source, source) 
end 
  
function () 
    setTimer ( spawnPlayer, 1000, 1, source) 
end 
  
  
addEventHandler("onPlayerWasted", getRootElement(), spawnPlayer ) 
  
  

I hope someone can help me.

Link to comment

thePlayer is not defined anywhere in your code.

Try this

function spawn(thePlayer)  
  
   if not isElement(thePlayer) then 
    return  
  end 
local x, y, z = getElementPosition(thePlayer) 
  
until spawnPlayer(thePlayer, x, y, z) 
  
fadeCamera(thePlayer, true) 
  
setCameraTarget(thePlayer, thePlayer) 
  
end 
  
  
addEventHandler("onPlayerWasted", root, function() 
  setTimer(spawn, 1000, 1, source) 
end 
) 

Edited by Guest
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...