jkMonger Posted December 20, 2010 Share Posted December 20, 2010 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? Link to comment
12p Posted December 20, 2010 Share Posted December 20, 2010 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 Link to comment
Arran Posted December 20, 2010 Share Posted December 20, 2010 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. Link to comment
12p Posted December 21, 2010 Share Posted December 21, 2010 I think he added that event, actually... Link to comment
Castillo Posted December 21, 2010 Share Posted December 21, 2010 yeah, i think he already had that part arran (maybe we're wrong anyway o_O) Link to comment
Arran Posted December 21, 2010 Share Posted December 21, 2010 Was probably due to the missing source arg in the setTimer function and the setTimer arg as im quite sure they're needed. Link to comment
jkMonger Posted December 21, 2010 Author Share Posted December 21, 2010 Arran, I did have the event I just thought you wouldn't need it 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