Jump to content

Safezone


Trilon

Recommended Posts

I want to create a safezone but i didn't find any good script for this. Somebody can create for me? I use DayZ mod.

Cordinates:

X:2904.0771484375,

Y: -1145.755859375,

Z: 11.14050102233

width:250

depth: -50

height:50

Please i don't know how can i create it. I tried it but i failed.

Link to comment

This isn't a forum for scripting requests, please read this

About the script, there are many safe zones scripts on community , for example this

And if you want to create your own safe-zones, you have to use the following functions: and remember you can anytime ask for help if something doesn't work.

createRadarArea 
createColRectangle 
onClientColShapeHit 
onClientColShapeLeave 
onClientPlayerDamage 

Link to comment

I already made one as example,so you can edit the cordinations if you have alot of cordinations use Table in this situation.

second thing, be sure you added the folder to your meta as server side, because these events are server sided.

local GreenZone = createColRectangle (-711,957,255,255) --You can change them from here 
local Radar = createRadarArea (-711,957,255,255,50, 150, 50, 155) --You can change them from here 
  
function zoneEnter ( thePlayer, matchingDimension ) 
      if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then 
         toggleControl ( thePlayer, "fire", false ) 
         toggleControl ( thePlayer, "next_weapon", false ) 
         toggleControl ( thePlayer, "previous_weapon", false ) 
          outputChatBox( "You've entered to the greenzone.",thePlayer, 255,0,0) 
      end 
  
    end 
    addEventHandler ( "onColShapeHit", GreenZone, zoneEnter ) 
      
function zoneExit ( thePlayer, matchingDimension ) 
        if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then 
         toggleControl ( thePlayer, "fire", true ) 
         toggleControl ( thePlayer, "next_weapon", true ) 
         toggleControl ( thePlayer, "previous_weapon", true ) 
       outputChatBox ( "You've left the greenzone,now all your ammos will works.",thePlayer,255,0,0) 
        end 
    end 
    addEventHandler ( "onColShapeLeave", GreenZone,zoneExit ) 

Edited by Guest
Link to comment
[lua]local GreenZone = createColRectangle (-711,957,255,255)  
    local Radar = createRadarArea (-711,957,255,255,50, 150, 50, 155)  
  
function zoneEnter ( thePlayer, matchingDimension ) 
      if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then 
         toggleControl ( thePlayer, "fire", false ) 
         toggleControl ( thePlayer, "next_weapon", false ) 
         toggleControl ( thePlayer, "previous_weapon", false ) 
          outputChatBox( "You've entered to the greenzone.",thePlayer, 255,0,0) 
      end 
  
    end 
    addEventHandler ( "onColShapeHit", GreenZone, zoneEnter ) 
      
function zoneExit ( thePlayer, matchingDimension ) 
        if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then 
         toggleControl ( thePlayer, "fire", true ) 
         toggleControl ( thePlayer, "next_weapon", true ) 
         toggleControl ( thePlayer, "previous_weapon", true ) 
       outputChatBox ( "You've left the greenzone,now all your ammos will works.",thePlayer,255,0,0) 
        end 
    end 
    addEventHandler ( "onColShapeLeave", GreenZone,zoneExit ) 

[/lua]

But what for example, if the attacker is outside the colshape with a sniper? he could easily kill the players which are in the colshape.

Link to comment

Hey, i made what you told me via pm,

You can change the r,g,b to change the color of the zone and alpha to change the alpha of it too add it to server side in meta since the events are server sided.

local r,g,b = 50, 150, 50  
local alpha = 155 
local GreenZone = createColRectangle ( 2898.93,-1135.61,255,255)   
local Radar = createRadarArea ( 2898.93,-1135.61,255,255,r, g, b, alpha)   
  
addEventHandler ( "onColShapeHit", GreenZone,  
function  (thePlayer,matchingDimension ) 
      if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then 
         toggleControl ( thePlayer, "fire", false ) 
         toggleControl ( thePlayer, "next_weapon", false ) 
         toggleControl ( thePlayer, "previous_weapon", false ) 
         outputChatBox( "Safe Zone: You've entered to the greenzone.",thePlayer, r,g,b) 
   end 
end) 
  
addEventHandler ( "onColShapeLeave", GreenZone,  
function ( thePlayer, matchingDimension ) 
        if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then 
         toggleControl ( thePlayer, "fire", true ) 
         toggleControl ( thePlayer, "next_weapon", true ) 
         toggleControl ( thePlayer, "previous_weapon", true ) 
       outputChatBox ( "Safe Zone: You've left the greenzone,now all your ammos will works.",thePlayer,255,0,0) 
     end 
end) 
  

Meta should be like that:


~Have fun scripting

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