Sign in to follow this  
killingyasoon

how to disable f1 if player is muted.

Recommended Posts

Add isPlayerMuted check in the function that handles F1 to check whether the player is muted or not.

Share this post


Link to post
function checkPlyer(thePlayer)
   if isPlayerMuted(thePlayer) then
      triggerClientEvent()
    end
  end

something like that

Share this post


Link to post
function binds()
	bindKey(KeyToOpen or "F1","down", function ()  
		guiSetVisible(panel,not guiGetVisible(panel) )
		showCursor(guiGetVisible(panel))
		if guiGetVisible(panel) == true then mode = "no_binds_when_editing" else mode = "allow_binds" end
		guiSetInputMode(mode or "allow_binds")
	end
	end )

can you add it here? if possible

Share this post


Link to post
function noOpengui(thePlayer)
  if isPlayerMuted(thePlayer) then
    triggerClientEvent(thePlayer, "blockWindow", root)
  end
end
function binds()
	bindKey(KeyToOpen or "F1","down", function ()  
		guiSetVisible(panel,false )
		showCursor(guiGetVisible(panel))
		if guiGetVisible(panel) == true then mode = "no_binds_when_editing" else mode = "allow_binds" end
		guiSetInputMode(mode or "allow_binds")
	end
	end )
addEvent("blockWindow", true)
addEventHandler("blockWindow", root, binds)

 

Share this post


Link to post

Server: 

function CheckMute ()
    if isPlayerMuted ( source ) then
  		setElementData(source,"Muted",true);
    else
      setElementData(source,"Muted",false);
    end
end
addEventHandler("onPlayerMute", root,CheckMute)
addEventHandler("onPlayerJoin", root,CheckMute)

Client:

bindKey(KeyToOpen or "F1","down", function ()
    if getElementData(localPlayer,"Muted") then return end
    guiSetVisible(panel,false )
    showCursor(guiGetVisible(panel))
    if guiGetVisible(panel) == true then mode = "no_binds_when_editing" else mode = "allow_binds" end
    guiSetInputMode(mode or "allow_binds")
  end
end)

 

Edited by XisH

Share this post


Link to post
function blockWindow() 
  local muted =getElementData(localPlayer, "muted") 
  if muted == true then 
     guiSetVisible(panel, false) 
    end 
end
function noOpengui(thePlayer) 
  if isPlayerMuted(thePlayer) then
     setElementData(thePlayer, "muted", true) 
  else
      setElementData(thePlayer, "muted", false) 
    end 
end 

Try that

Share this post


Link to post
22 hours ago, killingyasoon said:

none of both are working, sorry ik i am a :O, but i need your help.

What do you get in debugscript? Also, are you using the SERVER part in a server file?

Since it looks really weird to me

Edited by XisH

Share this post


Link to post
2 hours ago, XisH said:

What do you get in debugscript? Also, are you using the SERVER part in a server file?

Since it looks really weird to me

no :~ in debugscript, yes i do i'm using the server part in server file, and idk how it's not working.

Share this post


Link to post

Take a look in the whole code if there's more than one bindkey on f1, because it seems impossible, the code should work...

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.