-- ## 3dme : client side -- ## Variables local pedDisplaying = {} -- ## Functions -- OBJ : draw text in 3d -- PARAMETERS : -- - coords : world coordinates to where you want to draw the text -- - text : the text to display local function DrawText3D(coords, text) local camCoords = GetGameplayCamCoord() local dist = #(coords - camCoords) -- Experimental math to scale the text down local scale = 200 / (GetGameplayCamFov() * dist) -- Format the text local c = Config.visual.color SetTextColour(c.r, c.g, c.b, c.a) SetTextScale(0.0, Config.visual.scale * scale) SetTextFont(Config.visual.font) SetTextDropshadow(0, 0, 0, 0, 55) SetTextDropShadow() SetTextCentre(true) -- Diplay the text BeginTextCommandDisplayText("STRING") AddTextComponentSubstringPlayerName(text) SetDrawOrigin(coords, 0) EndTextCommandDisplayText(0.0, 0.0) ClearDrawOrigin() end function loadAnimDict(dict) while not HasAnimDictLoaded(dict) do RequestAnimDict( dict ) Citizen.Wait(5) end end local function DrawText3Ds(coords, text) local camCoords = GetGameplayCamCoord() local dist = #(coords - camCoords) -- Experimental math to scale the text down local scale = 200 / (GetGameplayCamFov() * dist) -- Format the text local c = Config.visuals.color SetTextColour(c.r, c.g, c.b, c.a) SetTextScale(0.0, Config.visuals.scale * scale) SetTextFont(Config.visuals.font) SetTextDropshadow(0, 0, 0, 0, 55) SetTextDropShadow() SetTextCentre(true) -- Diplay the text BeginTextCommandDisplayText("STRING") AddTextComponentSubstringPlayerName(text) SetDrawOrigin(coords, 0) EndTextCommandDisplayText(0.0, 0.0) ClearDrawOrigin() end -- OBJ : handle the drawing of text above a ped head -- PARAMETERS : -- - coords : world coordinates to where you want to draw the text -- - text : the text to display local function Display(ped, text) local playerPed = PlayerPedId() local playerCoords = GetEntityCoords(playerPed) local pedCoords = GetEntityCoords(ped) local dist = #(playerCoords - pedCoords) if dist <= Config.visual.dist then pedDisplaying[ped] = (pedDisplaying[ped] or 1) + 1 -- Timer local display = true Citizen.CreateThread(function() Wait(Config.visual.time) display = false end) -- Display local offset = 0.8 + pedDisplaying[ped] * 0.1 while display do if HasEntityClearLosToEntity(playerPed, ped, 17 ) then local x, y, z = table.unpack(GetEntityCoords(ped)) z = z + offset DrawText3D(vector3(x, y, z), text) end Wait(0) end pedDisplaying[ped] = pedDisplaying[ped] - 1 end end local function DisplayDo(ped, text) local playerPed = PlayerPedId() local playerCoords = GetEntityCoords(playerPed) local pedCoords = GetEntityCoords(ped) local dist = #(playerCoords - pedCoords) if dist <= Config.visual.dist then pedDisplaying[ped] = (pedDisplaying[ped] or 1) + 1 -- Timer local display = true Citizen.CreateThread(function() Wait(Config.visual.time) display = false end) -- Display local offset = 0.8 + pedDisplaying[ped] * 0.1 while display do if HasEntityClearLosToEntity(playerPed, ped, 17 ) then local x, y, z = table.unpack(GetEntityCoords(ped)) z = z + offset DrawText3Ds(vector3(x, y, z), text) end Wait(0) end pedDisplaying[ped] = pedDisplaying[ped] - 1 end end -- ## Events -- Share the display of 3D text RegisterNetEvent('3dme:shareDisplay') AddEventHandler('3dme:shareDisplay', function(text, serverId) local player = GetPlayerFromServerId(serverId) if player ~= -1 then local ped = GetPlayerPed(player) Display(ped, text) end end) RegisterNetEvent('3dme:shareDisplayDo') AddEventHandler('3dme:shareDisplayDo', function(text, serverId) local player = GetPlayerFromServerId(serverId) if player ~= -1 then local ped = GetPlayerPed(player) DisplayDo(ped, text) end end) local LANGUAGE = Config.language TriggerEvent('chat:addSuggestion', '/' .. Languages[LANGUAGE].commandName, Languages[LANGUAGE].commandDescription, Languages[LANGUAGE].commandSuggestion) -- ### CHAT MESSAGE RegisterCommand('zar', function(source, args) local maxSayi = 1 local randomSayi = 1 if args[1] ~= nil then maxSayi = tonumber(args[1]) if maxSayi > 90000000 then maxSayi = 10000000 end randomSayi = math.random(1, maxSayi) else maxSayi = 6 randomSayi = math.random(1, maxSayi) end local text = "Zar "..randomSayi.."/"..maxSayi loadAnimDict("anim@mp_player_intcelebrationmale@wank") TaskPlayAnim(PlayerPedId(), "anim@mp_player_intcelebrationmale@wank", "wank", 8.0, 1.0, -1, 49, 0, 0, 0, 0) Wait(1500) ClearPedTasks(PlayerPedId()) TriggerServerEvent("zarataq", text) end) RegisterNetEvent('sendProximityMessageMe') AddEventHandler('sendProximityMessageMe', function(id, name, message) local myId = PlayerId() local pid = GetPlayerFromServerId(id) if pid == myId then TriggerEvent('chat:addMessage', { template = '