Scripting/Squirrel/Functions/Misc/GetDistrictName

From VC-MP Wiki

Jump to: navigation, search

This function returns the disrtict name from x and y coordinates.

Syntax

string GetDistrictName( float x, float y )

Example

This command tells player's location when someone types '/c loc playername'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "loc" )
     {
          local plr = FindPlayer( text );
          
          if ( !plr ) MessagePlayer( "Error: Player '" + text + "' is not online.", player );
          else
          {
               local pos = plr.Pos;
               MessagePlayer( plr.Name + "'s location: " + GetDistrictName( pos.x, pos.y ), player );
          }
     }
}

Notes

The functions MessagePlayer, player.Name, player.Pos and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Personal tools
squirrel scripting