Jump to content

Function help

Recommended Posts

Hello guys, may someone add a function for me?I can wait months,weeks, ofc np just someone do it when he can :)

Need to add a function which to be connected with database and menus must be shown only for gmlevel rank 1, lower gmlevel than 1 ( 0 = player ) npc must tell them something like: You aren't vip, sorry idk...need that function, please help.

local npcid = 47

function morph_gossip(unit, player, creature)
    player:GossipMenuAddItem(0, "|cFF0066ccBuffs", 0, 1)
    player:GossipMenuAddItem(0, "|cFF0066ccHeal me", 0, 2)
    player:GossipMenuAddItem(0, "|cFF0066ccRemove Cooldown", 0, 3)
    player:GossipMenuAddItem(0, "|cFF0066ccNevermind", 0, 999)
    player:GossipSendMenu(1, creature)
function morph_select(event, player, creature, sender, intid)
    if (intid == 1) then -- Buffs
        player:AddAura(25898, player)
        player:AddAura(48469, player)
        player:AddAura(42995, player)
        player:AddAura(48169, player)
        player:AddAura(48073, player)
        player:AddAura(48161, player)
        player:AddAura(26035, player)
    if (intid == 2) then -- Heal
        player:SetPower(0, player:GetMaxPower(0))
    if (intid == 3) then -- CD
    if (intid == 999) then -- Nevermind
RegisterCreatureGossipEvent(npcid, 1, morph_gossip)
RegisterCreatureGossipEvent(npcid, 2, morph_select)

Share this post

Link to post
Share on other sites

The function morph_gossip is executed when a player clicks the NPC to talk to him.
At the top of this function you can check if the player is not a GM (player:GetGMRank() == 0) and if the condition is true you would print an error message and return. Returning would stop running the function, so the code never reaches adding or sending the gossip menu.

You could print the error message to the player through http://www.elunaengine.com/Player/SendNotification.html which displays a red message in the middle of the screen.

If you need help with the lua language then check this out: http://lua-users.org/wiki/ControlStructureTutorial
And for more guides see http://lua-users.org/wiki/TutorialDirectory

  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Contact Us

To contact us click here
You can also email us at [email protected]

Privacy Policy | Terms & Conditions


The Link to the master list
of MaNGOS repositories:
Copyright © getMaNGOS. All rights Reserved.

This website is in no way associated with or endorsed by Blizzard Entertainment®
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use