<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://bf2tech.uturista.pt/index.php?action=history&amp;feed=atom&amp;title=Scripts%3APlayer_Position_Display</id>
	<title>Scripts:Player Position Display - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://bf2tech.uturista.pt/index.php?action=history&amp;feed=atom&amp;title=Scripts%3APlayer_Position_Display"/>
	<link rel="alternate" type="text/html" href="https://bf2tech.uturista.pt/index.php?title=Scripts:Player_Position_Display&amp;action=history"/>
	<updated>2026-08-06T01:08:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://bf2tech.uturista.pt/index.php?title=Scripts:Player_Position_Display&amp;diff=129&amp;oldid=prev</id>
		<title>Pireax: Created page with &quot;__TOC__ == Purpose ==  When run on a testing server this script makes it easy to reposition items around when you&#039;re doing server-side mods, as it saves you from opening the B...&quot;</title>
		<link rel="alternate" type="text/html" href="https://bf2tech.uturista.pt/index.php?title=Scripts:Player_Position_Display&amp;diff=129&amp;oldid=prev"/>
		<updated>2018-06-22T15:36:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__TOC__ == Purpose ==  When run on a testing server this script makes it easy to reposition items around when you&amp;#039;re doing server-side mods, as it saves you from opening the B...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__TOC__&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
When run on a testing server this script makes it easy to reposition items around when you&amp;#039;re doing server-side mods, as it saves you from opening the BF2 Editor, or trying to get debug to work to get positions.&lt;br /&gt;
&lt;br /&gt;
This has only ever been used to find positions in a local dedicated server, and will probably cause all kinds of problems if run on a public server, as it probably won&amp;#039;t handle map changes/more than 1 player.&lt;br /&gt;
&lt;br /&gt;
The positions have 1.0 subtracted from the y axis (vectors are right/up/forward format), as for the player object it is above ground level. Without this flags, vehicles and spawn points will all be above the ground. &lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Requires Modmanager.&lt;br /&gt;
&lt;br /&gt;
Save the following to a file named mm_ppos.py in the [bf2server]/admin/modules/ folder, and add a line to enable it in modmanager.con (usually found in [bf2server]/mods/bf2/settings/).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;Player Position Display module.&lt;br /&gt;
&lt;br /&gt;
===== About =====&lt;br /&gt;
This ModManager script displays your current player object&amp;#039;s position (less 1.0 in the z axis), and the direction you&amp;#039;re facing.&lt;br /&gt;
 &lt;br /&gt;
Run it in a solo testing server to find map positions that may be used for server side modding.&lt;br /&gt;
&lt;br /&gt;
Running it on a public populated server will display the positions of all players, and make it difficult to find your own location&lt;br /&gt;
&lt;br /&gt;
===== History =====&lt;br /&gt;
&lt;br /&gt;
 v1.0 - 20080503:&lt;br /&gt;
 Initial public version&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By polarity.&lt;br /&gt;
Available from bf2tech.org or flightschool.polar-lights.org.uk&lt;br /&gt;
You&amp;#039;re free to use and modify this script&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
import bf2&lt;br /&gt;
import host&lt;br /&gt;
import mm_utils&lt;br /&gt;
from bf2.stats.constants import *&lt;br /&gt;
&lt;br /&gt;
# Set the version of your module here&lt;br /&gt;
__version__ = 1.0&lt;br /&gt;
&lt;br /&gt;
# Set the required module versions here&lt;br /&gt;
__required_modules__ = {&lt;br /&gt;
    &amp;#039;modmanager&amp;#039;: 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Does this module support reload ( are all its reference closed on shutdown? )&lt;br /&gt;
__supports_reload__ = True&lt;br /&gt;
&lt;br /&gt;
# Set the description of your module here&lt;br /&gt;
__description__ = &amp;quot;PlayerPositionDisplay v%s&amp;quot; % __version__&lt;br /&gt;
&lt;br /&gt;
updateTimer = None&lt;br /&gt;
 &lt;br /&gt;
class PlayerPos( object ):&lt;br /&gt;
&lt;br /&gt;
    def __init__( self, modManager ):&lt;br /&gt;
&lt;br /&gt;
        self.mm = modManager&lt;br /&gt;
        self.__state = 0&lt;br /&gt;
       &lt;br /&gt;
    def onPlayerSpawn(self, player, body ):&lt;br /&gt;
        if 1 != self.__state:&lt;br /&gt;
            return 0&lt;br /&gt;
        if (not player.isAIPlayer()):&lt;br /&gt;
            updateTimer = bf2.Timer( self.onUpdate, 1, 1 )&lt;br /&gt;
            updateTimer.setRecurring(2)&lt;br /&gt;
&lt;br /&gt;
    def StopTimer( self ):&lt;br /&gt;
        if 1 != self.__state:&lt;br /&gt;
            return 0&lt;br /&gt;
        if updateTimer:&lt;br /&gt;
            updateTimer.destroy()&lt;br /&gt;
            updateTimer = None&lt;br /&gt;
&lt;br /&gt;
    def onUpdate( self, data ):&lt;br /&gt;
        if 1 != self.__state:&lt;br /&gt;
            return 0&lt;br /&gt;
        #mm_utils.msg_server( &amp;quot;timer event called&amp;quot; )&lt;br /&gt;
        for player in bf2.playerManager.getPlayers():&lt;br /&gt;
            if not player.isAIPlayer():&lt;br /&gt;
                vehicle = player.getVehicle()&lt;br /&gt;
                try:&lt;br /&gt;
                    playerPos = vehicle.getPosition()&lt;br /&gt;
                    playerRot = vehicle.getRotation()&lt;br /&gt;
                    mm_utils.msg_player( player.index, &amp;quot;You are at: %.3f / %.3f / %.3f.  Looking %.1f degrees from North.&amp;quot; % (playerPos[0], playerPos[1] - 1, playerPos[2], playerRot[0] ) )&lt;br /&gt;
                    #mm_utils.msg_player( player.index, &amp;quot;--------------------------&amp;quot; )&lt;br /&gt;
                except:&lt;br /&gt;
                    mm_utils.msg_player( player.index, &amp;quot;failed to find soldier object&amp;#039;s position&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
    def init( self ):&lt;br /&gt;
        if 0 == self.__state:&lt;br /&gt;
            host.registerHandler( &amp;#039;PlayerSpawn&amp;#039;, self.onPlayerSpawn, 1 )&lt;br /&gt;
        # Update to the running state&lt;br /&gt;
        self.__state = 1&lt;br /&gt;
        updateTimer = None&lt;br /&gt;
&lt;br /&gt;
    def shutdown( self ):&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Shutdown and stop processing.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        # Unregister game handlers and do any other&lt;br /&gt;
        # other actions to ensure your module no longer affects&lt;br /&gt;
        # the game in anyway&lt;br /&gt;
       &lt;br /&gt;
        #stop the timer&lt;br /&gt;
        self.StopTimer()&lt;br /&gt;
        # Flag as shutdown as there is currently way to:&lt;br /&gt;
        # host.unregisterHandler&lt;br /&gt;
        self.__state = 2&lt;br /&gt;
&lt;br /&gt;
    def update( self ):&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Process and update.&lt;br /&gt;
        Note: This is called VERY often processing in here should&lt;br /&gt;
        be kept to an absolute minimum.&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
        pass&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def mm_load( modManager ):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Creates and returns your object.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    return PlayerPos( modManager )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
The writers of the other scripts found here on bf2tech.org. This uses some of them as a foundation.&lt;/div&gt;</summary>
		<author><name>Pireax</name></author>
	</entry>
</feed>