ForcePlayerMap: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
{{Server function}}
__NOTOC__
__NOTOC__
This function is used to force a player's radar-map to show (and stay showing)
This function is used to forcefully show a player's radar map.


==Syntax==
==Syntax==
Line 7: Line 8:
===Required Arguments===
===Required Arguments===
*'''thePlayer''': A [[player]] object referencing the specified player
*'''thePlayer''': A [[player]] object referencing the specified player
*'''forceOn''': A boolean value representing whether or not the players radar-map will be forced on
*'''forceOn''': A boolean value representing whether or not the players radar map will be forced on


===Returns===
===Returns===
Returns ''true'' if the player's radar-map was forced on, ''false'' otherwise.
Returns ''true'' if the player's radar map was forced on, ''false'' otherwise.


==Example==
==Example==
This example forces a players radar-map on for 10seconds if it hasnt been already
This example forces the radar map of the player named "dave" on for 10 seconds, if it hasn't been already
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
player = getPlayerByNick ( "dave" ) -- do we have a player named "dave"
-- Get the player named "dave"
if ( player ) then
dave = getPlayerFromNick ( "dave" )
  if ( isPlayerMapForced ( player ) == false ) then -- if his radar-map isn't already forced on
-- Make sure we found him
    forcePlayerMap ( player, true ) -- force it on
if ( dave ) then
    setTimer ( "forcePlayerMap", 10000, 1, false ) -- force it off in 10secs
    if ( isPlayerMapForced ( dave ) == false ) then         -- if his radar map isn't already forced on
  end
        forcePlayerMap ( dave, true )                       -- force it on
        setTimer ( forcePlayerMap, 10000, 1, dave, false ) -- stop forcing in 10 seconds
    end
end
end
</syntaxhighlight>
</syntaxhighlight>

Revision as of 12:47, 21 August 2007

This function is used to forcefully show a player's radar map.

Syntax

bool forcePlayerMap ( player thePlayer, bool forceOn )

Required Arguments

  • thePlayer: A player object referencing the specified player
  • forceOn: A boolean value representing whether or not the players radar map will be forced on

Returns

Returns true if the player's radar map was forced on, false otherwise.

Example

This example forces the radar map of the player named "dave" on for 10 seconds, if it hasn't been already

-- Get the player named "dave"
dave = getPlayerFromNick ( "dave" )
-- Make sure we found him
if ( dave ) then
    if ( isPlayerMapForced ( dave ) == false ) then         -- if his radar map isn't already forced on
        forcePlayerMap ( dave, true )                       -- force it on
        setTimer ( forcePlayerMap, 10000, 1, dave, false )  -- stop forcing in 10 seconds
    end
end

See Also