Jump to content

RadioActive Zone Idea.Help


Smirnoff

Recommended Posts

The idea is a zone with radiation,when you enter this zone you gain rads and when you reach a radlevel ,you start to bleeding.

Actually i have this code , and i cannot do it work properly

The zone is created

and actually the rad burn if you are in the area

But when you leave still burning your health and the geiger sound still playing

how can i fix it?

local x,y,z = 95.974617004395,1751.3895263672,17.640625 --- Marker Central  
local radarea = createMarker (x,y,z,"cylinder",255, 255, 91,0,0) 
local radZoneRadar = createRadarArea ( 95.974617004395, 1751.3895263672, 255, 255, 91, 127, 0, 100 ) 
-- 
local radmax = 100 -- Radiacion Maxima para comenzar a sangrar 
local radmid = 50 -- comienza un sangrado minimo 
local radadd = 50 -- Añade 10 rads 
local removebloodfive = 200 -- Que tanta sangre es quitada entre mas radiacion radmid 
local removeblood = 700 -- Sangre quitada al llegar al maximo radmax 
local antiradiation = "Rad-Suit" -- La radiacion no sube tan rapido -valores multiplicados por 0.8 
  
-- 
------------------------------------------ 
-- 
  
-- SISTEMA 
local player = getLocalPlayer() 
  
function checkradiation() 
if not getElementData(player,"radiacion") then 
setElementData(player,"radiacion",0) 
end 
local radiacion = getElementData(player,"radiacion") 
    if isElementWithinMarker(player, radarea) then 
    radiationadd() 
    end 
    if radiacion >= radmid then 
    if getElementData(player,antiradiation) then 
    setElementData(player,"blood",getElementData(player,"blood")-removebloodfive*0.-- s8) -->
    return true 
    end 
    setElementData(player,"blood",getElementData(player,"blood")-removebloodfive) 
    end 
    if radiacion >= radmax then 
    if getElementData(player,antiradiation) then 
    setElementData(player,"blood",getElementData(player,"blood")-removebloodfive*0.3) 
    return true 
    end 
    setElementData(player,"blood",getElementData(player,"blood")-removeblood) 
    end 
    setTimer(offsound,10000,1) 
end 
setTimer(checkradiation,10000,0) 
  
  
  
function radiationadd() 
setElementData(player,"radiacion",getElementData(player,"radiacion")+radadd) 
radsound = playSound("sounds/radsound.mp3")  
end 
  
function offsound() 
    if not isElementWithinMarker(player, radarea) then 
    stopSound(radsound) 
    end 
end 

Link to comment
  • 2 weeks later...

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