Jump to content

[HELP] Parachute resource


-Xero

Recommended Posts

Posted

Hi, i tried to make a resource to spawn with parachute every time player has death, but dont work, what is wrong ? if i put onplayerspawn, spawns with parachute every time logged in, i only need spawns with parachute only when the player is death, some like OnplayerRespawn ?

function onPlayerWasted()
	giveWeapon(source,getWeaponIDFromName("parachute"),1,true)
end
addEventHandler("onPlayerWasted",getRootElement(),onPlayerWasted)

 

Posted
2 hours ago, -Xero said:

Hi, i tried to make a resource to spawn with parachute every time player has death, but dont work, what is wrong ? if i put onplayerspawn, spawns with parachute every time logged in, i only need spawns with parachute only when the player is death, some like OnplayerRespawn ?


function onPlayerWasted()
	giveWeapon(source,getWeaponIDFromName("parachute"),1,true)
end
addEventHandler("onPlayerWasted",getRootElement(),onPlayerWasted)

 

Try with this 

function onPlayerWasted()
	giveWeapon(source, 46, 1)
end
addEventHandler("onPlayerWasted",getRootElement(),onPlayerWasted)

 

Posted

Using onPlayerWasted, set a client check variable to true (e.g. playerNeedsParachute = true). When you spawn the player, give the parachute if your variable is true and set it back to false.

BHgi29I.png
  Dystopia alpha 0.75
DOWNLOAD

Posted

you need to add it as spawn, because onplayerwasted = player is dead, so on next spawn he will have nothing, you can use something like:

function ImWasted()

    setElementData(source, "state", "Wasted")
    setTimer(ImGonnaRespawn, 2000, 1, source)

end

function ImGonnaRespawn(player)

    if not isElement(player) then return end

    local element = getElementParent(player)
    
    if getElementData(player, "state") ~= "Wasted" then return end

    repeat until spawnPlayer ( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(312), 0, 0) 
    fadeCamera(player, true) 
    setCameraTarget(player, player) 
    showChat(player, true) 
    toggleAllControls(player, true, true, true)
    giveWeapon(player, 46, 1)
    setElementData(player, "state", "ImAlive")


end

 

430x73_FFFFFF_FF9900_000000_000000.png

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