Jump to content

[Help] Water not raise all over Map


BieHDC

Recommended Posts

Hello,

in past i have had a recource, which raises water all over map, but in my map this doesnt work.

See Screenshots: http://postimg.org/image/bwimlcl4z/

http://postimg.org/image/6dkohvdhf/

http://postimg.org/image/v6tewux29/

http://postimg.org/image/s61g28hxz/

Here is my script:

-- server side 
    local maxLevel      =   35 -- max level 
    local untilW        =   120 -- sec 
      
    local raising,level     =   (maxLevel/untilW)/10,0 
    untilW = nil 
    local runningTimer 
      
      
    function editSomeWater() 
        level = level + raising -- level raising 
        setWaterLevel ( level, true, true ) -- set the level 
        if level >= maxLevel then -- compare values of level and max level 
            setWaterLevel ( maxLevel, true, true ) -- set it back to max level for perfection 
            if isTimer(runningTimer) then -- check if the timer exist 
                killTimer(runningTimer) -- stop the timer 
            end 
            runningTimer,level,maxLevel = nil,nil,nil -- delete data (ram) 
        end 
    end 
      
    setTimer (function () -- set a timer for 15000 millisec (15 sec), runs one time "1" 
        runningTimer = setTimer ( editSomeWater, 100, 0 ) -- set an invinity timer to set the water level, (0 = invinity) (only stops when you stop him with killTimer) 
    end,30000,1) 
     
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
  

Link to post

Doesnt work -.- and no errors in debugscript 3

--server side 
-- Setting water properties. 
height = 0 
SizeVal = 2998 
-- Defining variables. 
southWest_X = -SizeVal 
southWest_Y = -SizeVal 
southEast_X = SizeVal 
southEast_Y = -SizeVal 
northWest_X = -SizeVal 
northWest_Y = SizeVal 
northEast_X = SizeVal 
northEast_Y = SizeVal 
  
-- OnClientResourceStart function that creates the water. 
function thaResourceStarting( ) 
    water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height ) 
    setWaterLevel ( height ) 
end 
addEventHandler("onClientResourceStart", resourceRoot, thaResourceStarting) 
  
local maxLevel      =   35 -- max level 
local untilW        =   120 -- sec 
      
local raising,level     =   (maxLevel/untilW)/10,0 
untilW = nil 
local runningTimer 
      
      
function editSomeWater() 
    level = level + raising -- level raising 
    setWaterLevel ( level, true, true ) -- set the level 
        if level >= maxLevel then -- compare values of level and max level 
        setWaterLevel ( maxLevel, true, true ) -- set it back to max level for perfection 
        if isTimer(runningTimer) then -- check if the timer exist 
            killTimer(runningTimer) -- stop the timer 
        end 
        runningTimer,level,maxLevel = nil,nil,nil -- delete data (ram) 
    end 
end 
      
setTimer (function () -- set a timer for 15000 millisec (15 sec), runs one time "1" 
    runningTimer = setTimer ( editSomeWater, 100, 0 ) -- set an invinity timer to set the water level, (0 = invinity) (only stops when you stop him with killTimer) 
end,30000,1) 
     
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
  

Link to post
  • MTA Team

You need to define the water element to the setWaterLevel. Try this.

--server side 
-- Setting water properties. 
height = 0 
SizeVal = 2998 
-- Defining variables. 
southWest_X = -SizeVal 
southWest_Y = -SizeVal 
southEast_X = SizeVal 
southEast_Y = -SizeVal 
northWest_X = -SizeVal 
northWest_Y = SizeVal 
northEast_X = SizeVal 
northEast_Y = SizeVal 
  
-- OnClientResourceStart function that creates the water. 
function thaResourceStarting( ) 
    setWaterLevel ( -500, false, false ) 
    water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height ) 
    setWaterLevel ( water, height ) 
end 
addEventHandler("onClientResourceStart", resourceRoot, thaResourceStarting) 
  
local maxLevel      =   35 -- max level 
local untilW        =   120 -- sec 
      
local raising,level     =   (maxLevel/untilW)/10,0 
untilW = nil 
local runningTimer 
      
      
function editSomeWater() 
    level = level + raising -- level raising 
    setWaterLevel ( water, level ) -- set the level 
        if level >= maxLevel then -- compare values of level and max level 
        setWaterLevel ( water, maxLevel ) -- set it back to max level for perfection 
        if isTimer(runningTimer) then -- check if the timer exist 
            killTimer(runningTimer) -- stop the timer 
        end 
        runningTimer,level,maxLevel = nil,nil,nil -- delete data (ram) 
    end 
end 
      
setTimer (function () -- set a timer for 15000 millisec (15 sec), runs one time "1" 
    runningTimer = setTimer ( editSomeWater, 100, 0 ) -- set an invinity timer to set the water level, (0 = invinity) (only stops when you stop him with killTimer) 
end,30000,1) 
    
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 

Edited by Guest
Link to post
get this error:

WARNING: MAP\waterrise.lua:33: Bad argument @ 'setWaterLevel' [Expected number at argument 1, got nil]

setWaterLevel ( water, level, true, true ) -- set the level

It works for me

