Hey guys, I'm currently trying to find a way to get the distance between two players. I could propably do it via some vector math, but maybe there is already something in the modules?
Thank you
CSGO: Distance between two players
https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/mathlib/mathlib_wrap.cpp#L177
That will return in "game units", so you will have to adjust it to get the feet/meters (or whatever type of distance you are looking for).
That will return in "game units", so you will have to adjust it to get the feet/meters (or whatever type of distance you are looking for).
Thank you very much!
I'm afraid I am more than rusty with all of this so could you please tell me if this is the right use:
I'm afraid I am more than rusty with all of this so could you please tell me if this is the right use:
Syntax: Select all
from mathlib import Vector
import players
player_orig = players.get_abs_origin(player_index)
other_orig = players.get_abs_origin(other_index)
distance = player_orig.Vector.get_distance(other_orig)
Syntax: Select all
from players.entity import PlayerEntity
first_player = PlayerEntity(player_index)
second_player = PlayerEntity(other_index)
distance = first_player.origin.get_distance(second_player.origin)
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 45 guests