Katorzzee Posted February 18, 2018 Posted February 18, 2018 (edited) Pessoal estou com um problema em um "script" que estou fazendo obs : sou bem leigo em programação lua Bom Quero Fazer Um Script Que Quando O Jogador Digitar /hab Vai Aparecer No Chat O Nome Dele e Que Possui Ou Não A Habilitação , So que Quando Eu Coloco O getPlayerName Da Um Erro No Console Bem Assim : attempt to concatenate local 'nick_do_jogador' < a boolean value > Quote function auto ( ) if ( not getElementData ( thePlayer, "carLicense" ) and not isVehicleNoNeed ( getElementModel ( source )) ) then local nick_do_jogador = getPlayerName ( true ) outputChatBox("#000000[#ff0000POLICIA#000000] #bebebeO Player : "..nick_do_jogador.." #ff0000Não #bebebePossui Habilitação!", root, 255, 255, 255, true) else outputChatBox("#000000[#ff0000POLICIA#000000] #bebebeO Player : "..nick_do_jogador.." #04B404Possui #bebebeHabilitação !", root, 255, 255, 255, true) end end addCommandHandler ("hab", auto ) Agradeço Muito A Quem Me Ajudar Edited February 18, 2018 by Katorzzee
DNL291 Posted February 18, 2018 Posted February 18, 2018 (edited) Tente: function auto ( player ) local vehicle = getPedOccupiedVehicle(player) local nick_do_jogador = getPlayerName ( player ) if not getElementData ( player, "carLicense" ) then if vehicle and not isVehicleNoNeed ( getElementModel ( vehicle )) then -- não entendi qual vai ser o uso dessa função end outputChatBox("#000000[#ff0000POLICIA#000000] #bebebeO Player : "..nick_do_jogador.." #ff0000Não #bebebePossui Habilitação!", root, 255, 255, 255, true) elseif getElementData ( player, "carLicense" ) then outputChatBox("#000000[#ff0000POLICIA#000000] #bebebeO Player : "..nick_do_jogador.." #04B404Possui #bebebeHabilitação !", root, 255, 255, 255, true) end end addCommandHandler ("hab", auto ) Edited February 18, 2018 by DNL291 1
Other Languages Moderators Lord Henry Posted February 19, 2018 Other Languages Moderators Posted February 19, 2018 O erro acontece pois você está tentando obter o nome de um true (valor booleano) em vez de um jogador. Além disso, você não declarou em lugar nenhum thePlayer, isso significa que o getElementData ali sempre será false. E também não entendi pra que serve esse isVehicleNoNeed, que também não foi declarado em lugar nenhum e portanto não funciona. Uma pergunta: Essa mensagem do chat deve aparecer somente no chat do jogador que digitou /hab? Ou deve aparecer no chat de todo mundo? 2
Katorzzee Posted February 20, 2018 Author Posted February 20, 2018 hm obrigado Lord Henry deu certo aqui , sou bem iniciante em lua. Sim aquela mensagem é para aparecer no chat de todo mundo
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now