Jump to content

The gui show upp for all when a player die


villr

Recommended Posts

Posted

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?? :?::?:

Posted

looks fine, should be visible only for local player O_O - maybe theres a bug, but bugtracker is down..

try onClientPedWasted instead (attached to getLocalPlayer() of course) - it's almost the same

Posted

so i dont will remove getLocalPlayer?

It will be on same place?

And remove OnClientplayerblablabla

adn put in OnClientped blabla?

  • Discord Moderators
Posted
so i dont will remove getLocalPlayer?

It will be on same place?

And remove OnClientplayerblablabla

adn put in OnClientped blabla?

Sounds like it

Posted

hmm i get a error about getlocalplayer

attempt to call global 'getLocalPlayer'

It what error said

I havent try it yet but why it comes a error?

Posted

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?

Posted

Oh that error code was from a other script :P Sorry for that but we have try the script but it dont work so u know how to fix it or u think its a bug?

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

Posted

Haha im very ^^ so what shold be there? Is the -- a nedd or something or should i remove the last one or something?

Haha im just a little^^^^ nooby:P

Im a new scripter

Posted

maybe try:

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

Posted

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) 
  

Posted

The code dosent work :(

Still when a player die the gui show up :(

Do the gui need to be in a window or something beacuse my spawning gui is only a gridlist...?

Posted
post your current script

Code or script?

With script do u mean all in the script or only codes?

I wanna send them in msn if u goot :P

Posted

Could You please use edit button instead of triple posting?

I meant the part that is not working.probably same part as in first post.id like to see what have you changed since first post

Posted

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) 
  
  

Posted

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 
) 
  

Posted

I will try that new code :)

hope it works

If u mean that /debugscript so yea i heard about it

Its not on my server im testing but im admin there so i can check and the gui are showing upp for people when the die but i will try the new

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