Jump to content

[HELP] Parachute resource


-Xero

Recommended Posts

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)

 

Link to comment
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)

 

Link to comment

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

 

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