Jump to content

Comando com tecla


Recommended Posts

Posted
function onRoadblockStart(thePlayer, commandName, parameter)
	if(isRoadblockEditAllowed(thePlayer)) then
		triggerClientEvent(thePlayer, "enableRoadblockGUI", getRootElement(), true)
	end
end
addCommandHandler("rbs", onRoadblockStart, false, false)

Gostaria que quando o player apertasse a tecla F12 esse GUI aparecesse como posso fazer?

  • Moderators
Posted

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

Posted
39 minutes ago, Lord Henry said:
function funcInput ( thePlayer, key, keyState )
  triggerClientEvent(thePlayer, "enableRoadblockGUI", getRootElement(), true)
end

function bindTheKeys ( thePlayer, commandName )
  bindKey ( thePlayer, "F5", "down", funcInput )
end
addCommandHandler ( "bindme", bindTheKeys )

Testei assim e so funciona quando digito bindme no chat, como fazer para sempre estar ativado?

Posted (edited)
21 minutes ago, murilo2929 said:

function funcInput ( thePlayer, key, keyState )
  triggerClientEvent(thePlayer, "enableRoadblockGUI", getRootElement(), true)
end

function bindTheKeys ( thePlayer, commandName )
  bindKey ( thePlayer, "F5", "down", funcInput )
end
addCommandHandler ( "bindme", bindTheKeys )

Testei assim e so funciona quando digito bindme no chat, como fazer para sempre estar ativado?

onPlayerJoin

onPlayerLogin

onResourceStart

Edited by Furzy

FURZY'S CUSTOM WEAPON SYSTEM

Discord: Furzy#4125

 

Posted
6 hours ago, Furzy said:

onPlayerJoin

onPlayerLogin

onResourceStart

function funcInput ( thePlayer, key, keyState )
  triggerClientEvent(thePlayer, "enableRoadblockGUI", getRootElement(), true)
end

function bindTheKeys ( thePlayer, commandName )
  bindKey ( thePlayer, "F5", "down", funcInput )
end
addEventHandler ( "onPlayerJoin", getRootElement(), bindTheKeys )

Tentei assim e  nao deu

  • Moderators
Posted

Os parâmetros de função do evento onPlayerJoin não são esses.

Preste atenção na wiki.

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

  • Moderators
Posted

Linha 5.

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

Posted

Ativar a bind no onPlayerJoin pode causar erro no trigger, visto que o cliente não estará iniciado. Considere trocar o evento para o onPlayerLogin.

Please do not PM me with scripting related question nor support, use the forums instead.

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