Jump to content

[REL] WaterFlood


x86

Recommended Posts

Hi,

This script only works with MTA 1.0 r318.

It's serverside AND clientside!!

Use: /wl [level] (0 = normal)

ServerSide:

  
local root = getRootElement() 
local WaterLevel = 0 
  
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
    -- Resource load event 
    function() 
        setWorldWaterLevel(0, root) 
    end 
) 
addEventHandler("onPlayerJoin", root, 
    -- Join event 
    function() 
        setWorldWaterLevel(WaterLevel, source) 
    end 
) 
  
function setWorldWaterLevel(level, element) 
    if tonumber(level) < 1 then 
        WaterLevel = 0 
        triggerClientEvent("setWorldWaterLevel", element, level, -900) 
    else 
        WaterLevel = level 
        triggerClientEvent("setWorldWaterLevel", element, level, level) 
    end 
end 
  
addCommandHandler("wl", 
    function(playerid, command, param) 
        if param ~= nil then 
            setWorldWaterLevel(param, root) 
        end 
    end 
) 
  

 

ClientSide:

  
local waterSetting 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),  
    function() 
        waterFlood() 
    end 
) 
  
function waterFlood() 
    local height = -900 
    local SizeVal = 2998 
    local southWest_X = -SizeVal 
    local southWest_Y = -SizeVal 
    local southEast_X = SizeVal 
    local southEast_Y = -SizeVal 
    local northWest_X = -SizeVal 
    local northWest_Y = SizeVal 
    local northEast_X = SizeVal 
    local northEast_Y = SizeVal 
    waterSetting = createWater(southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height, false) 
end 
  
addEvent("setWorldWaterLevel", true) 
addEventHandler("setWorldWaterLevel", getRootElement(), 
    function(world, custom) 
        setWaterLevel(tonumber(world)) 
        setWaterLevel(waterSetting, custom) 
    end 
) 
  

No problemo :P

Edited by Guest
Link to comment

function waterFlood is just sitting there doing nothing? :roll:

Also, I get a warning if I set the waterlevel:

WARNING: water_c.lua: Bad Argument @ 'setWaterLevel' - Line: 112 

In the provided client-side script, it's line 21.

And it doesn't create any new water... Too bad, because it's not really a flood like this... :( Still a nice idea though. :D

Link to comment
function waterFlood is just sitting there doing nothing? :roll:

WARNING: water_c.lua: Bad Argument @ 'setWaterLevel' - Line: 112 

  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),  
    function() 
        waterFlood() 
    end 
) 
  

Link to comment

Sebas has just "released" the example code from the createWater wiki page ;) with some serverside additions.

For those who don't want to bother installing a nightly build, here's a taste of what you will be able to do in MTASA 1.0:

1234612327.jpg 1234612348.jpg

Water can be created, destroyed and repositioned on-the-fly (e.g. slowly rising water), so the functions are perfect for "escape the flood" or similar gamemodes.

Link to comment
Sebas has just "released" the example code from the createWater wiki page ;) with some serverside additions.

For those who don't want to bother installing a nightly build, here's a taste of what you will be able to do in MTASA 1.0:

1234612327.jpg 1234612348.jpg

Water can be created, destroyed and repositioned on-the-fly (e.g. slowly rising water), so the functions are perfect for "escape the flood" or similar gamemodes.

Looks like The Day After Tommorow, lol.

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