GetBirdsEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 10: Line 10:


==Example==  
==Example==  
This example outputs a message the Birds current state.
This example Enables or Disables the Birds.
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function areBirdsEnabled()
function setBirdsState()
  outputChatBox("The birds are currently ".. (getBirdsEnabled() and "Enabled" or "Disabled") ..".") -- output if the Birds are Enabled or Disabled.
setBirdsEnabled(not getBirdsEnabled()) -- Disable the Birds if they're enabled, either Enable them.
outputChatBox("The birds are now ".. (getBirdsEnabled() and "Enabled" or "Disabled") ..".") -- Output the new Birds state.
end
end
addCommandHandler("birds",areBirdsEnabled) -- add the command handler.
addCommandHandler("birds",setBirdsState) -- Add the command handler attached to the function "setBirdsState".
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 23:10, 28 January 2012

This function will tell you if the birds are enabled or disabled.

Syntax

bool getBirdsEnabled ()

Returns

Returns true if the birds are enabled or false if the birds are disabled.

Example

This example Enables or Disables the Birds.

Click to collapse [-]
Client
function setBirdsState()
	setBirdsEnabled(not getBirdsEnabled()) -- Disable the Birds if they're enabled, either Enable them.
	outputChatBox("The birds are now ".. (getBirdsEnabled() and "Enabled" or "Disabled") ..".") -- Output the new Birds state.
end
addCommandHandler("birds",setBirdsState) -- Add the command handler attached to the function "setBirdsState".

Requirements

Minimum server version 1.3
Minimum client version 1.3

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.3" client="1.3" />

See Also