I used the script below to make an — Admin On Duty — script but i need help with the second command /adminoff to remove the text drawn on screen
https://forum.cfx.re/t/release-me-but-the-text-is-3d-printed/149691
client.lua
local color = {r = 255, g = 0, b = 0, alpha = 205} -- Color of the text
local font = 8 -- Font of the text
local time = 384615384615 -- Duration of the display of the text : 500 ~= 13sec
RegisterCommand('admin', function(source, args)
local text = '>> Admin On Duty'
for i = 1,#args do
text = ' '
end
text = text .. ' <<'
TriggerServerEvent('3dadmin:shareDisplay', text)
end)
RegisterCommand('adminoff', function(source, args)
--something here
end)
RegisterNetEvent('3dadmin:triggerDisplay')
AddEventHandler('3dadmin:triggerDisplay', function(text, source)
Display(GetPlayerFromServerId(source), text)
end)
function Display(mePlayer, text)
local timer = 0
while timer < time do
Wait(0)
timer = timer + 1
local coords = GetEntityCoords(GetPlayerPed(mePlayer), false)
DrawText3D(coords['x'], coords['y'], coords['z']+1, text)
end
end
function DrawText3D(x,y,z, text)
local onScreen,_x,_y = World3dToScreen2d(x,y,z)
local px,py,pz = table.unpack(GetGameplayCamCoord())
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.10*scale, 0.60*scale)
SetTextFont(font)
SetTextProportional(1)
SetTextColour(color.r, color.g, color.b, color.alpha)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(4, 0, 0, 0, 150)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(true)
AddTextComponentString(text)
EndTextCommandDisplayText(_x, _y)
end
end
server.lua
local logEnabled = true
RegisterServerEvent('3dadmin:shareDisplay')
AddEventHandler('3dadmin:shareDisplay', function(text)
TriggerClientEvent('3dadmin:triggerDisplay', -1, text, source)
if logEnabled then
setLog(text, source)
end
end)
function setLog(text, source)
local time = os.date("%d/%m/%Y %X")
local name = GetPlayerName(source)
local identifier = GetPlayerIdentifiers(source)
local data = time .. ' : ' .. name .. ' - ' .. identifier[1] .. ' : ' .. text
local content = LoadResourceFile(GetCurrentResourceName(), "admin.txt")
local newContent = content .. '\r\n' .. data
SaveResourceFile(GetCurrentResourceName(), "admin.txt", newContent, -1)
end
any help would be amazing