Jump to content

Duvida no painel login e teclas


Recommended Posts

2 hours ago, DNL291 said:

Lado server com isGuestAccount, no cliente você pode setar element-data.

No entanto, você pode ocultar o chat para o jogador que entrar no server com showChattoggleControl para não usá-lo. E habilitando ao jogador no evento onPlayerLogin.

@+William

Consegui retirar o chat, mas os F1,F2,...,F11, continuam funcionando, como faço para "tirar" essas teclas na hora do login? Qual função eu uso?

addEventHandler ( 'onPlayerLogin', getRootElement ( ),
    function (button, press)
        sourceAccount = getPlayerAccount ( source )
        if isGuestAccount ( sourceAccount ) then
            if isChatVisible() then 
                showChat(false)
                cancelEvent()
            else
                showChat(true) 
   
            end         
        end
end
)

 

Link to comment
  • Moderators

Você está misturando funções server com client.

Para as teclas você pode fazer isto:

local blockedKeys = {
	["F1"] = true, ["F2"] = true, ["F3"] = true, ["F4"] = true, ["F5"] = true, ["F6"] = true, ["F7"] = true,
	["F8"] = true, ["F9"] = true, ["F10"] = true, ["F11"] = true
}

function playerPressedKey(button, press)
	if (press) and blockedKeys[button] then
		cancelEvent()
	end
end
addEventHandler("onClientKey", root, playerPressedKey)

addEvent("onLogin:allowBinds", true)
addEventHandler("onLogin:allowBinds", root, function()

	removeEventHandler("onClientKey", root, playerPressedKey)
end)

E chamar o evento "onLogin:allowBinds" no evento server onPlayerLogin:

addEventHandler("onPlayerLogin", root, function()
	triggerClientEvent(source, "onLogin:allowBinds", source)
end)

 

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