--server side 
-- Setting water properties. 
height = 0 
SizeVal = 2998 
-- Defining variables. 
southWest_X = -SizeVal 
southWest_Y = -SizeVal 
southEast_X = SizeVal 
southEast_Y = -SizeVal 
northWest_X = -SizeVal 
northWest_Y = SizeVal 
northEast_X = SizeVal 
northEast_Y = SizeVal 
  
-- OnClientResourceStart function that creates the water. 
function thaResourceStarting( ) 
    setWaterLevel ( -500, false, false ) 
    water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height ) 
    setWaterLevel ( water, height ) 
end 
addEventHandler("onClientResourceStart", resourceRoot, thaResourceStarting) 
  
local maxLevel      =   35 -- max level 
local untilW        =   120 -- sec 
      
local raising,level     =   (maxLevel/untilW)/10,0 
untilW = nil 
local runningTimer 
      
      
function editSomeWater() 
    level = level + raising -- level raising 
    setWaterLevel ( water, level ) -- set the level 
        if level >= maxLevel then -- compare values of level and max level 
        setWaterLevel ( water, maxLevel ) -- set it back to max level for perfection 
        if isTimer(runningTimer) then -- check if the timer exist 
            killTimer(runningTimer) -- stop the timer 
        end 
        runningTimer,level,maxLevel = nil,nil,nil -- delete data (ram) 
    end 
end 
      
setTimer (function () -- set a timer for 15000 millisec (15 sec), runs one time "1" 
    runningTimer = setTimer ( editSomeWater, 100, 0 ) -- set an invinity timer to set the water level, (0 = invinity) (only stops when you stop him with killTimer) 
end,30000,1) 
    
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 

Link to post

I getting again the same mesage is i told

The water should start to raise after 30sec and then always getting a bit higher until reach maxLevel

This script worked without water creation, but it looked shitty see screenshots

Link to post
I getting again the same mesage is i told

The water should start to raise after 30sec and then always getting a bit higher until reach maxLevel

This script worked without water creation, but it looked :~ see screenshots

you have to change type of script in meta file,add this after your file name type="client"

Link to post

Ok with onResourceStart worked but timer doesnt wait 30sec anymore

Here script again:

--server side 
-- Setting water properties. 
height = 0 
SizeVal = 2998 
-- Defining variables. 
southWest_X = -SizeVal 
southWest_Y = -SizeVal 
southEast_X = SizeVal 
southEast_Y = -SizeVal 
northWest_X = -SizeVal 
northWest_Y = SizeVal 
northEast_X = SizeVal 
northEast_Y = SizeVal 
  
-- OnClientResourceStart function that creates the water. 
function thaResourceStarting( ) 
    setWaterLevel ( -500, false, false ) 
    water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height ) 
    setWaterLevel ( water, height ) 
end 
addEventHandler("onResourceStart", resourceRoot, thaResourceStarting) 
  
local maxLevel      =   35 -- max level 
local untilW        =   120 -- sec 
      
local raising,level     =   (maxLevel/untilW)/10,0 
untilW = nil 
local runningTimer 
      
      
function editSomeWater() 
    level = level + raising -- level raising 
    setWaterLevel ( water, level ) -- set the level 
        if level >= maxLevel then -- compare values of level and max level 
        setWaterLevel ( water, maxLevel ) -- set it back to max level for perfection 
        if isTimer(runningTimer) then -- check if the timer exist 
            killTimer(runningTimer) -- stop the timer 
        end 
        runningTimer,level,maxLevel = nil,nil,nil -- delete data (ram) 
    end 
end 
      
setTimer (function () -- set a timer for 15000 millisec (15 sec), runs one time "1" 
    runningTimer = setTimer ( editSomeWater, 100, 0 ) -- set an invinity timer to set the water level, (0 = invinity) (only stops when you stop him with killTimer) 
end,30000,1) 
    
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
  

Link to post
--server side 
-- Setting water properties. 
height = 0 
SizeVal = 2998 
-- Defining variables. 
southWest_X = -SizeVal 
southWest_Y = -SizeVal 
southEast_X = SizeVal 
southEast_Y = -SizeVal 
northWest_X = -SizeVal 
northWest_Y = SizeVal 
northEast_X = SizeVal 
northEast_Y = SizeVal 
  
-- OnClientResourceStart function that creates the water. 
function thaResourceStarting( ) 
    setWaterLevel ( -500, false, false ) 
    water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height ) 
    setWaterLevel ( water, height ) 
end 
addEventHandler("onResourceStart", resourceRoot, thaResourceStarting) 
  
local maxLevel      =   35 -- max level 
local untilW        =   120 -- sec 
      
local raising,level     =   (maxLevel/untilW)/10,0 
untilW = nil 
local runningTimer 
      
      
function editSomeWater() 
    level = level + raising -- level raising 
    setWaterLevel ( water, level ) -- set the level 
        if level >= maxLevel then -- compare values of level and max level 
        setWaterLevel ( water, maxLevel ) -- set it back to max level for perfection 
        if isTimer(runningTimer) then -- check if the timer exist 
            killTimer(runningTimer) -- stop the timer 
        end 
        runningTimer,level,maxLevel = nil,nil,nil -- delete data (ram) 
    end 
end 
      
setTimer ( editSomeWater, 30000, 1 ) -- set an invinity timer to set the water level, (0 = invinity) (only stops when you stop him with killTimer) 
    
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 
    outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) 

Link to post

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