Jump to content

SafeZone


Recommended Posts

I download this script, this is a safe zone, when player enter the area, he can't fire other players, but there's no function to when player leaves it, he get able to fire again.

Please help me.

radar1 = createRadarArea(84, 1774,320,370,0,255,0, 100) 
setElementData(radar1,"zombieProof",true) 
Zone1 = createColRectangle (84, 1774,320,370) 
  
addEventHandler("onColShapeHit", Zone1, 
function(h) 
    if not isElement(h) then return end 
    if getElementData(h,"zombie") then killPed(h) end --These zones are also zombie proof 
end) 
  
function enterArea1(thePlayer) 
     local posX, posY = getElementPosition(thePlayer) 
     local inArea = isInsideRadarArea(radar1, posX, posY) 
     if (inArea) then 
          if hasObjectPermissionTo(thePlayer, "function.addAccount", false) then --Specify who can enter the zone 
               primaryWeaponControl = isControlEnabled ( thePlayer, "fire" ) 
               if ( primaryWeaponControl == true ) then 
                   toggleControl ( thePlayer, "fire", false ) -- change to true/false to allow/disallow shooting. 
                   outputChatBox("***Area Segura***", thePlayer, 0, 255, 0, true) 
               end 
          else 
               triggerClientEvent(thePlayer, "displayTimer1", thePlayer) 
          end 
     end 
end 
addEventHandler("onColShapeHit", Zone1, enterArea1) 
  
function warp1() 
     local posX, posY = getElementPosition(source) 
     local inArea = isInsideRadarArea(radar1, posX, posY) 
     if (inArea) then 
          if hasObjectPermissionTo(source, "function.addAccount", false) then --Specify who can enter the zone 
               outputChatBox("***CHECKER*** Você está permitido para entrar nessa area.", source, 0, 255, 0, true) 
          else 
               outputChatBox("Você não está permitido para entrar nessa area...", source, 255, 0, 0, true)   
                if isPedInVehicle ( source ) then 
                local playerVehicle = getPedOccupiedVehicle ( source ) 
                    setElementPosition(playerVehicle, 77.13272857666,1921.6431884766,17.640625) 
                else 
                    setElementPosition(source, 77.13272857666,1921.6431884766,17.640625) 
                end 
          end 
     end 
end 
addEvent("warp1", true) 
addEventHandler("warp1", root, warp1) 

I need a function to when player leave the area he can aim again (toggleControl ( thePlayer, "fire", true ))

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...