Jump to content

onElementZoneChange


Drakath

Recommended Posts

You can do it on the clientside with the event "onClientRender", like this:

  
local areaName = "" 
local currentZone = nil 
addEventHandler( "onClientRender", root, 
    function() 
        local x,y,z = getElementPosition(element) 
        currentZone = getZoneName(x,y,z) 
         
        if (areaName ~= currentZone) then 
             
            areaName = currentZone 
            triggerEvent(...) 
        end 
    end 
) 

And store the current area of the element with setElementData.

Edited by Guest
Link to comment
You can do it on the clientside with the event "onClientRender", like this:
  
local areaName = "" 
local currentZone = nil 
addEventHandler( "onClientRender", root, 
    function() 
        if not isPlayerHudComponentVisible("area_name") then 
            local x,y,z = getElementPosition(element) 
            currentZone = getZoneName(x,y,z) 
             
            if (areaName ~= currentZone) then 
                 
                areaName = currentZone 
                triggerEvent(...) 
            end 
        else 
            setPlayerHudComponentVisible("area_name", false) 
        end 
    end 
) 

And store the current area of the element with setElementData.

I don't understand why are you using: isPlayerHudComponentVisible and setPlayerHudComponentVisible.

Link to comment
You can do it on the clientside with the event "onClientRender", like this:
  
local areaName = "" 
local currentZone = nil 
addEventHandler( "onClientRender", root, 
    function() 
        if not isPlayerHudComponentVisible("area_name") then 
            local x,y,z = getElementPosition(element) 
            currentZone = getZoneName(x,y,z) 
             
            if (areaName ~= currentZone) then 
                 
                areaName = currentZone 
                triggerEvent(...) 
            end 
        else 
            setPlayerHudComponentVisible("area_name", false) 
        end 
    end 
) 

And store the current area of the element with setElementData.

I don't understand why are you using: isPlayerHudComponentVisible and setPlayerHudComponentVisible.

Bingo : )

Link to comment
You can do it on the clientside with the event "onClientRender", like this:
  
local areaName = "" 
local currentZone = nil 
addEventHandler( "onClientRender", root, 
    function() 
        if not isPlayerHudComponentVisible("area_name") then 
            local x,y,z = getElementPosition(element) 
            currentZone = getZoneName(x,y,z) 
             
            if (areaName ~= currentZone) then 
                 
                areaName = currentZone 
                triggerEvent(...) 
            end 
        else 
            setPlayerHudComponentVisible("area_name", false) 
        end 
    end 
) 

And store the current area of the element with setElementData.

I don't understand why are you using: isPlayerHudComponentVisible and setPlayerHudComponentVisible.

Oh yeah, it's because I got this code from a script 'custom zone name' i made.

By the way, i edited it.

Link to comment
  • Recently Browsing   0 members

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