Jump to content

how to show the respawn buton after 1mn then respawn


Neffax

Recommended Posts

addEvent("fadeCameraOnSpawn", true)
 
addEventHandler("fadeCameraOnSpawn", getLocalPlayer(),
 
    function()
 
        start = getTickCount()
 
    end
 
)
 
local bRespawn = nil
 
 function showRespawnButton(victimDropItem)
 
    local width, height = 201,54
 
    local scrWidth, scrHeight = guiGetScreenSize()
 
    local x = scrWidth/2 - (width/2)
 
    local y = scrHeight/1.1 - (height/2)
 
    bRespawn = guiCreateButton(x, y, width, height,"Respawn",false)
 
        guiSetFont(bRespawn,"sa-header")
   
   
    addEventHandler("onClientGUIClick", bRespawn, function ()
   
   
        if bRespawn then
 
            destroyElement(bRespawn)
 
            bRespawn = nil
 
            showCursor(false)
 
            guiSetInputEnabled(false)
 
        end
 
        triggerServerEvent("es-system:acceptDeath", getLocalPlayer(), getLocalPlayer(), victimDropItem)
   
        showCursor(false)
 
    end, false)
 
end
 
addEvent("es-system:showRespawnButton", true)
 
addEventHandler("es-system:showRespawnButton", getLocalPlayer(),showRespawnButton)


 
function closeRespawnButton()
 
    if bRespawn then
 
        destroyElement(bRespawn)
 
        bRespawn = nil
 
        showCursor(false)
 
        guiSetInputEnabled(false)
 
    end
 
end
 
addEvent("es-system:closeRespawnButton", true)
 
addEventHandler("es-system:closeRespawnButton", getLocalPlayer(),closeRespawnButton)
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...