Jump to content

Water level


Newbie

Recommended Posts

  • Moderators
Posted
setTimer 
setWaterLevel 

wiki knows everything.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

Hm...

I tryed it in my script..

No errors came

function buyWater (source) 
    thePlayer = source 
    cash = getPlayerMoney(source) 
    local nick = getPlayerName(source)  
    local x,y,z = getElementPosition(source) 
    local level = getElementData(source,"Level") 
    if level > 19.99 and cash > 5000 then 
    setWaterLevel(30) 
    outputChatBox("#FFFFFF" .. nick .. " #FF0000buys sea storm, watchout!", getRootElement(), 255, 255, 255, true) 
    givePlayerMoney ( thePlayer, -5000 )  else 
    outputChatBox("You need more cash or your level does not meet the requirements", source, 255, 255, 255, true) 
    end 
    end 
  
addCommandHandler("buyseastorm", buyWater) 

Even tryed this:

to see does this even work

addCommandHandler( "waterlevel", 
    function ( plr, cmd, newlevel ) 
        setWaterLevel( tonumber( newlevel ) ); 
    end 
); 

And nothing, maybe its cause im on race gamemode ? I've added admin rights to resource too

  • Moderators
Posted

Lets start with the SECOND code.

Is it serverside?

and how did you execute this?

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted

yes I can see you do it by command, but the command:

/waterlevel 30

?

And nothing, maybe its cause im on race gamemode ?

afaik yes, the race resource is editing the water level every round you play.

But has nothing to do with admin rights.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
yes I can see you do it by command, but the command:

/waterlevel 30

?

And nothing, maybe its cause im on race gamemode ?

afaik yes, the race resource is editing the water level every round you play.

But has nothing to do with admin rights.

Yep.

Posted
addCommandHandler( "waterlevel", 
    function ( plr, cmd, newlevel ) 
        if not newlevel then outputChatBox("Please type the level you want",plr,255,0,0) return end 
        if newlevel and tonumber ( newlevel ) then 
        setWaterLevel( tonumber( newlevel ) ); 
        outputChatBox("Water level successfully change to "..newlevel,plr,255,0,0) return end 
    end 
); 

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

Forget it guys, i've discovered that these functions dont work outside GTA SA Map, where mostly DD maps are made, i think its possible only while using createWater.

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