Quantcast
WoWInterface - View Single Post - giving loot automatically to someone
View Single Post
04-11-21, 04:52 AM   #1
Believe82
A Murloc Raider
Join Date: Sep 2020
Posts: 4
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