Modcraft - The community dedicated to quality WoW modding!

Wrath of the Lich King Modding => Serverside Modding => Topic started by: medi4 on November 22, 2010, 10:49:46 pm

Title: [LUA] Yards
Post by: medi4 on November 22, 2010, 10:49:46 pm
[center:3c29pyk1]Are you tired of appraise the yards distance between you and your target to create an awesome LUA script?[/center:3c29pyk1]

[center:3c29pyk1]Then I have the perfect LUA script for you![/center:3c29pyk1]

Just paste this code
Code: [Select]
function Get_Distance(event, player, message, type, language)

local message = string.lower(message)

if (message == "yards") then

player:SendBroadcastMessage("It's "..player:GetDistanceYards(player:GetSelection()).." yards to your target.")

end

end



RegisterServerHook(16, "Get_Distance")
in a text file... rename it to yards.lua put it in your scripts folder and reload you lua engine.

Just say in-game yards and you'll get the exactly distance to your target

Credits:
medi4
stoneharry
Title: Re: [LUA] Yards
Post by: schlumpf on November 23, 2010, 12:32:48 am
Or just use ".distance":

Code: [Select]
{ "distance",       SEC_ADMINISTRATOR,  false, OldHandler<&ChatHandler::HandleGetDistanceCommand>,         "", NULL },
Doing the same, exception handled. Your script might fail without selection btw.
Doing it that way also provides the possibility to say ".distance someplayer".
Title: Re: [LUA] Yards
Post by: medi4 on November 24, 2010, 02:07:24 pm
well, your script is nice but you have to recompile your core... and in mine version you just have to put this in your script folder...

Quote
Your script might fail without selection btw.
:ufu: ofc but the meaning of my script is to know the distance to your selection?! so it makes no sense without a selection
Title: Re: [LUA] Yards
Post by: Curas on November 24, 2010, 03:20:07 pm
As a mangos user I would prefer schlumpf's script, coz lua doesn't works. Both Good Scripts.
Title: Re: [LUA] Yards
Post by: schlumpf on November 24, 2010, 04:06:21 pm
Uhm .. I did not supply a script but just wanted to note, that there already are chat commands for this. There is no need to make anything or linking "my script more", as there is no "my script" but just.. its already in the core.
Title: Re: [LUA] Yards
Post by: medi4 on November 24, 2010, 09:11:18 pm
well, .distance is a mangos command ??
i tried in arcemu...
Title: Re: [LUA] Yards
Post by: schlumpf on November 24, 2010, 11:40:40 pm
Oh well, in that case. I did not really expect any difference between their command lists.
Title: Re: [LUA] Yards
Post by: medi4 on November 25, 2010, 09:10:43 am
err (ähh auf englisch...), so it is mangos?