Jump to content

Close Gui when you die


Annas

Recommended Posts

Hello , just i wanna when a player Die , Close the Panel.

i use this:

CLIENT SIDE:

  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[3] = guiCreateWindow(165, 45, 861, 603, "PANEL", false) 
) 
  
function gui (key,keyst) 
local bool = not guiGetVisible(GUIEditor.window[3]) 
if getElementInterior(localPlayer) ~= 0 then outputChatBox("You can't open store menu in other interior",255,0,0) return end 
if isPedDead(localPlayer) then outputChatBox("You can't open store menu when you are dead!",255,0,0) return end 
guiSetVisible(GUIEditor.window[3],bool) 
showCursor(bool) 
refresh() 
end 
bindKey ( "F1", "down", gui ) 
  

I do it , if you dead you cannot open the gui and if you are in interior , you cannor open the gui

but i need it, if the gui is showed, it must be closed when u die, i mean

if i click F1 and it shows, then i killed my self & let the panel showing, so the panel didnt destroyed.

i tried to do this too

CLIENT SIDE

function detected(player) 
if isPedDead(player) then  
guiSetVisible(GUIEditor.window[3],false) 
showCursor(false) 
outputChatBox("Due To Abuse F1 Panel Destroyed",player,255,0,0) 
end 

(script working, but just i need the panel destroyed when i kill my self )

what is my problem ?

""press F1 => /kill (kill ped) => [[PANEL STILL]]""

i wish you understand my bad english :mrgreen:

Link to comment

server

function hideGUIOnPlayerDeath() 
    triggerClientEvent( source, "closePANEL", source ) 
end 
addEventHandler( "onPlayerWasted", root, hideGUIOnPlayerDeath )  

client

function hideGUIOnPlayerDeath() 
    if guiGetVisible( GUIEditor.window[3] ) then 
        guiSetVisible( GUIEditor.window[3], false ) 
    end 
end 
addEvent("closePANEL",true) 
addEventHandler( "closePANEL", root, hideGUIOnPlayerDeath ) 

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