Jump to content

Spawn trouble D:


12p

Recommended Posts

Well, guys, It's me again :D. I'm okay, I'm learning how LUA works, and I'm progressing, but I have 1 problem...

Look at this code:

function respawn (player)
fadeCamera(player,true,1,255,255,255)
spawnPlayer(player,2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74, 180, 285)
setCameraTarget(player, player)
end
 
addEventHandler("onPlayerWasted", root, 
function ()
setTimer (respawn,3000,1,source)
end)

My objetive with that code, is to make the player spawn when he dies, after 3 seconds, and fade the camera before that.

Everything works good but the Fade Out effect... what's bad in that code? Thank you beforehand.

Link to comment

You want to fade out when player dies and fade in when he spawns? If so, how do you expect the camera to fade out when player dies if you don't use fadeCamera in onPlayerWasted event at all? That's logical.

Link to comment
Well, guys, It's me again :D. I'm okay, I'm learning how LUA works, and I'm progressing, but I have 1 problem...

Look at this code:

function respawn (player)
fadeCamera(player,true,1,255,255,255)
spawnPlayer(player,2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74, 180, 285)
setCameraTarget(player, player)
end
 
addEventHandler("onPlayerWasted", root, 
function ()
setTimer (respawn,3000,1,source)
end)

My objetive with that code, is to make the player spawn when he dies, after 3 seconds, and fade the camera before that.

Everything works good but the Fade Out effect... what's bad in that code? Thank you beforehand.

its not that hard,

all you have to do is this:

local root = getRootElement()
 
addEventHandler("onPlayerWasted", root,
function ()
setTimer (spawnPlayer, 5000, 1, source,2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74) 
end
)

not that hard i guess ^^

Link to comment
Well, guys, It's me again :D. I'm okay, I'm learning how LUA works, and I'm progressing, but I have 1 problem...

Look at this code:

function respawn (player)
fadeCamera(player,true,1,255,255,255)
spawnPlayer(player,2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74, 180, 285)
setCameraTarget(player, player)
end
 
addEventHandler("onPlayerWasted", root, 
function ()
setTimer (respawn,3000,1,source)
end)

My objetive with that code, is to make the player spawn when he dies, after 3 seconds, and fade the camera before that.

Everything works good but the Fade Out effect... what's bad in that code? Thank you beforehand.

its not that hard,

all you have to do is this:

local root = getRootElement()
 
addEventHandler("onPlayerWasted", root,
function ()
setTimer (spawnPlayer, 5000, 1, source,2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74) 
end
)

not that hard i guess ^^

Do you even read what he's asking for?

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