Jump to content

Voice


Recommended Posts

Opa bom eu consigui fazer um sisteminha que identifica quando o player ativa o voice porem eu gostaria fazer quando ele ativar desabilitar o dxtext "desativado" , para que fique apenas o "ativado"

		local fala = dxDrawText("Desativado", x*500, y*100, x*1132, y*37, tocolor(255, 0, 0, 221), 1.00, font, "left", "top", false, false, false, true, false)
		if (getElementData(localPlayer, "falando")) then fala2 = dxDrawText("Ativado", x*500, y*100, x*1132, y*37, tocolor(0, 255, 0, 221), 1.00, font, "left", "top", false, false, false, true, false) end



--------------
addEventHandler ( "onClientPlayerVoiceStart", root, function() 
    if (source and isElement(source) and getElementType(source) == "player") and localPlayer == source then
        setElementData(source, "falando", true);
    end 
end );

addEventHandler ( "onClientPlayerVoiceStop", root,function()
    if (source and isElement(source) and getElementType(source) == "player") and localPlayer == source then
        setElementData(source, "falando", false);
    end
end);

 

Link to comment

-- Clientside

addEventHandler("onClientRender",root,
	function()
		local fala = getElementData('falando') or false
		if fala == true then
			dxDrawText("Ativado", x*500, y*100, x*1132, y*37, tocolor(0, 255, 0, 221), 1.00, font, "left", "top", false, false, false, true, false)
		else
			dxDrawText("Desativado", x*500, y*100, x*1132, y*37, tocolor(255, 0, 0, 221), 1.00, font, "left", "top", false, false, false, true, false)
		end
	end
)

addEventHandler ( "onClientPlayerVoiceStart", root, function() 
    if (source and isElement(source) and getElementType(source) == "player") and localPlayer == source then
        setElementData(source, "falando", true);
    end 
end );

addEventHandler ( "onClientPlayerVoiceStop", root,function()
    if (source and isElement(source) and getElementType(source) == "player") and localPlayer == source then
        setElementData(source, "falando", false);
    end
end);

 

 

  • Thanks 1
Link to comment
8 hours ago, Rut said:

-- Clientside


addEventHandler("onClientRender",root,
	function()
		local fala = getElementData('falando') or false
		if fala == true then
			dxDrawText("Ativado", x*500, y*100, x*1132, y*37, tocolor(0, 255, 0, 221), 1.00, font, "left", "top", false, false, false, true, false)
		else
			dxDrawText("Desativado", x*500, y*100, x*1132, y*37, tocolor(255, 0, 0, 221), 1.00, font, "left", "top", false, false, false, true, false)
		end
	end
)

addEventHandler ( "onClientPlayerVoiceStart", root, function() 
    if (source and isElement(source) and getElementType(source) == "player") and localPlayer == source then
        setElementData(source, "falando", true);
    end 
end );

addEventHandler ( "onClientPlayerVoiceStop", root,function()
    if (source and isElement(source) and getElementType(source) == "player") and localPlayer == source then
        setElementData(source, "falando", false);
    end
end);

 

 

esta como desativado porem quando ativo o voice ele n troca e no debug esta dando erro nessa linha       

		local fala = getElementData('falando') or false

erro debug :bad argumente @ 'getElementData' [Expected element at argument 1, got string 'falando']

Link to comment
2 hours ago, HG Snuuk said:

esta como desativado porem quando ativo o voice ele n troca e no debug esta dando erro nessa linha       


		local fala = getElementData('falando') or false

erro debug :bad argumente @ 'getElementData' [Expected element at argument 1, got string 'falando']

Esqueci de especificar o item, desculpe

como o usuário acima colocou:

 

local fala = getElementData(localPlayer,'falando') or false

 

  • Like 1
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...