SHARE
TWEET

Untitled

a guest Jun 26th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local color = {r = 74, g = 39, b = 216, alpha = 255}
  2. local font = 0
  3. local time = 10000
  4. local nbrDisplaying = 1
  5.  
  6. RegisterCommand('me', function(source, args)
  7.     local text = ''
  8.     for i = 1,#args do
  9.         text = text .. ' ' .. args[i]
  10.     end
  11.     text = text .. ''
  12.     TriggerServerEvent('3dme:shareDisplay', text)
  13. end)
  14.  
  15. RegisterNetEvent('3dme:triggerDisplay')
  16. AddEventHandler('3dme:triggerDisplay', function(text, source)
  17.     local offset = 0.2 + (nbrDisplaying*0.14)
  18.     Display(GetPlayerFromServerId(source), text, offset)
  19. end)
  20.  
  21. function Display(mePlayer, text, offset)
  22.     local displaying = true
  23.     Citizen.CreateThread(function()
  24.         Wait(time)
  25.         displaying = false
  26.     end)
  27.     Citizen.CreateThread(function()
  28.         nbrDisplaying = nbrDisplaying + 1
  29.         print(nbrDisplaying)
  30.         while displaying do
  31.             Wait(0)
  32.             local coordsMe = GetEntityCoords(GetPlayerPed(mePlayer), false)
  33.             local coords = GetEntityCoords(PlayerPedId(), false)
  34.             local dist = GetDistanceBetweenCoords(coordsMe['x'], coordsMe['y'], coordsMe['z'], coords['x'], coords['y'], coords['z'], true)
  35.             if dist < 50 then
  36.                 DrawText3D(coordsMe['x'], coordsMe['y'], coordsMe['z']+offset, text)
  37.             end
  38.         end
  39.         nbrDisplaying = nbrDisplaying - 1
  40.     end)
  41. end
  42.  
  43. function DrawText3D(x,y,z, text)
  44.     local onScreen, _x, _y = World3dToScreen2d(x, y, z)
  45.     local px, py, pz = table.unpack(GetGameplayCamCoords())
  46.  
  47.     SetTextScale(0.35, 0.35)
  48.     SetTextFont(4)
  49.     SetTextProportional(1)
  50.     SetTextColour(255, 255, 255, 215)
  51.     SetTextEntry("STRING")
  52.     SetTextCentre(1)
  53.     AddTextComponentString(text)
  54.     DrawText(_x, _y)
  55.         local factor = (string.len(text)) / 370
  56.     DrawRect(_x, _y + 0.0125, 0.015 + factor, 0.03, 20,20,20,150)
  57. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top