ResetMapInfo: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
(12 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Server function}}
__NOTOC__
This function is used to reset the state of a player.  It is intended to restore a player to his default state as if he had just joined the server, without any scripts affecting him.
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool resetMapInfo ( [player thePlayer] )
bool resetMapInfo ( [player thePlayer = getRootElement()] )
</syntaxhighlight>
 
===Optional Arguments===
{{OptionalArg}}
*'''thePlayer:''' The specific player you wish to restore the state of.  Not specifying this will result in all players map info being reset.
 
==Returns==
Returns ''true'' if the map info was reset successfully, otherwise ''false''.
 
==Example==
This will reset all map info when the resource is stopped.
<syntaxhighlight lang="lua">
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()),
-- Resource stop event
function()
            resetMapInfo()
        end
)
</syntaxhighlight>
</syntaxhighlight>


==Additional stuff this should reset==
==See Also==
*gravity
{{Map_functions}}
*game speed
*cursor state
*player stats
*wanted level
*fighting style
*nametag color
*money
*weather

Revision as of 12:02, 25 February 2013

This function is used to reset the state of a player. It is intended to restore a player to his default state as if he had just joined the server, without any scripts affecting him.

Syntax

bool resetMapInfo ( [player thePlayer = getRootElement()] )

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • thePlayer: The specific player you wish to restore the state of. Not specifying this will result in all players map info being reset.

Returns

Returns true if the map info was reset successfully, otherwise false.

Example

This will reset all map info when the resource is stopped.

addEventHandler("onResourceStop", getResourceRootElement(getThisResource()),
	-- Resource stop event
	function()
            resetMapInfo()
        end
)

See Also