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

yeah, i think he already had that part arran :P (maybe we're wrong anyway o_O)

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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