Thread Tools Display Modes
06-01-08, 03:34 PM   #1
keflem
A Defias Bandit
Join Date: Jun 2008
Posts: 3
Help with matching a specific player name

I use loot hog and would like to send custom messages to specific users who try and slash roll something other than 1-100.

This is the Function from Loot Hog with out modification that works:
Code:
function loothog_ProcessRoll(player, roll, min_roll, max_roll)
	roll = tonumber(roll)
	min_roll = tonumber(min_roll)
	max_roll = tonumber(max_roll)

	--call to update internal statistic
	loothog_updateRollStatistics(roll)
	
	-- Reject cheaters: at this position should be the new function loothog_validRoll(...)
	--if ((min_roll ~= 1)  or (max_roll > 100)) and (loothog_settings["reject"]) then
	if (not loothog_validRoll(roll, min_roll, max_roll) and (loothog_settings["reject"])) then
		local cheat_msg = string.format(LOOTHOG_MSG_CHEAT, player, roll, min_roll, max_roll)
		if (loothog_settings["reject_announce"]) then
			-- Bust the cheater if configured to announce rejects:
			loothog_chat(cheat_msg)
		else
			-- Otherwise just notify the local client:
			if (DEFAULT_CHAT_FRAME) then
				DEFAULT_CHAT_FRAME:AddMessage(cheat_msg)
			end
		end
		return
	end
This is the code with my modification that does not work:
Code:
function loothog_ProcessRoll(player, roll, min_roll, max_roll)
	roll = tonumber(roll)
	min_roll = tonumber(min_roll)
	max_roll = tonumber(max_roll)

	--call to update internal statistic
	loothog_updateRollStatistics(roll)
	
	-- Reject cheaters: at this position should be the new function loothog_validRoll(...)
	--if ((min_roll ~= 1)  or (max_roll > 100)) and (loothog_settings["reject"]) then
	if (not loothog_validRoll(roll, min_roll, max_roll) and (loothog_settings["reject"])) then
		if (player["Keflem"]) then
			local cheat_msg = string.format(LOOTHOG_MSG_CHEAT1, player, roll, min_roll, max_roll)
		end
				
		--local cheat_msg = string.format(LOOTHOG_MSG_CHEAT, player, roll, min_roll, max_roll)
		if (loothog_settings["reject_announce"]) then
			-- Bust the cheater if configured to announce rejects:
			loothog_chat(cheat_msg)
		else
			-- Otherwise just notify the local client:
			if (DEFAULT_CHAT_FRAME) then
				DEFAULT_CHAT_FRAME:AddMessage(cheat_msg)
			end
		end
		return
	end

I have tried adding it many different ways and cannot get it to work as i intended. Any help would be greatly appreciated.

Thank you,

Keflem
  Reply With Quote
06-01-08, 06:18 PM   #2
Maccaa
A Fallenroot Satyr
 
Maccaa's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 27
What is

Code:
if (player["Keflem"]) then
I haven't looked at this specific AddOn so I'm not sure if that's in the code somewhere but maybe this is what you need.

Code:
if (UnitName("player") == "Keflem") then
  Reply With Quote
06-01-08, 07:01 PM   #3
keflem
A Defias Bandit
Join Date: Jun 2008
Posts: 3
i just tried this. It does not work.


I have even tried :

if (player == "Keflem") then

and it does not work.


pulling my hair out on this one.
  Reply With Quote
06-01-08, 07:39 PM   #4
Maccaa
A Fallenroot Satyr
 
Maccaa's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 27
Code:
function loothog_ProcessRoll(player, roll, min_roll, max_roll)
	roll = tonumber(roll)
	min_roll = tonumber(min_roll)
	max_roll = tonumber(max_roll)

	--call to update internal statistic
	loothog_updateRollStatistics(roll)
	
	-- Reject cheaters: at this position should be the new function loothog_validRoll(...)
	--if ((min_roll ~= 1)  or (max_roll > 100)) and (loothog_settings["reject"]) then
	if (not loothog_validRoll(roll, min_roll, max_roll) and (loothog_settings["reject"])) then
		local cheat_msg
		if ("Keflem" == UnitName("player")) then
			cheat_msg = string.format(LOOTHOG_MSG_CHEAT1, player, roll, min_roll, max_roll)
		else
			cheat_msg = string.format(LOOTHOG_MSG_CHEAT, player, roll, min_roll, max_roll)
		end	
		--local cheat_msg = string.format(LOOTHOG_MSG_CHEAT, player, roll, min_roll, max_roll)
		if (loothog_settings["reject_announce"]) then
			-- Bust the cheater if configured to announce rejects:
			loothog_chat(cheat_msg)
		else
			-- Otherwise just notify the local client:
			if (DEFAULT_CHAT_FRAME) then
				DEFAULT_CHAT_FRAME:AddMessage(cheat_msg)
			end
		end
		return
	end
(there's an end missing here :/. maybe you just didn't copy it in)


I assume you added LOOTHOG_MSG_CHEAT1 yourself?
  Reply With Quote
06-01-08, 09:31 PM   #5
keflem
A Defias Bandit
Join Date: Jun 2008
Posts: 3
okay used this. It still does not work. I get a chat usage error. Additionally how do i compare to the player argument passed to the function rather than the Unit player.

Thank you for all of your help BTW.

Keflem
  Reply With Quote
06-01-08, 09:45 PM   #6
Maccaa
A Fallenroot Satyr
 
Maccaa's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 27
What exactly is the error?

and

Code:
if (player == "Keflem") then
  Reply With Quote
07-03-08, 08:53 AM   #7
scanmaster
A Murloc Raider
Join Date: Jul 2008
Posts: 5
I think this is the way to do it:

Code:
if UnitExists("Keflem") then ....
Using UnitName("player") refers to yourself.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with matching a specific player name


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