zW1Z4RD Posted December 24, 2018 Posted December 24, 2018 function revistar_jogador ( thePlayer, comando, nick ) if nick then if getPlayerFromPartialName ( nick ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "ComandosPolicia") ) then -- Acl Pra Quem Pode Usar o Comando local player_a_ser_revistado = getPlayerFromPartialName ( nick ) local nick_do_jogador = getPlayerName ( player_a_ser_revistado ) local nick_do_policial = getPlayerName ( thePlayer ) local estrelas_de_procurado = getPlayerWantedLevel ( player_a_ser_revistado ) local policiax, policiay, policiaz = getElementPosition ( thePlayer ) -- Encontrar posição do policial local revistadox, revistadoy, revistadoz = getElementPosition ( player_a_ser_revistado ) -- Encontrar posição de quem sera revistado local dist = getDistanceBetweenPoints3D ( policiax, policiay, policiaz, 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[#ff0000POLICIA#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) outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #ff0000Policial #ffffff"..nick_do_policial.." #c1c1c1esta #ff0000Revistando #c1c1c1o #ff0000Suspeito "..nick_do_jogador.."", root, 255, 255, 255, true) -- Chat Box setTimer ( function() outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Nivel de #ff0000Procurado #c1c1c1do #ff0000Suspeito#c1c1c1:"..estrelas_de_procurado.."", thePlayer, 255, 255, 255, true) -- Nivel de procurado do jogador end, 3390, 1 ) triggerClientEvent(thePlayer, "doShowDXProgressBar", thePlayer) -- Chamar evento do client end else outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Você nao tem permissao a este comando!", thePlayer, 255, 255, 255, true) -- Se voce nao for da acl voce nao tera permissao a este comando end end end end addCommandHandler ( "revistar", revistar_jogador ) Quote Estou usando essa função para revistar os jogadores, so que queria por a função para revistar as armas que o jogador tiver, so que não sei como fazer isso se puder me ajudar agradeço.
Jonas^ Posted December 24, 2018 Posted December 24, 2018 Até onde eu sei getPlayerFromPartialName não é uma função nativa, por tanto você tem que adiciona-la no seu script. 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
zW1Z4RD Posted December 24, 2018 Author Posted December 24, 2018 function revistar_jogador ( thePlayer, comando, nick ) if nick then if getPlayerFromPartialName ( nick ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "ComandosPolicia") ) then -- Acl Pra Quem Pode Usar o Comando local player_a_ser_revistado = getPlayerFromPartialName ( nick ) local nick_do_jogador = getPlayerName ( player_a_ser_revistado ) local nick_do_policial = getPlayerName ( thePlayer ) local estrelas_de_procurado = getPlayerWantedLevel ( player_a_ser_revistado ) local policiax, policiay, policiaz = getElementPosition ( thePlayer ) -- Encontrar posição do policial local revistadox, revistadoy, revistadoz = getElementPosition ( player_a_ser_revistado ) -- Encontrar posição de quem sera revistado local dist = getDistanceBetweenPoints3D ( policiax, policiay, policiaz, 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[#ff0000POLICIA#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) outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #ff0000Policial #ffffff"..nick_do_policial.." #c1c1c1esta #ff0000Revistando #c1c1c1o #ff0000Suspeito "..nick_do_jogador.."", root, 255, 255, 255, true) -- Chat Box setTimer ( function() outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Nivel de #ff0000Procurado #c1c1c1do #ff0000Suspeito#c1c1c1:"..estrelas_de_procurado.."", thePlayer, 255, 255, 255, true) -- Nivel de procurado do jogador end, 3390, 1 ) triggerClientEvent(thePlayer, "doShowDXProgressBar", thePlayer) -- Chamar evento do client end else outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Você nao tem permissao a este comando!", thePlayer, 255, 255, 255, true) -- Se voce nao for da acl voce nao tera permissao a este comando end end end end addCommandHandler ( "revistar", revistar_jogador ) 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 Quote No caso isso ai?
DNL291 Posted December 25, 2018 Posted December 25, 2018 (edited) 1 hour ago, zW1Z4RD said: No caso isso ai? Sim. 3 hours ago, zW1Z4RD said: Estou usando essa função para revistar os jogadores, so que queria por a função para revistar as armas que o jogador tiver, so que não sei como fazer isso se puder me ajudar agradeço. Revistar as armas de que forma? Pra verficiar as armas use a função getPedWeapon, no 2º argumento você especifica o slot que é 0-12. Edited December 25, 2018 by DNL291 Please do not PM me with scripting related question nor support, use the forums instead.
zW1Z4RD Posted December 25, 2018 Author Posted December 25, 2018 5 hours ago, DNL291 said: Sim. Revistar as armas de que forma? Pra verficiar as armas use a função getPedWeapon, no 2º argumento você especifica o slot que é 0-12. function revistar_jogador ( thePlayer, comando, nick ) if nick then if getPlayerFromPartialName ( nick ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "ComandosPolicia") ) then -- Acl Pra Quem Pode Usar o Comando local player_a_ser_revistado = getPlayerFromPartialName ( nick ) local nick_do_jogador = getPlayerName ( player_a_ser_revistado ) local nick_do_policial = getPlayerName ( thePlayer ) local estrelas_de_procurado = getPlayerWantedLevel ( player_a_ser_revistado ) local policiax, policiay, policiaz = getElementPosition ( thePlayer ) -- Encontrar posição do policial local revistadox, revistadoy, revistadoz = getElementPosition ( player_a_ser_revistado ) -- Encontrar posição de quem sera revistado local dist = getDistanceBetweenPoints3D ( policiax, policiay, policiaz, 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[#ff0000POLICIA#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) outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #ff0000Policial #ffffff"..nick_do_policial.." #c1c1c1esta #ff0000Revistando #c1c1c1o #ff0000Suspeito "..nick_do_jogador.."", root, 255, 255, 255, true) -- Chat Box setTimer ( function() outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Nivel de #ff0000Procurado #c1c1c1do #ff0000Suspeito#c1c1c1:"..estrelas_de_procurado.."", thePlayer, 255, 255, 255, true) -- Nivel de procurado do jogador end, 3390, 1 ) triggerClientEvent(thePlayer, "doShowDXProgressBar", thePlayer) -- Chamar evento do client end else outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Você nao tem permissao a este comando!", thePlayer, 255, 255, 255, true) -- Se voce nao for da acl voce nao tera permissao a este comando end end end end addCommandHandler ( "revistar", revistar_jogador ) 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_arma ( thePlayer, _, nick ) if ( verificar_arma ) or (getPedWeapon (thePlayer, 0) == 1 or 2 or 3 or 4 or 5 or 6 or 9 or 22 or 24 or 25 or 26) then outputChatBox ( "Jogador possui arma de fogo" ) else outputChatBox ( "Jogador nao possui arma de fogo." ) end end end end end addCommandHandler("revarm", revistar_arma) Quote Isso?
Moderators Lord Henry Posted December 25, 2018 Moderators Posted December 25, 2018 Não. Isso não existe: or 2 or 3 or 4 or 5 or 6 or 9 or 22 or 24 or 25 or 26) then E pq vc fica citando a si mesmo em vez de mandar mensagem normal? 2 Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! 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.
zW1Z4RD Posted December 25, 2018 Author Posted December 25, 2018 1 hour ago, Lord Henry said: Não. Isso não existe: or 2 or 3 or 4 or 5 or 6 or 9 or 22 or 24 or 25 or 26) then E pq vc fica citando a si mesmo em vez de mandar mensagem normal? A quer sabe n tou entendendo mais nada ksksks deixa pra la vlw do mesmo jeito
Gw8 Posted December 25, 2018 Posted December 25, 2018 function revistar_jogador(player,cmd,nick) local accName = getAccountName(getPlayerAccount(player)) if not isObjectInACLGroup ("user."..accName,aclGetGroup("ComandosPolicia")) then return outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Você nao tem permissao a este comando!",player,255,255,255,true) end local toPlayer = getPlayerFromPartialName(nick) if not toPlayer then return outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1nick invalido!",player,255,255,255,true) end local toPlayerName = getPlayerName(toPlayer) local playerName = getPlayerName(player) local toPlayerWantedLv = getPlayerWantedLevel(toPlayer) local px,py,pz = getElementPosition(player) local tpx,tpy,tpz = getElementPosition(toPlayer) local dist = getDistanceBetweenPoints3D(px,py,pz,tpx,tpy,tpz) if dist >= 5 then outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Chegue Mais Perto Do Jogador Pra Executar Este Comando!",player,255,255,255,true) else setPedAnimation(player,"POLICE","plc_drgbst_01",3100,true,false,false,false) checar_armas(player,toPlayer) outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #ff0000Policial #ffffff"..playerName.." #c1c1c1esta #ff0000Revistando #c1c1c1o #ff0000Suspeito "..toPlayerName,root,255,255,255,true) setTimer(outputChatBox,3390,1,"#000000[#ff0000POLICIA#000000] #c1c1c1Nivel de #ff0000Procurado #c1c1c1do #ff0000Suspeito#c1c1c1:"..toPlayerWantedLv,player,255,255,255,true) triggerClientEvent(player,"doShowDXProgressBar",root) end end addCommandHandler("revistar",revistar_jogador) function checar_armas(player,toPlayer) for i=1,12 do local weaponID = getPedWeapon(toPlayer,i) if weaponID~=0 then outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Arma encontrada:"..getWeaponNameFromID(weaponID),player,255,255,255,true) end end end 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 é tipo isso? 1
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