Jump to content

Help antizombies area


Jacobob14

Recommended Posts

as can I do that you can not kill those who come to the area

forgive my bad English :(

safecol = createColCuboid ( 2236.296875, 418.8427734375, 6.4655957221985, 60, 60, 60 ) 
safeZoneRadar = createRadarArea ( 2236.296875, 418.8427734375, 200, 200, 0, 187, 255, 155  ) 
setElementData (safeZoneRadar, "zombieProof", true) 

Link to comment
  
safecol = createColCuboid ( 95.974617004395, 1751.3895263672, 17.640625, 255, 255, 255 ) 
safeZoneRadar = createRadarArea ( 95.974617004395, 1751.3895263672, 255, 255, 255, 255, 255 ) 
setElementData (safeZoneRadar, "zombieProof", true) 
  
  
function enterZone(hitPlayer,thePlayer) 
local skin = getElementModel (hitPlayer) 
      if ( hitPlayer ) then 
    toggleControl (hitPlayer, "fire", true ) 
    toggleControl (hitPlayer, "aim_weapon", true) 
    toggleControl (hitPlayer, "vehicle_fire", true) 
    outputChatBox("You entered the Safe Zone..", hitPlayer, 0, 255, 0) 
end 
end 
addEventHandler( "onColShapeHit", safecol, enterZone ) 
  
function leaveZone(hitPlayer,thePlayer) 
local skin = getElementModel (hitPlayer) 
    toggleControl (hitPlayer, "fire", true) 
    toggleControl (hitPlayer, "aim_weapon", true) 
    toggleControl (hitPlayer, "vehicle_fire", true) 
    outputChatBox("You left the safe area.", hitPlayer, 255, 0, 0) 
end 
  
addEventHandler( "onColShapeLeave", safecol, leaveZone ) 
  

Link to comment
  
safecol = createColCuboid ( 95.974617004395, 1751.3895263672, 17.640625, 255, 255, 255 ) 
safeZoneRadar = createRadarArea ( 95.974617004395, 1751.3895263672, 255, 255, 255, 255, 255 ) 
setElementData (safeZoneRadar, "zombieProof", true) 
  
  
function enterZone(hitPlayer,thePlayer) 
local skin = getElementModel (hitPlayer) 
      if ( hitPlayer ) then 
    toggleControl (hitPlayer, "fire", true ) 
    toggleControl (hitPlayer, "aim_weapon", true) 
    toggleControl (hitPlayer, "vehicle_fire", true) 
    outputChatBox("You entered the Safe Zone..", hitPlayer, 0, 255, 0) 
end 
end 
addEventHandler( "onColShapeHit", safecol, enterZone ) 
  
function leaveZone(hitPlayer,thePlayer) 
local skin = getElementModel (hitPlayer) 
    toggleControl (hitPlayer, "fire", true) 
    toggleControl (hitPlayer, "aim_weapon", true) 
    toggleControl (hitPlayer, "vehicle_fire", true) 
    outputChatBox("You left the safe area.", hitPlayer, 255, 0, 0) 
end 
  
addEventHandler( "onColShapeLeave", safecol, leaveZone ) 
  

I does not work :(

Link to comment

Because the code doesn't make any sense, really. Try the following code.

Server-side

local safecol = createColCuboid( 95.974617004395, 1751.3895263672, 17.640625, 255, 255, 255 ) 
setElementData( safecol, "zombieProof", true ) 
  
local safeZoneRadar = createRadarArea( 95.974617004395, 1751.3895263672, 255, 255, 255, 255, 255 ) 
setElementData( safeZoneRadar, "zombieProof", true ) 
  
addEventHandler( "onColShapeHit", root, 
    function( hitElement, matchingDimension ) 
        if ( getElementType( hitElement ) == "player" ) and ( matchingDimension ) and ( getElementData( source, "zombieProof" ) ) then 
            setElementData( hitElement, "player:safezone", true ) 
            outputChatBox( "You entered the safe area.", hitElement, 0, 255, 0, false ) 
        end 
    end 
) 
  
addEventHandler( "onColShapeLeave", root, 
    function( leaveElement, matchingDimension ) 
        if ( getElementType( leaveElement ) == "player" ) and ( matchingDimension ) and ( getElementData( source, "zombieProof" ) ) then 
            if ( getElementData( leaveElement, "player:safezone" ) ) then 
                removeElementData( leaveElement, "player:safezone" ) 
            end 
            outputChatBox( "You left the safe area.", leaveElement, 255, 0, 0, false ) 
        end 
    end 
) 

 

Client-side

addEventHandler( "onClientPedDamage", root, 
    function( ) 
        if ( getElementData( source, "player:safezone" ) ) then 
            cancelEvent( ) 
        end 
    end 
) 

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