Advertisement
Guest User

talking scrpt

a guest
Sep 2nd, 2023
871
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. local talkingPlayers = {}
  2.  
  3. function UpdateTalkingPlayers()
  4. local localPlayer = PlayerId()
  5. local localPlayerTalking = NetworkIsPlayerTalking(localPlayer)
  6.  
  7. talkingPlayers = {}
  8.  
  9. for _, player in ipairs(GetActivePlayers()) do
  10. local isTalking = NetworkIsPlayerTalking(player)
  11. if isTalking then
  12. if player ~= localPlayer then
  13. table.insert(talkingPlayers, GetPlayerName(player))
  14. end
  15. end
  16. end
  17.  
  18. if localPlayerTalking then
  19. table.insert(talkingPlayers, GetPlayerName(localPlayer))
  20. end
  21. end
  22.  
  23. function DisplayTalkingPlayers()
  24. if #talkingPlayers > 0 then
  25. local currentlyTalkingText = "Talking"
  26. SetTextScale(0.43, 0.43)
  27. SetTextColour(240, 160, 0, 255) -- Red text
  28. SetTextFont(4)
  29. SetTextProportional(1)
  30. SetTextCentre(true)
  31. SetTextDropshadow(6, 0, 0, 0, 255) -- Thicker black outline
  32. SetTextEdge(6, 0, 0, 0, 255)
  33.  
  34. -- Display "Currently Talking" text with black underline
  35. SetTextEntry("STRING")
  36. AddTextComponentString(currentlyTalkingText)
  37. DrawText(0.03, 0.4)
  38.  
  39. local text = table.concat(talkingPlayers, "\n")
  40. SetTextScale(0.43, 0.43)
  41. SetTextColour(255, 255, 255, 255) -- White text
  42. SetTextFont(4)
  43. SetTextProportional(1)
  44. SetTextCentre(true)
  45. SetTextDropshadow(6, 0, 0, 0, 255) -- Thicker black outline
  46. SetTextEdge(6, 0, 0, 0, 255)
  47.  
  48. -- Display player names immediately below "Currently Talking" text
  49. SetTextEntry("STRING")
  50. AddTextComponentString(text)
  51. DrawText(0.045, 0.425)
  52. end
  53. end
  54.  
  55. Citizen.CreateThread(function()
  56. while true do
  57. Citizen.Wait(200) -- Decrease the wait time to 200 milliseconds (0.2 seconds)
  58. UpdateTalkingPlayers()
  59. end
  60. end)
  61.  
  62. Citizen.CreateThread(function()
  63. while true do
  64. Citizen.Wait(0)
  65. DisplayTalkingPlayers()
  66. end
  67. end)
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement