Drakath Posted August 9, 2014 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
xXMADEXx Posted August 10, 2014 Posted August 10, 2014 you could make this by script... Just use timers. The Ultimate Lua Tutorial! | MTA PHP SDK
DNL291 Posted August 10, 2014 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 Please do not PM me with scripting related question nor support, use the forums instead.
Bonsai Posted August 10, 2014 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.
Castillo Posted August 10, 2014 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Max+ Posted August 10, 2014 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 : ) - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
DNL291 Posted August 10, 2014 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. Please do not PM me with scripting related question nor support, use the forums instead.
Recommended Posts