This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [LUA] Yards  (Read 2311 times)

medi4

  • Guest
[LUA] Yards
« 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
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [LUA] Yards
« Reply #1 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".
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

medi4

  • Guest
Re: [LUA] Yards
« Reply #2 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
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Curas

  • Registred Member
  • Race Changer
  • *****
  • Posts: 36
    • View Profile
    • http://worldofelysium.dyndns.org/
Re: [LUA] Yards
« Reply #3 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [LUA] Yards
« Reply #4 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

medi4

  • Guest
Re: [LUA] Yards
« Reply #5 on: November 24, 2010, 09:11:18 pm »
well, .distance is a mangos command ??
i tried in arcemu...
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [LUA] Yards
« Reply #6 on: November 24, 2010, 11:40:40 pm »
Oh well, in that case. I did not really expect any difference between their command lists.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

medi4

  • Guest
Re: [LUA] Yards
« Reply #7 on: November 25, 2010, 09:10:43 am »
err (ähh auf englisch...), so it is mangos?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »