So here I am asking for help, I literally searched multiple times for over 1 month on the forum, outside some discord help servers for this with no luck and everyone who has the answer try to get money from me, or the people who found it somewhere don’t share.
So this is it, is a script that Draws on RGB multiple info on the screen like my discord, how many players are online and and alert system that we use on our server to send a /alerta from 1 to 5 and it draws on the bottom of the screen ALERTA POLICIAL LVL 1 or whatever number up to 5, the only thing that I REALLY wish to have is some way to add an image, to whatever position based to work with the alerts
so /alerta 1 to 5 draws the text on the bottom of the screen if you’re a cop.
/alerta 0 will make the text dissapear so I need to have this image to dissapear with the /alerta 0 too
My plan is to release this here on the forum cause Im tired of people not sharing anything that helps the community
This is the code:
CLIENT
local nivelActual = '0'
local function RGBRainbow( frequency )
local result = {}
local curtime = GetGameTimer() / 1000
result.r = math.floor( math.sin( curtime * frequency + 0 ) * 127 + 128 )
result.g = math.floor( math.sin( curtime * frequency + 2 ) * 127 + 128 )
result.b = math.floor( math.sin( curtime * frequency + 4 ) * 127 + 128 )
return result
end
Citizen.CreateThread(function()
while true do
Wait(1)
local jucatori = 0
pPed = GetPlayerPed(-1)
for i, player in ipairs(GetActivePlayers()) do
jucatori = jucatori + 1
end
Dibujar(0.502, 0.493, 1.0,1.0, 0.37, "CRIMECITYRP® ~w~|~s~ discord.gg/3fqB8TK", 255, 255, 255, 255, true)
Dibujar(0.555, 1.468, 1.0,1.0, 0.40, "~w~ID: ~s~"..GetPlayerServerId(NetworkGetEntityOwner(GetPlayerPed(-1))), 255, 255, 255, 255, true)
Dibujar(0.502, 1.468, 1.0,1.0, 0.40, "~w~[~s~ONLINE ".. jucatori .."/32~w~]", 255, 255, 255, 255, true)
if nivelActual ~= '0' then
Dibujar(0.739, 1.468, 1.0,1.0, 0.40, "ALERTA POLICIAL NIVEL "..nivelActual, 255, 0, 0, 255, false)
end
end
end)
RegisterNetEvent('MandarAlerta')
AddEventHandler('MandarAlerta',function(alerta)
exports['t-notify']:SendImage ('info', nil,'https://i.imgur.com/eKethNO.png', 10000, true, false)
nivelActual = alerta
end)
function Dibujar(x,y ,width,height,scale, text, r,g,b,a, rainbox)
SetTextFont(4)
SetTextProportional(0)
SetTextScale(scale, scale)
if rainbox then
local rainbow = RGBRainbow( 1 )
SetTextColour(rainbow.r, rainbow.g, rainbow.b, a)
else
SetTextColour(r, g, b, a)
end
SetTextDropShadow(0, 0, 0, 0,255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x - width/2, y - height/2 + 0.005)
end
SERVER
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterCommand('alerta',function(source, args, rawCommand)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer.job.name == 'police' then
rawCommand = rawCommand:sub(8)
if tonumber(rawCommand) >= 0 and tonumber(rawCommand) < 6 then
alerta = rawCommand
TriggerEvent('Sync')
else
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'error', text = 'Debes seleccionar una alerta del 0 al 5!', length = 2500, style = { ['background-color'] = '#FF0000', ['color'] = '#000000' } })
end
else
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'error', text = 'No tienes permisos para ejecutar ese comando', length = 2500, style = { ['background-color'] = '#FF0000', ['color'] = '#000000' } })
end
end, false, { help = 'Pon el nivel de alerta de la ciudad', params = {{ name = 'numero de alerta [0-5]' }} })
RegisterServerEvent('Sync')
AddEventHandler('Sync', function()
TriggerClientEvent('MandarAlerta', -1, alerta)
end)
Any help will be appretiated
I was thinking to maybe make use this to draw the image
https://forum.cfx.re/t/join-logo-image-1-1/83250
and this to make it work…
https://forum.cfx.re/t/help-with-creating-a-server-side-for-my-script/1442440
But I dont know how to merge them.