Deniel Posted September 21, 2019 Share Posted September 21, 2019 function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function revistar_jogador ( thePlayer, comando, nick ) if nick then if getPlayerFromPartialName ( nick ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Everyone") ) then -- Acl Pra Quem Pode Usar o Comando local player_a_ser_revistado = getPlayerFromPartialName ( nick ) local dinheiro_do_jogador = getPlayerMoney ( thePlayer, dinheiro_jogador ) local jogadorx, jogadory, jogadorz = getElementPosition ( thePlayer ) local revistadox, revistadoy, revistadoz = getElementPosition ( player_a_ser_revistado ) -- Encontrar posição de quem sera revistado local dist = getDistanceBetweenPoints3D ( jogadorx, jogadory, jogadorz, revistadox, revistadoy, revistadoz ) -- Calcular a distancia entre os dois elementos if ( dist > 5 ) then -- se a distancia for 5 executara a função a seguir outputChatBox("#000000[#808080Anônimo#000000] #c1c1c1Chegue Mais Perto Do Jogador Pra Executar Este Comando!", thePlayer, 255, 255, 255, true) -- Chat Box elseif ( dist < 4 )then -- Caso ao contrario a distancia for 4 executara a função a seguir setPedAnimation( thePlayer, "POLICE", "plc_drgbst_01", 3100, true, false, false, false) setTimer ( function() outputChatBox("#000000[#808080Anônimo#000000] #FFFF00Dinheiro do #ff0000Cidadão #00FF00:"..dinheiro_do_jogador.."", thePlayer, 255, 0, 0, true) end, 3390, 1 ) triggerClientEvent(thePlayer, "doShowDXProgressBar", thePlayer) end end end end end addCommandHandler ( "revi", revistar_jogador ) Este é o Server.Lua onde estou com o problema de revistar porém aparece sempre meu dinheiro e não o do outro player. Link to comment
Other Languages Moderators Lord Henry Posted September 21, 2019 Other Languages Moderators Share Posted September 21, 2019 Errou na linha 19. Pra começar vc colocou 2 parâmetros, sendo que a função só usa 1. Além disso, os dois parâmetros estão errados. local dinheiro_do_jogador = getPlayerMoney (player_a_ser_revistado) 1 Link to comment
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