Thread Tools Display Modes
Prev Previous Post   Next Post Next
04-11-21, 04:52 AM   #1
Believe82
A Murloc Raider
Join Date: Sep 2020
Posts: 9
giving loot automatically to someone

Hi,

Apologies if this has been covered, but I ran google and searches and couldn't find anything.
So I very new to coding in lua, and I saw that if I want to give out loot to myself I can use:

Code:
local playerName = UnitName("player")
	SetLootMethod("Master",playerName,"2")
        for ci = 1, 40 do
        local mMaster = GetMasterLootCandidate(li, ci)
	     if mMaster == UnitName("player") then
	            GiveMasterLoot(li, ci)
	     end
	end
I would like to pass code to the addon using either a slash command + player name or slash command + selected player, so when I am the master looter all loot would go to that player.

this is the code I tried at the end of my slash command:

Code:
elseif input == "" then
        print("NLoot: Invalid Command, Input '/nl help' to get a list of available commands")
	else
		local rString = input
                for ci = 1, 40 do
                   local mMaster = GetMasterLootCandidate(li, ci)
	           if mMaster == rString then
	               GiveMasterLoot(li, ci)
	           end
                end
	end
But it returns an error.
Is there an easier way to do this?
Thank you for the help in advance.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » giving loot automatically to someone


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off