Jump to content

The gui show upp for all when a player die


villr

Recommended Posts

Hi im making a rpg script right now and when a player die i want the gui to show up again but when a player dies it show for all...

Here is code

addEventHandler( "onClientPlayerWasted", getLocalPlayer( ), 
    function( ) 
          guiSetVisible (spawnmenugrid, true ) 
          guiSetVisible(spawnmenumemo,true) 
          showCursor ( true ) 
          showPlayerHudComponent("radar",false) 
                showChat(false) 
    end) 
  

What is wrong?

Why does it show for all?? :?::?:

Link to comment

The code is now

addEventHandler( "onClientPedWasted",getLocalPlayer()), 
    function( ) 
          guiSetVisible (spawnmenugrid, true ) 
          guiSetVisible(spawnmenumemo,true) 
          showCursor ( true ) 
          showPlayerHudComponent("radar",false) 
                showChat(false) 
    end) 
  

Is it right?

Link to comment
  
addEventHandler( "onClientPedWasted",getLocalPlayer(), -- one ) goes out 
    function( ) 
          guiSetVisible (spawnmenugrid, true ) 
          guiSetVisible(spawnmenumemo,true) 
          showCursor ( true ) 
          showPlayerHudComponent("radar",false) 
                showChat(false) 
    end) 
  

Link to comment

maybe try:

addEventHandler( "onClientPlayerWasted", getLocalPlayer( ), 
     function( ) 
          if source == getLocalPlayer( ) 
           guiSetVisible (spawnmenugrid, true ) 
           guiSetVisible(spawnmenumemo,true) 
          showCursor ( true ) 
          showPlayerHudComponent("radar",false) 
               showChat(false) 
         end 
     end) 

Link to comment

after -- there is my comment (lua will not parse anthing after --) about what you did wrong in last script.

you can copy & paste and use it, even with that comment

Wojak fixed script: (his idea can be good one, if onClientPlayerWasted triggers for all players even when attached to getLocalPlayer() - but have you tried onClientPedWasted successfully?)

  
addEventHandler( "onClientPlayerWasted", getLocalPlayer( ), 
     function( ) 
          if source == getLocalPlayer( ) then -- Wojak forgot about "then" here 
           guiSetVisible (spawnmenugrid, true ) 
           guiSetVisible(spawnmenumemo,true) 
          showCursor ( true ) 
          showPlayerHudComponent("radar",false) 
               showChat(false) 
         end 
     end) 
  

Link to comment

Hmm im starting to think about one thing in script...

What are the funciton doing is it requied or i need to remove it??

First script was

addEventHandler( "onClientPlayerWasted", getLocalPlayer( ), 
    function( ) 
          guiSetVisible (spawnmenugrid, true ) 
          guiSetVisible(spawnmenumemo,true) 
          showCursor ( true ) 
          showPlayerHudComponent("radar",false) 
                showChat(false) 
    end) 
  
  

and now it is

addEventHandler( "onClientPlayerWasted", getLocalPlayer( ), 
     function( ) 
          if source == getLocalPlayer( ) then -- Wojak forgot about "then" here 
           guiSetVisible (spawnmenugrid, true ) 
           guiSetVisible(spawnmenumemo,true) 
          showCursor ( true ) 
          showPlayerHudComponent("radar",false) 
               showChat(false) 
         end 
     end) 
  
  

Link to comment

and is it working or not?

even heard about debugging?

  
addEventHandler( "onClientPlayerWasted", getLocalPlayer( ), 
  function( ) 
    if source == getLocalPlayer( ) then -- Wojak forgot about "then" here 
      local name = getPlayerName(source) 
      outputDebugString("player that died: "..name..", local player: "..getPlayerName(getLocalPlayer())) 
      guiSetVisible (spawnmenugrid, true ) 
      guiSetVisible(spawnmenumemo,true) 
      showCursor ( true ) 
      showPlayerHudComponent("radar",false) 
      showChat(false) 
    end 
  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...