Untitled
unknown
plain_text
9 months ago
639 B
15
Indexable
C_Timer.After(10, function()
FindObjById = function(info)
local NPC = nil
local Far_Distance = 500
local total = awm.GetObjectCount()
for i = 1,total do
local ThisUnit = awm.GetObjectWithIndex(i)
local id = awm.ObjectId(ThisUnit)
local distance = awm.GetDistanceBetweenObjects("player",ThisUnit)
local name = awm.UnitFullName(ThisUnit)
if awm.ObjectExists(ThisUnit) and distance < Far_Distance and (tostring(info) ~= nil and name ~= nil and name == tostring(info)) or (tonumber(info) ~= nil and id == tonumber(info)) then
NPC = ThisUnit
Far_Distance = distance
end
end
return NPC
end
end)Editor is loading...
Leave a Comment