Command to found pickup with meters like /loc

Started by Razor., Jun 24, 2017, 08:40 PM

Previous topic - Next topic

Razor.

Hey guys, who have command to found pickup with meters? Like /loc command.
Example: Pickup Location: Viceport 203 meters.

Shadow

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.
QuotePS:is trash is ur home language??

Luis_Labarca

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 );
}
}
}

My server RP
IP: 51.222.28.159:8194


DizzasTeR

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 );

Razor.

#5
Thanks all. :) Solved.