Nakka Lindo Posted February 14, 2023 Share Posted February 14, 2023 (edited) local elementBlocked = 'paradiseAreaVerde' -- Element-Data que será bloqueado. local elementDesblok = 'paradiseAreaVerde' addEventHandler ('onClientPlayerWeaponSwitch', root, function () setPedWeaponSlot (source, 0) if getElementData (source, elementBlocked) then cancelEvent () toggleControl ("fire", false) toggleControl ("next_weapon", false) toggleControl ("previous_weapon", false) toggleControl ("sprint", false) toggleControl ("aim_weapon", false) toggleControl ("vehicle_fire", false) return end end) addEventHandler ("onColShapeLeave", getRootElement(), function(leaveElement, matchingDimension) if (getElementType (leaveElement) == "player") and (getElementID (source) == "greenzoneColshape") then toggleControl ("fire", true) toggleControl ("next_weapon", true) toggleControl ("previous_weapon", true) toggleControl ("sprint", true) toggleControl ("aim_weapon", true) toggleControl ("vehicle_fire", true) showPlayerHudComponent (leaveElement, "ammo", true) showPlayerHudComponent (leaveElement, "weapon", true) triggerClientEvent (leaveElement, "disableGodMode", leaveElement) end end) addEventHandler("onClientPlayerDamage", getLocalPlayer(), function() if getElementData(source,"paradiseAreaVerde") then cancelEvent() end end) addEventHandler("onClientPlayerStealthKill", getLocalPlayer(), function(targetPlayer) if getElementData(targetPlayer,"paradiseAreaVerde") then cancelEvent() end end) addEventHandler("onClientVehicleDamage", root, function() local occupants = getVehicleController(source) if (occupants) then godmode = getElementData(occupants,"paradiseAreaVerde") if (godmode) then cancelEvent() end end end) addEventHandler("onClientElementDataChange", root, function (dataName) if (dataName == "paradiseAreaVerde") then if (source:getData("paradiseAreaVerde")) then if (source:getType() == "player") then for k, v in ipairs (Element.getAllByType("player")) do source:setCollidableWith(v, false); end for k, v in ipairs (Element.getAllByType("vehicle")) do source:setCollidableWith(v, false); end elseif (source:getType() == "vehicle") then for k, v in ipairs (Element.getAllByType("vehicle")) do source:setCollidableWith(v, false); end for k, v in ipairs (Element.getAllByType("player")) do source:setCollidableWith(v, false); end end else if (source:getType() == "player") then for k, v in ipairs (Element.getAllByType("player")) do source:setCollidableWith(v, true); end for k, v in ipairs (Element.getAllByType("vehicle")) do source:setCollidableWith(v, true); end elseif (source:getType() == "vehicle") then for k, v in ipairs (Element.getAllByType("vehicle")) do source:setCollidableWith(v, true); end for k, v in ipairs (Element.getAllByType("player")) do source:setCollidableWith(v, true); end end end end end ) Edited February 14, 2023 by Nakka Lindo Link to comment
Other Languages Moderators Lord Henry Posted February 15, 2023 Other Languages Moderators Share Posted February 15, 2023 Primeiramente você precisa corrigir a indentação do seu código. 1 Link to comment
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