GetWaveHeight: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
This example changes the wave height to the given amount.
This example changes the wave height to the given amount.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function scriptWave ( player, command, height )
function scriptWave ( thePlayer, command, height )
   local oldHeight = getWaveHeight()
   local oldHeight = getWaveHeight()
   height = tonumber ( height )
   height = tonumber ( height )
   success = setWaveHeight ( height )
   success = setWaveHeight ( height )
   if ( success ) then
   if ( success ) then
     outputChatBox ( "The old wave height was: " .. oldHeight .. "; " .. getClientName ( player ) .. " set it to: " .. height )
     outputChatBox ( "The old wave height was: " .. oldHeight .. "; " .. getClientName ( thePlayer ) .. " set it to: " .. height )
   else outputChatBox ( "Invalid number." )
   else outputChatBox ( "Invalid number." )
   end
   end

Revision as of 15:18, 4 August 2007

This function returns the current wave height.

Syntax

float getWaveHeight()

Returns

Returns the height as a float, false otherwise.

Example

Click to collapse [-]
Server

This example changes the wave height to the given amount.

function scriptWave ( thePlayer, command, height )
  local oldHeight = getWaveHeight()
  height = tonumber ( height )
  success = setWaveHeight ( height )
  if ( success ) then
    outputChatBox ( "The old wave height was: " .. oldHeight .. "; " .. getClientName ( thePlayer ) .. " set it to: " .. height )
  else outputChatBox ( "Invalid number." )
  end
end
addCommandHandler ( "setwave", scriptWave )

See Also