Jump to content

Player not respawning


jkMonger

Recommended Posts

Posted

I have this code:

function() outputChatBox("Respawning in 5 seconds...", source) setTimer(function()   
                        spawnPlayer(source, 1959.55, -1714.46, 17)  
                        fadeCamera(source, true) setCameraTarget(source, source) end 
                        ,5000,1) end) 

However, when I die, 5 seconds later, I don't spawn! What is wrong?

Posted

Before all. Please organize your script! like this:

function()  
outputChatBox("Respawning in 5 seconds...", source)  
setTimer( 
 function()   
  spawnPlayer(source, 1959.55, -1714.46, 17)  
  fadeCamera(source, true)  
  setCameraTarget(source, source)  
 end,5000,1,[b]source[/b]) end)--"source" is a element that must be passed to the setTimer function 

Posted

You dont respawn because you never added anything to that script to actualy detect that a player died.

  
addEventHandler("onPlayerWasted", root, function() outputChatBox("Respawning in 5 seconds...", source) setTimer(function(source)  
                        spawnPlayer(source, 1959.55, -1714.46, 17) 
                        fadeCamera(source, true) setCameraTarget(source, source) end 
                        ,5000,1,source) end) 
end) 
  

Also had to add "source" into setTimer and that function inside setTimer.

Posted

Was probably due to the missing source arg in the setTimer function and the setTimer arg as im quite sure they're needed.

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