-- =========================================================================== -- Anuncio - aviso da equipe no canto esquerdo, abaixo do pop-up do sorteio (pedido do dono em 24/10/2026). Quem -- manda e o servidor (Data/Script/Scripts/Anuncio.lua, /anuncio e /fecharanuncio): AN_Estado (aberto 0 ou 1, -- tamanho do texto, texto em grupos de 3 letras por numero). Aqui so desenha. -- -- Aviso da equipe -- Evento no ringue de Lorencia -- hoje as 21:30 -- -- Fica em Y = 240, logo abaixo do sorteio (Y = 200, 34 de altura), para os dois nao se chocarem. O fundo e o -- mesmo do contador do leilao (UX_Confirmar, esticado). A API nao mede texto: a quebra e por numero de letras. -- =========================================================================== local IMG_FUNDO = 40062 -- Custom\Interface\UX_Confirmar.tga (220 x 104 dentro de 256 x 128) local LARG = 180 local X, Y = 6, 240 local LETRAS_LINHA = 34 -- cabe em 168 px na fonte 1 local ALT_TOPO, ALT_LINHA, ALT_PE = 20, 12, 7 local E = nil -- { linhas } enquanto ha aviso aberto local LerForma = nil local function LerDword(nome) local formas = { function() return GetDwordPacket(nome) end, function() return GetDwordPacket(nome, -1) end } if LerForma then local ok, v = pcall(formas[LerForma]); if ok then return tonumber(v) end end for i, f in ipairs(formas) do local ok, v = pcall(f) if ok and tonumber(v) then LerForma = i; return tonumber(v) end end return nil end local function LerTexto(nome) local n = math.min(LerDword(nome) or 0, 120) local t = {} while #t < n do local v = LerDword(nome) or 0 for _ = 1, 3 do if #t >= n then break end local c = v % 256 v = math.floor(v / 256) t[#t + 1] = (c >= 32) and string.char(c) or " " end end return table.concat(t) end -- quebra por palavra; palavra maior que a linha e cortada local function Quebrar(s) local linhas, atual = {}, "" for p in string.gmatch(s, "%S+") do while #p > LETRAS_LINHA do if atual ~= "" then linhas[#linhas + 1] = atual; atual = "" end linhas[#linhas + 1] = string.sub(p, 1, LETRAS_LINHA) p = string.sub(p, LETRAS_LINHA + 1) end if atual == "" then atual = p elseif #atual + 1 + #p <= LETRAS_LINHA then atual = atual .. " " .. p else linhas[#linhas + 1] = atual; atual = p end end if atual ~= "" then linhas[#linhas + 1] = atual end return linhas end local function Protocolo(head, nome) if nome ~= "AN_Estado" then return nil end local aberto = LerDword(nome) or 0 local txt = (aberto == 1) and LerTexto(nome) or "" pcall(ClearPacket, nome) E = (aberto == 1 and txt ~= "") and { linhas = Quebrar(txt) } or nil return true end ProtocolFunctions.ClientProtocol(Protocolo) function Anuncio_Desenhar() if not E then return end local alt = ALT_TOPO + #E.linhas * ALT_LINHA + ALT_PE pcall(RenderImage2, IMG_FUNDO, X, Y, LARG, alt, 0, 0, 220 / 256, 104 / 128, 1, 1, 1.0) SetFontType(1); SetTextBg(0, 0, 0, 0) SetTextColor(255, 189, 25, 255) RenderText5(X, Y + 6, "Aviso da equipe", LARG, 3) SetTextColor(255, 255, 255, 255) for i, l in ipairs(E.linhas) do RenderText5(X, Y + ALT_TOPO + (i - 1) * ALT_LINHA, l, LARG, 3) end end function Anuncio_Carregar() pcall(LoadBitmap, "Custom\\Interface\\UX_Confirmar.tga", IMG_FUNDO) end BridgeFunctionAttach('MainLoader', 'Anuncio_Carregar') BridgeFunctionAttach('MainInterfaceProcThread', 'Anuncio_Desenhar')