isPlayerMapForced | Multi Theft Auto: Wiki Skip to content

isPlayerMapForced

Client-side
Server-side
Shared

Pair: forcePlayerMap

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function checks if the specified player's map (F11) has been forced on or not.

OOP Syntax Help! I don't understand this!

  • Method:player:isMapForced(...)
  • Variable: .mapForced

Syntax

bool isPlayerMapForced ( )

Returns

  • bool: value

Returns true if the local player's map is forced on, false otherwise.

Code Examples

server

This 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