Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

481
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!