Try this:
Code:
function CheckIfInRange_Whitemane90003(Whitemane)
local player = Whitemane:GetClosestPlayer()
local unit = Whitemane:GetCreatureNearestCoords(262.055908, 64.339806, 109.901627, 29138)
if unit == nil then
print("ERROR : unit is null in CheckIfInRange_Whitemane90003 function.")
return
end
if player == nil then
print("ERROR : nearest player was null in CheckIfInRange_Whitemane90003 function.")
end
local distance = unit:GetDistanceYards(player)
if player:HasQuest(90003) and distance <= 5 then
Whitemane:RegisterEvent("Necromancer1_Whitemane90003", 2000, 1)
else if (not player:HasQuest(90003)) and (distance <= 5) then
Whitemane:SendChatMessage(42, 0, "A strange force prevents me from advancing further.")
player:MovePlayerTo(262.464417, 37.656471, 115.727440, 1.565179, 256, 0)
end
end