Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

483
Visualizações
Script de Fivem: alternar la identificación sobre la cabeza configurada como falsa después de 5 segundos

tengo la siguiente funcion

 disPlayerNames = 10 --distance you see IDs at keyToToggleIDs = 20 --left alt by default playerDistances = {} showIDsAboveHead = false Citizen.CreateThread(function() while true do if IsControlPressed(0, keyToToggleIDs) then showIDsAboveHead = not showIDsAboveHead print("changed") Wait(0) end Wait(50) end end) Citizen.CreateThread(function() while true do for id = 0, 255 do if GetPlayerPed(id) ~= GetPlayerPed(-1) then x1, y1, z1 = table.unpack(GetEntityCoords(GetPlayerPed(-1), true)) x2, y2, z2 = table.unpack(GetEntityCoords(GetPlayerPed(id), true)) distance = math.floor(GetDistanceBetweenCoords(x1, y1, z1, x2, y2, z2, true)) playerDistances[id] = distance end end Citizen.Wait(1000) end end) Citizen.CreateThread(function() while true do if showIDsAboveHead then for id = 0, 255 do if NetworkIsPlayerActive(id) then if GetPlayerPed(id) ~= GetPlayerPed(-1) then if (playerDistances[id] < disPlayerNames) then x2, y2, z2 = table.unpack(GetEntityCoords(GetPlayerPed(id), true)) if NetworkIsPlayerTalking(id) then DrawText3D(x2, y2, z2+1, GetPlayerServerId(id), 247,124,24) else DrawText3D(x2, y2, z2+1, GetPlayerServerId(id), 255,255,255) end end end end end end Citizen.Wait(0) end end) function DrawText3D(x,y,z, text, r,g,b) local onScreen,_x,_y=World3dToScreen2d(x,y,z) local px,py,pz=table.unpack(GetGameplayCamCoords()) local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1) local scale = (1/dist)*2 local fov = (1/GetGameplayCamFov())*100 local scale = scale*fov if onScreen then SetTextScale(0.0*scale, 0.55*scale) SetTextFont(0) SetTextProportional(1) SetTextColour(r, g, b, 255) SetTextDropshadow(0, 0, 0, 0, 255) SetTextEdge(2, 0, 0, 0, 150) SetTextDropShadow() SetTextOutline() SetTextEntry("STRING") SetTextCentre(1) AddTextComponentString(text) DrawText(_x,_y) end end

Sin embargo, la función funciona bien, en este momento debe presionar la tecla para alternar la identificación y luego presionarla nuevamente para desactivarla.

Necesito editar la función para mostrar la identificación al presionar el control solo durante 5 segundos y luego establecer showIDsAboveHead en falso.

También necesito agregar una animación dpemote al presionar el control. La animación se llama think3. Intenté hacerlo con RegisterCommand pero no funciona.

¿Alguien puede ayudar? ¡Gracias!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Tiene un nativo llamado IsControlJustPressed que es verdadero una vez cuando se presiona el control (y no continuamente verdadero como IsControlPressed )

Cambiar tu ciclo a esto debería funcionar

 Citizen.CreateThread(function() while true do if IsControlJustPressed(0, keyToToggleIDs) then showIDsAboveHead = true Citizen.Wait(5000) showIDsAboveHead = false end Wait(50) end end)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda