• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

player:ModifyHonorPoints(500) not working, loop in gettable

Status
Not open for further replies.

Xaver

Respected Member
hi guys

im well when menü click this function work:

player:ModifyHonorPoints(500)


loop in gettable

Code:
elseif (intid == 400) then
	     
          
		  player:GossipMenuAddItem(10, "2x 8000 Gold Baren = 60 Honor Points", 0, 452)
                  player:GossipSendMenu(1, creature)



 elseif (intid == 452) then
	 if (player:HasItem(38186, 2, 1)) then
        player:RemoveItem(38186, 2)

	[COLOR="#00FF00"]player:ModifyHonorPoints(500)[/COLOR]

        player:GossipSendMenu(1, creature)
	player:CastSpell(player, 103740, true)
	creature:SendUnitWhisper("|cffffffffTausch erfolgreich...", player)
        player:SendNotification("|cffffffffTausch erfolgreich...")
	player:GossipComplete()
		else
        creature:SendUnitWhisper("Sie sind nicht im besitz des 2x"..itemGoldbaren2x.."  Items.", player)
        player:SendNotification("Sie sind nicht im besitz des 2x"..itemGoldbaren2x.."  Items.")
	player:GossipComplete()
end


who is my error line ?? thx
 

Xaver

Respected Member
Code:
local NpcEntry = 500020



local function OnGossipHello(event, player, creature)
        
		  
		  player:GossipMenuAddItem(5, "Instance Items", 0, 200)
		  player:GossipMenuAddItem(5, "Gold Baren", 0, 1)

		
    player:GossipSendMenu(1, creature)
end

local function OnGossipSelect(event, player, creature, sender, intid, code)
    if (intid == 1) then
       
		
          player:GossipMenuAddItem(6, "gold gegen honor", 0, 5)
          player:GossipSendMenu(1, creature)
        
		
	elseif (intid == 5) then
	 if (player:HasItem(8100015, 2, 1)) then
        player:RemoveItem(8100015, 2)
		player:ModifyHonorPoints(+500)
        player:GossipSendMenu(1, creature)
		player:CastSpell(player, 103740, true)
		creature:SendUnitWhisper("|cffffffffTausch erfolgreich...", player)
        player:SendNotification("|cffffffffTausch erfolgreich...")
		player:GossipComplete()
		else
            creature:SendUnitWhisper("fehler", player)
            player:SendNotification("fehler")
			player:GossipComplete()
	end		
		
		
		
    end
end

RegisterCreatureGossipEvent(NpcEntry, 1, OnGossipHello)
RegisterCreatureGossipEvent(NpcEntry, 2, OnGossipSelect)


my eluna error log is not work sry.
 

Grandelf

Esteemed Member
SendUnitWhisper requires 3 arguments, the msg, the language and the player.
Code:
const char* msg = Eluna::CHECKVAL<const char*>(L, 2);
uint32 lang = Eluna::CHECKVAL<uint32>(L, 3);
Player* receiver = Eluna::CHECKOBJ<Player>(L, 4);
bool bossWhisper = Eluna::CHECKVAL<bool>(L, 5, false);
So instead of doing creature:SendUnitWhisper("|cffffffffTausch erfolgreich...", player), you should
try this: creature:SendUnitWhisper("|cffffffffTausch erfolgreich...", 0, player).
Code:
        elseif (intid == 5) then
	        if (player:HasItem(8100015, 2, 1)) then
                        player:RemoveItem(8100015, 2)
		        player:ModifyHonorPoints(+500)
                        [COLOR="#FF0000"]player:GossipSendMenu(1, creature)[/COLOR]
		        player:CastSpell(player, 103740, true)
		        creature:SendUnitWhisper("|cffffffffTausch erfolgreich...", player)
                        player:SendNotification("|cffffffffTausch erfolgreich...")
		        player:GossipComplete()
You're not trying to send any menu there, so you can just remove the part in red.

Also player:ModifyHonorPoints(+500), the +500 is wrong, it should be just 500.
 

Xaver

Respected Member
no work :(

Code:
     elseif (intid == 5) then
	 if (player:HasItem(38186, 2, 1)) then
        player:RemoveItem(38186, 2)
		player:ModifyHonorPoints(500)
		player:CastSpell(player, 103740, true)
		creature:SendUnitWhisper("|cffffffffTausch erfolgreich...", 0, player)
        player:SendNotification("|cffffffffTausch erfolgreich...", 0, player)
		player:GossipComplete()
		else
            creature:SendUnitWhisper("Sie sind nicht im besitz des 2x"..itemGoldbaren2x.."  Items.", 0, player)
            player:SendNotification("Sie sind nicht im besitz des 2x"..itemGoldbaren2x.."  Items.")
			player:GossipComplete()
	end
	
	
    end
end

loop in gettable
 

Rochet2

Moderator / Eluna Dev
What version of eluna are you using? If you dont know exactly, try giving a date of how old it is.

There was a problem about 6 months ago where the internal setup caused the loop.
https://github.com/ElunaLuaEngine/Eluna/issues/83

Try this; (tested and working code)
Additionally you can try deleting LuaFunctions.ext from lua_scripts/extensions/
Code:
--[[
Fixes:
Added language to SendUnitWhisper calls.
Removed the + from ModifyHonorPoints(+500)
Changed HasItem to have boolean as the last argument. Do note that 0 does not equal to false.
Removed unnecessary code:
player:GossipSendMenu(1, creature)
]]

local NpcEntry = 500020

local function OnGossipHello(event, player, creature)
    player:GossipMenuAddItem(5, "Instance Items", 0, 200)
    player:GossipMenuAddItem(5, "Gold Baren", 0, 1)
    player:GossipSendMenu(1, creature)
end

local function OnGossipSelect(event, player, creature, sender, intid, code)
    if (intid == 1) then
        player:GossipMenuAddItem(6, "gold gegen honor", 0, 5)
        player:GossipSendMenu(1, creature)
    elseif (intid == 5) then
        if (player:HasItem(8100015, 2, true)) then
            player:RemoveItem(8100015, 2)
            player:ModifyHonorPoints(500)
            player:CastSpell(player, 103740, true)
            creature:SendUnitWhisper("|cffffffffTausch erfolgreich...", 0, player)
            player:SendNotification("|cffffffffTausch erfolgreich...")
            player:GossipComplete()
        else
            creature:SendUnitWhisper("fehler", 0, player)
            player:SendNotification("fehler")
            player:GossipComplete()
        end
    end
end

RegisterCreatureGossipEvent(NpcEntry, 1, OnGossipHello)
RegisterCreatureGossipEvent(NpcEntry, 2, OnGossipSelect)
 

Lightning Blade

BETA Tester
no work :(

Code:
     elseif (intid == 5) then
	 if (player:HasItem(38186, 2, 1)) then
        player:RemoveItem(38186, 2)
		player:ModifyHonorPoints(500)
		player:CastSpell(player, 103740, true)
		creature:SendUnitWhisper("|cffffffffTausch erfolgreich...", 0, player)
        player:SendNotification("|cffffffffTausch erfolgreich...", 0, player)
		player:GossipComplete()
		else
            creature:SendUnitWhisper("Sie sind nicht im besitz des 2x"..itemGoldbaren2x.."  Items.", 0, player)
            player:SendNotification("Sie sind nicht im besitz des 2x"..itemGoldbaren2x.."  Items.")
			player:GossipComplete()
	end
	
	
    end
end

loop in gettable

I haven't fooled around with Eluna for a while but this ( " if (player:HasItem(38186, 2, 1)) " ), I think the 1 which indicates whether or not you are checking the players bank need to be a true or false, false = don't even write it at all, and true = (38186, 2, true ) - I don't need to be true on that one, but it used to be a bool, together with the fact that why have an integer that can hold a thousand different numbers when you can use a bool that check yes or no


When you send notifications you don't need the language column, nor do you need the playe field, it's just straight up.
player:SendNotification("blabla")

"player:SendNotification("|cffffffffTausch erfolgreich...", 0, player) "


also since I don't have all of yours script, make sure you have correct end tags, so that you done have 1 too many.
 

Xaver

Respected Member
ok this not work bro, emm i old eluna or kp


rochet2 has my eluna import on my core, i can not update my eluna end error in compile.
 
Status
Not open for further replies.
Top