Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local color = {r = 74, g = 39, b = 216, alpha = 255}
- local font = 0
- local time = 10000
- local nbrDisplaying = 1
- RegisterCommand('me', function(source, args)
- local text = ''
- for i = 1,#args do
- text = text .. ' ' .. args[i]
- end
- text = text .. ''
- TriggerServerEvent('3dme:shareDisplay', text)
- end)
- RegisterNetEvent('3dme:triggerDisplay')
- AddEventHandler('3dme:triggerDisplay', function(text, source)
- local offset = 0.2 + (nbrDisplaying*0.14)
- Display(GetPlayerFromServerId(source), text, offset)
- end)
- function Display(mePlayer, text, offset)
- local displaying = true
- Citizen.CreateThread(function()
- Wait(time)
- displaying = false
- end)
- Citizen.CreateThread(function()
- nbrDisplaying = nbrDisplaying + 1
- print(nbrDisplaying)
- while displaying do
- Wait(0)
- local coordsMe = GetEntityCoords(GetPlayerPed(mePlayer), false)
- local coords = GetEntityCoords(PlayerPedId(), false)
- local dist = GetDistanceBetweenCoords(coordsMe['x'], coordsMe['y'], coordsMe['z'], coords['x'], coords['y'], coords['z'], true)
- if dist < 50 then
- DrawText3D(coordsMe['x'], coordsMe['y'], coordsMe['z']+offset, text)
- end
- end
- nbrDisplaying = nbrDisplaying - 1
- end)
- end
- function DrawText3D(x,y,z, text)
- local onScreen, _x, _y = World3dToScreen2d(x, y, z)
- local px, py, pz = table.unpack(GetGameplayCamCoords())
- SetTextScale(0.35, 0.35)
- SetTextFont(4)
- SetTextProportional(1)
- SetTextColour(255, 255, 255, 215)
- SetTextEntry("STRING")
- SetTextCentre(1)
- AddTextComponentString(text)
- DrawText(_x, _y)
- local factor = (string.len(text)) / 370
- DrawRect(_x, _y + 0.0125, 0.015 + factor, 0.03, 20,20,20,150)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement