IsPlayerMapForced: Difference between revisions
Jump to navigation
Jump to search
(add client oop syntax) |
Fernando187 (talk | contribs) No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
This function checks if the specified player's | This function checks if the specified player's map (F11) has been forced on or not. | ||
==Syntax== | ==Syntax== | ||
Line 11: | Line 11: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the player's | Returns ''true'' if the player's map is forced on, ''false'' otherwise. | ||
</section> | </section> | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
<syntaxhighlight lang="lua">bool isPlayerMapForced ()</syntaxhighlight> | <syntaxhighlight lang="lua">bool isPlayerMapForced ()</syntaxhighlight> | ||
{{OOP||[[Player]].isMapForced| | {{OOP||[[Player]].isMapForced||forcePlayerMap}} | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the local player's | Returns ''true'' if the local player's map is forced on, ''false'' otherwise. | ||
</section> | </section> | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
This example forces a | This example forces a player's map on for 10 seconds if it hasn't been already. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function forceMapForPlayer ( callingPlayer, command, whoNick ) | function forceMapForPlayer ( callingPlayer, command, whoNick ) | ||
local who = getPlayerFromName ( whoNick ) -- Look up the specified player | local who = getPlayerFromName ( whoNick ) -- Look up the specified player | ||
if ( who ) then | if ( who ) then | ||
if ( not isPlayerMapForced ( who ) ) then -- if | if ( not isPlayerMapForced ( who ) ) then -- if their map isn't already forced on | ||
forcePlayerMap ( who, true ) -- force it on | forcePlayerMap ( who, true ) -- force it on | ||
setTimer ( forcePlayerMap, 10000, 1, who, false ) -- force it off in 10secs | setTimer ( forcePlayerMap, 10000, 1, who, false ) -- force it off in 10secs |
Latest revision as of 11:53, 9 November 2024
This function checks if the specified player's map (F11) has been forced on or not.
Syntax
Click to collapse [-]
Serverbool isPlayerMapForced ( player thePlayer )
OOP Syntax Help! I don't understand this!
- Method: player:isMapForced(...)
- Variable: .mapForced
- Counterpart: forcePlayerMap
Required Arguments
- thePlayer: A player object referencing the specified player
Returns
Returns true if the player's map is forced on, false otherwise.
Click to collapse [-]
Clientbool isPlayerMapForced ()
OOP Syntax Help! I don't understand this!
- Method: Player.isMapForced(...)
- Counterpart: forcePlayerMap
Returns
Returns true if the local player's map is forced on, false otherwise.
Example
Click to collapse [-]
ServerThis example forces a player's map on for 10 seconds if it hasn't been already.
function forceMapForPlayer ( callingPlayer, command, whoNick ) local who = getPlayerFromName ( whoNick ) -- Look up the specified player if ( who ) then if ( not isPlayerMapForced ( who ) ) then -- if their map isn't already forced on forcePlayerMap ( who, true ) -- force it on setTimer ( forcePlayerMap, 10000, 1, who, false ) -- force it off in 10secs outputChatBox ( "Forcing Map for " .. whoNick, callingPlayer ) -- output a message to the one who entered the command else outputChatBox ( "Map already forced for " .. whoNick, callingPlayer ) -- if the map is already forced, output a message end else outputChatBox ( "Couldn't find " .. whoNick, callingPlayer ) -- if the player wasn't found, output a message end end addCommandHandler ( "forcemap", forceMapForPlayer ) -- add a command handler
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState