Drakath Posted August 9, 2014 Share Posted August 9, 2014 Add an event onElementZoneChange. It should trigger when an element enters a different zone. GTA San Andreas has this by default, when you enter a new zone, it outputs the name of the new zone. Parameters: oldZone, newZone, oldCity, newCity Link to comment
xXMADEXx Posted August 10, 2014 Share Posted August 10, 2014 you could make this by script... Just use timers. Link to comment
DNL291 Posted August 10, 2014 Share Posted August 10, 2014 (edited) 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 August 10, 2014 by Guest Link to comment
Bonsai Posted August 10, 2014 Share Posted August 10, 2014 I'm not sure if onClientRender should be abused for such things. In the end, you will get lags. Maybe not in this case, but in general. Link to comment
Castillo Posted August 10, 2014 Share Posted August 10, 2014 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
Max+ Posted August 10, 2014 Share Posted August 10, 2014 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
DNL291 Posted August 10, 2014 Share Posted August 10, 2014 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
Recommended Posts