This topic was marked solved by its starter, on June 29th, 2017, 01:16 AM

#### Razor.

• Jr. Member
• Posts: 97
##### Command to found pickup with meters like /loc
« on June 24th, 2017, 09:40 PM »
Hey guys, who have command to found pickup with meters? Like /loc command.
Example: Pickup Location: Viceport 203 meters.

• Beta Tester Emeritus
• Posts: 176
##### Re: Command to found pickup with meters like /loc
« Reply #1, on June 24th, 2017, 11:04 PM »
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.
Quote
PS:is trash is ur home language??

#### Luis_Labarca

• Sr. Member
• Hello :D
• Posts: 310
##### Re: Command to found pickup with meters like /loc
« Reply #2, on June 25th, 2017, 01:28 AM »
Code: [Select]
`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 .::[Counter - Striker 1.6]::.
IP: 49.12.15.63:9998

• Hero Member
• Posts: 775

#### DizzasTeR

• VC:MP Beta Tester
• Infinite loops defy infinity by overflowing memory
• Posts: 1,207
##### Re: Command to found pickup with meters like /loc
« Reply #4, on June 27th, 2017, 05:06 PM »
Code: [Select]
`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.

• Jr. Member
• Posts: 97
##### Re: Command to found pickup with meters like /loc
« Reply #5, on June 29th, 2017, 01:16 AM »Last edited on June 29th, 2017, 02:01 AM
Thanks all. :) Solved.