Jump to content

dxDrawText 0 alpha to 255 alpha on colShape


Anzo

Recommended Posts

As I can make that pass player in a colShape and the text appears of 0 to 255 alpha?

-Client

function onShow() 
        dxDrawText("#000000[#ffffffServer#000000] #00ff00Has entrado a zona segura", screenW * 0.0138, screenH * 0.4667, screenW * 0.3237, screenH * 0.4983, tocolor(255, 255, 255,   255), 1.00, "clear", "left", "top", false, false, false, true, false) 
   addEventHandler("onClientRender", root, onShow) 
     
end 
addEvent("onEnter", true) 
addEventHandler("onEnter", root, onShow) 
  
--Remove text 
setTimer(function() 
removeEventHandler("onClientRender", root, onShow) 
end, 
7000,1  
) 

-Server

radar = createRadarArea(-2406.87012, -599.59827, 50,50, 0,255,0,255,getRootElement()) 
rectangle = createColRectangle(-2406.87012, -599.59827, 50,50) 
  
  
  
function enterZone(hitPlayer,player) 
    if (getElementType (hitPlayer) == "player") then 
        setElementData(hitPlayer,"godmode",true) 
        toggleControl (hitPlayer, "next_weapon", false) 
        toggleControl (hitPlayer, "previous_weapon", false) 
        toggleControl (hitPlayer, "fire", false) 
        setPedWeaponSlot(hitPlayer,0) 
        triggerClientEvent(hitPlayer, "onEnter", hitPlayer) 
    end 
end 
addEventHandler( "onColShapeHit", rectangle, enterZone ) 
  
function leaveZone(hitPlayer) 
    if (getElementType (hitPlayer) == "player") then 
       setElementData(hitPlayer,"godmode",false) 
       toggleControl (hitPlayer, "next_weapon", true) 
       toggleControl (hitPlayer, "previous_weapon", true) 
       toggleControl (hitPlayer, "fire", true) 
        
    end 
end 
addEventHandler( "onColShapeLeave", rectangle, leaveZone ) 

I want to do is to do an animation from 0 to 255 alpha

(If my English is bad, I'm learning to speak English)

Link to comment

I have a problem:

If i enter in a colShape appears the text, but no animation. But if i do without the colShape the animation appears

local screenW, screenH = guiGetScreenSize() 
local start = getTickCount() 
  
--With colShape 
function onShow() 
local progress = (getTickCount()-start)/ 3000 
local alpha = interpolateBetween(0,0,0,1,0,0,progress,"OutBounce") 
  
    dxDrawText("#000000[#ffffffServer#000000] #00ff00Has entrado a zona segura", screenW * 0.0138, screenH * 0.4667, screenW * 0.3237, screenH * 0.4983, tocolor(255, 255, 255,   alpha*255), 1.00, "clear", "left", "top", false, false, false, true, false) 
    removeEventHandler("onClientRender", root,onShow) 
    addEventHandler("onClientRender", root,onShow) 
     
end 
  
addEvent("onEnter", true) 
addEventHandler("onEnter", root, onShow) 
  
  
--Without colShape 
function onShow() 
local progress = (getTickCount()-start)/ 3000 
local alpha = interpolateBetween(0,0,0,1,0,0,progress,"OutBounce") 
  
    dxDrawText("#000000[#ffffffServer#000000] #00ff00Has entrado a zona segura", screenW * 0.0138, screenH * 0.4667, screenW * 0.3237, screenH * 0.4983, tocolor(255, 255, 255,   alpha*255), 1.00, "clear", "left", "top", false, false, false, true, false) 
     
     
     
end 
addEventHandler("onClientRender", root,onShow) 
  
  

Link to comment

try

local screenW, screenH = guiGetScreenSize() 
local secounds = 5 
  
function ren() 
    local progress = (getTickCount()-start)/ 3000 
    local alpha = interpolateBetween(0,0,0,1,0,0,progress,"OutBounce") 
    dxDrawText("#000000[#ffffffServer#000000] #00ff00Has entrado a zona segura", screenW * 0.0138, screenH * 0.4667, screenW * 0.3237, screenH * 0.4983, tocolor(255, 255, 255,   alpha*255), 1.00, "clear", "left", "top", false, false, false, true, false) 
end 
  
addEvent("onEnter", true) 
addEventHandler("onEnter", root, function() 
    if ( eventadded ) then 
        return 
    end 
    eventadded = true 
    start = getTickCount() 
    addEventHandler("onClientRender",root,ren) 
    setTimer(function() 
        removeEventHandler("onClientRender",root,ren) 
        eventadded = false 
    end,secounds*1000,1) 
end) 

Link to comment
try
local screenW, screenH = guiGetScreenSize() 
local secounds = 5 
  
function ren() 
    local progress = (getTickCount()-start)/ 3000 
    local alpha = interpolateBetween(0,0,0,1,0,0,progress,"OutBounce") 
    dxDrawText("#000000[#ffffffServer#000000] #00ff00Has entrado a zona segura", screenW * 0.0138, screenH * 0.4667, screenW * 0.3237, screenH * 0.4983, tocolor(255, 255, 255,   alpha*255), 1.00, "clear", "left", "top", false, false, false, true, false) 
end 
  
addEvent("onEnter", true) 
addEventHandler("onEnter", root, function() 
    if ( eventadded ) then 
        return 
    end 
    eventadded = true 
    start = getTickCount() 
    addEventHandler("onClientRender",root,ren) 
    setTimer(function() 
        removeEventHandler("onClientRender",root,ren) 
        eventadded = false 
    end,secounds*1000,1) 
end) 

Just what i wanted to do, thanks.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...