Tails Posted August 9, 2012 Share Posted August 9, 2012 (edited) Hi there it's me again! Once again I'm completely lost. What I'm trying to create is that when you die, I want to give the player a time out and send them to hospital. But for that I just want to have the players camera targeted at a sleeping ped (with their skin) on a bed, inside an interior. Can anyone help me out with this? Thanks in advance. local DieingPed1 = createPed ( 2336.5439453125, -1172.0966796875, 1031.96875, mySkin ) function deathCheck() local x,y,z = getElementPosition(source) DieingPed2 = getElementPosition(DieingPed1) if (isPedDead(source)) then setElementInterior ( DieingPed1, 5) setTimer( setCameraTarget, 10000, 1, source, DieingPed2) outputChatBox("Type /respawn to respawn immediately.", getRootElement(), 255,0,0,true) setTimer ( spawnPlayer, 4500, 1, source, 2030.2861328125, -1418.5458984375, 16.9921875, 0, mySkin) fadeCamera(source, true, 3, 0,0,0) setCameraTarget(source, source) end end addEventHandler ("onPlayerWasted", root, deathCheck) Edited August 9, 2012 by Guest Link to comment
Castillo Posted August 9, 2012 Share Posted August 9, 2012 setCameraTarget only works with players. Link to comment
Tails Posted August 9, 2012 Author Share Posted August 9, 2012 (edited) Ok, I put in some different functions. The freezing is working, respawn the second time works sometimes, and the Animation isn't working. local DieingPed1 = createPed ( 2336.5439453125, -1172.0966796875, 1031.96875, mySkin ) function deathCheck() local x,y,z = getElementPosition(source) if (isPedDead(source)) then outputChatBox("Type /respawn to respawn immediately.", getRootElement(), 255,0,0,true) setTimer ( setElementInterior, 2900, 1, source, 5) setTimer ( spawnPlayer, 3000, 1, source, 2000.9599609375, -1402.8125, 17.690458297729, 0, mySkin) setTimer (setElementFrozen, 3000, 1, source, true ) end if (isElementFrozen ( source )) then setPedAnimation(source, GANGS, leanIDLE) setTimer ( setElementPosition, 12000, 1, source, 2030.2861328125, -1418.5458984375, 16.9921875) setTimer (setElementFrozen, 12000, 1, source, false) fadeCamera(source, true, 3, 0,0,0) setCameraTarget(source, source) end end addEventHandler ("onPlayerWasted", root, deathCheck) Edited August 9, 2012 by Guest Link to comment
Tete omar Posted August 9, 2012 Share Posted August 9, 2012 You don't have to freeze the player , the animation does that instead .... try this setPedAnimation(source, "GANGS", "leanIDLE") Link to comment
Tails Posted August 9, 2012 Author Share Posted August 9, 2012 (edited) Adding the quotation marks didn't help. The reason I added the freeze function is because I don't want the player to be able to cancel the animation. Also, why does the player sometimes not spawn the second time? local DieingPed1 = createPed ( 2336.5439453125, -1172.0966796875, 1031.96875, mySkin ) function deathCheck ( ) local x,y,z = getElementPosition ( source ) if ( isPedDead ( source ) ) then outputChatBox ("Type /respawn to respawn immediately.", getRootElement ( ), 255,0,0,true ) setTimer ( setElementInterior, 2900, 1, source, 5 ) setTimer ( spawnPlayer, 3000, 1, source, 2000.9599609375, -1402.8125, 17.690458297729, 0, mySkin ) setTimer ( setElementFrozen, 3000, 1, source, true ) end if ( isElementFrozen ( source ) ) then setPedAnimation ( source, "GANGS", "leanIDLE" ) setTimer ( setElementPosition, 12000, 1, source, 2030.2861328125, -1418.5458984375, 16.9921875 ) setTimer ( setElementFrozen, 12000, 1, source, false ) fadeCamera ( source, true, 3, 0,0,0 ) setCameraTarget ( source, source ) end end addEventHandler ( "onPlayerWasted", root, deathCheck ) Edited August 9, 2012 by Guest Link to comment
Tete omar Posted August 9, 2012 Share Posted August 9, 2012 try this local DieingPed1 = createPed ( 2336.5439453125, -1172.0966796875, 1031.96875, mySkin ) function deathCheck ( ) local x,y,z = getElementPosition ( source ) if ( isPedDead ( source ) ) then outputChatBox ("Type /respawn to respawn immediately.", getRootElement ( ), 255,0,0,true ) setTimer ( setElementInterior, 2900, 1, source, 5) setTimer ( spawnPlayer, 3000, 1, source, 2000.9599609375, -1402.8125, 17.690458297729, 0, mySkin ) setElementFrozen( source, true ) setTimer ( setElementFrozen, 3000, 1, source, false ) end if ( isElementFrozen ( source ) ) then setPedAnimation( source, "GANGS", "leanIDLE" ) setTimer ( setElementPosition, 12000, 1, source, 2030.2861328125, -1418.5458984375, 16.9921875 ) setTimer ( setElementFrozen, 12000, 1, source, false ) fadeCamera( source, true, 3, 0,0,0 ) setCameraTarget ( source, source ) end end addEventHandler ( "onPlayerWasted", root, deathCheck ) Link to comment
Tails Posted August 9, 2012 Author Share Posted August 9, 2012 That doesn't work at all and I don't want the player to be frozen right when he dies. Link to comment
Jaysds1 Posted August 9, 2012 Share Posted August 9, 2012 try this: local DieingPed1 = createPed (mySkin,2336.5439453125, -1172.0966796875, 1031.96875)--the skin is the first argument function deathCheck ( ) local x,y,z = getElementPosition ( source ) outputChatBox ("Type /respawn to respawn immediately.", getRootElement ( ), 255,0,0,true ) setTimer ( setElementInterior, 2900, 1, source, 5 ) setTimer ( spawnPlayer, 3000, 1, source, 2000.9599609375, -1402.8125, 17.690458297729, 0, mySkin ) setTimer ( setElementFrozen, 3000, 1, source, true ) setPedAnimation( source, "GANGS", "leanIDLE",-1,true,false,false ) setTimer ( setElementPosition, 12000, 1, source, 2030.2861328125, -1418.5458984375, 16.9921875 ) setTimer ( setElementFrozen, 12000, 1, source, false ) fadeCamera ( source, true, 3, 0,0,0 ) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerWasted", root, deathCheck ) Link to comment
Tails Posted August 9, 2012 Author Share Posted August 9, 2012 Animation is still not working! Link to comment
Jaysds1 Posted August 9, 2012 Share Posted August 9, 2012 Did you got any debug error? Link to comment
Tete omar Posted August 9, 2012 Share Posted August 9, 2012 Yeah i tested it , he got bad argument @ 'createPed' sorry i'm too sleepy to fix that .. but i'm just telling you bye C: Link to comment
Jaysds1 Posted August 9, 2012 Share Posted August 9, 2012 Yeah i tested it , he got bad argument @ 'createPed'sorry i'm too sleepy to fix that .. but i'm just telling you bye C: lol, thanks oh, @Tails, try this: local DieingPed1 = createPed (0,2336.5439453125, -1172.0966796875, 1031.96875)--the skin is the first argument function deathCheck ( ) local x,y,z = getElementPosition ( source ) outputChatBox ("Type /respawn to respawn immediately.",source, 255,0,0 ) setTimer (function() setElementInterior( source, 5 ) spawnPlayer(source, 2000.9599609375, -1402.8125, 17.690458297729, 0, 0) setElementFrozen(source, true ) end, 3000, 1) setPedAnimation(source,"GANGS","leanIDLE",12000,true,false,true,false) setTimer (function() setElementPosition(source, 2030.2861328125, -1418.5458984375, 16.9921875) setElementFrozen(source, false) end, 12000, 1) fadeCamera( source, true, 3) setCameraTarget( source, source ) end addEventHandler ( "onPlayerWasted", root, deathCheck ) Link to comment
Tails Posted August 9, 2012 Author Share Posted August 9, 2012 I tested it, it had no debug errors. And no that script doesn't let me respawn at all Link to comment
Tails Posted August 9, 2012 Author Share Posted August 9, 2012 I just figured, what is more than 1 player dies, everyone will go on to the same bed. I guess I have to stick with the first script then and change the setCameraTarget to something else. Link to comment
Jaysds1 Posted August 9, 2012 Share Posted August 9, 2012 ya, but you could try setting them in different dimensions instead. 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