Nakka Lindo Posted January 22, 2023 Posted January 22, 2023 local screenWidth, screenHeight = guiGetScreenSize() local rectWidth, rectHeight = 180, 15 local rectX, rectY = (screenWidth / 6.20) - (rectWidth / 1), (screenHeight / 1.01) - (rectHeight / 1) local tick = getTickCount() local textWidth = dxGetTextWidth('www.fluxorpg.com.br') local startX, finalX = (rectX - textWidth), (rectX + rectWidth) addEventHandler('onClientRender', root, function() local textX = interpolateBetween(6.5, 0, 0, finalX, 0, 0,(getTickCount() - tick) / 3000, 'Linear') if textX >= finalX then tick = getTickCount() end dxDrawRectangle(rectX, rectY, rectWidth, rectHeight, tocolor(0, 0, 0, 130)) dxDrawText('www.fluxorpg.com.br', textX, rectY, rectWidth, rectHeight, tocolor(255, 255, 255), 0.96,"default", "left", "top", false, false, false, false, false) end)
Nakka Lindo Posted January 22, 2023 Author Posted January 22, 2023 (edited) Exemplo: https://imgur.com/a/039evMU Edited January 22, 2023 by Nakka Lindo
Vampire Posted January 22, 2023 Posted January 22, 2023 Olá @Nakka Lindo Movi seu tópico para a seção de Programação para que você possa obter uma melhor assistência. 1
Sx666 Posted February 19, 2023 Posted February 19, 2023 Para adicionar um limite no final do dxrectangle, você pode simplesmente subtrair um valor fixo do comprimento (rectWidth) do retângulo. Por exemplo, você pode usar local rectLimit = rectWidth - 10 para definir o limite e, em seguida, alterar a variável finalX para math.max(rectX + rectLimit, startX + textWidth). Para fazer a mensagem sumir, você pode usar uma verificação condicional simples para desativar a renderização após um determinado tempo, como em if getTickCount() - tick > 5000 then return end. Segue o código modificado abaixo: local screenWidth, screenHeight = guiGetScreenSize() local rectWidth, rectHeight = 180, 15 local rectX, rectY = (screenWidth / 6.20) - (rectWidth / 1), (screenHeight / 1.01) - (rectHeight / 1) local rectLimit = rectWidth - 10 local tick = getTickCount() local textWidth = dxGetTextWidth('www.fluxorpg.com.br') local startX = rectX - textWidth local finalX = math.max(rectX + rectLimit, startX + textWidth) addEventHandler('onClientRender', root, function() if getTickCount() - tick > 5000 then return end local textX = interpolateBetween(startX, 0, 0, finalX, 0, 0,(getTickCount() - tick) / 3000, 'Linear') dxDrawRectangle(rectX, rectY, rectWidth, rectHeight, tocolor(0, 0, 0, 130)) dxDrawText('www.fluxorpg.com.br', textX, rectY, rectWidth, rectHeight, tocolor(255, 255, 255), 0.96,"default", "left", "top", false, false, false, false, false) end) Nesse exemplo, a mensagem será renderizada por 5 segundos e, em seguida, desativada. O limite do retângulo também foi definido como rectWidth - 10, mas você pode ajustá-lo de acordo com suas necessidades.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now