Hey guys, who have command to found pickup with meters? Like /loc command.
Example: Pickup Location: Viceport 203 meters.
Pretty sure there is a method (Vector3::Distance). Use that and print the distance. Every entity in the game has a .Pos member which returns it's position as a tridimensional vector that is printable. All .Distance does is calculate the distance using the standard formula.
if ( cmd == "locp" )
{
if ( !text ) MessagePlayer( "Syntax: /"+cmd+" <Pickup ID>", player);
else if( !IsNum( text )) MessagePlayer( "Error - PickupID In Numbers.", player );
else{
local Pickup = FindPickup(text.tointeger());
if( !Pickup )MessagePlayer("Error - Unknown Pickup", player );
else{
MessagePlayer( "Pickup Location : "+GetDistrictName(Pickup.Pos.x, Pickup.Pos.y)+", Meters : "+DistanceFromPoint( player.Pos.x, player.Pos.y , Pickup.Pos.x, Pickup.Pos.y )+".", player );
}
}
}
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Functions/DistanceFromPoint
Pretty sure that's what you are looking for
local pickup_MyPickup = FindPickup( PICKUP_ID || 0 );
MessagePlayer( format( "* Pickup is located at: %s, %i meters",
GetDistrictName( pickup_MyPickup.Pos.x pickup_MyPickup.Pos.y ),
player.Pos.Distance( pickup_MyPickup.Pos ).tointeger() ),
player );
Thanks all. :) Solved.