[Lua] Vote Reward NPC. menu

User Tag List

Results 1 to 12 of 12
  1. #1
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,504
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua] Vote Reward NPC.

    This is a simple Lua Reward NPC that rewards spells.


    Updated! V2.

    Features;
    6 Reward Slots
    2 GM Options (Disable/Enable)

    -- Checks if the player has the vote Token.
    -- Checks if the player has the reward.
    -- Checks if the player is a GM.
    -- Checks if the script is Disabled/Enabled.
    -- Tells the player if its on/off.

    http://pastebin.com/f6169c7f3
    Code:
    --[ Vote Reward NPC for Spells by Ground Zero ]--
    --[ Do not claim as your own, if you wish to re-release this then ask my permission ]--
    
    print ("Vote Reward NPC Loaded!")
    
    local enabled = 1 -- 0 = Disabled 1 = Enabled
    local voteid = 80000 -- Change to your Vote Token/Reward ID.
    local servername = "Server name" -- Server name
    local npcid = 80000 -- Vote NPC Spawn ID.
    local rewid1 = 9999 -- Change to your Spell Reward ID's (Recommended Spell Display Visuals only)
    local rewid2 = 9999
    local rewid3 = 9999
    local rewid4 = 9999
    local rewid5 = 9999
    local rewid6 = 9999
    local status = "Enabled"
    
    function votenpc_onGossip(unit, event, player)
        unit:GossipCreateMenu(3912, player, 0)
        if (player:IsGm() == true) then
        unit:GossipMenuAddItem(9, "Currently: "..status.."", 306, 0)
        unit:GossipMenuAddItem(9, "Disable this Unit(GM)", 307, 0)
        unit:GossipMenuAddItem(9, "Activate this Unit(GM)", 308, 0)
        unit:GossipMenuAddItem(6, "Reward 1", 300, 0)
        unit:GossipMenuAddItem(6, "Reward 2", 301, 0)
        unit:GossipMenuAddItem(6, "Reward 3", 302, 0)
        unit:GossipMenuAddItem(6, "Reward 4", 303, 0)
        unit:GossipMenuAddItem(6, "Reward 5", 304, 0)
        unit:GossipMenuAddItem(6, "Reward 6", 305, 0)
        unit:GossipMenuAddItem(2, "Nevermind", 306, 0)
        unit:GossipSendMenu(player)
        else
        unit:GossipMenuAddItem(9, "Status: "..status.."", 306, 0)
        unit:GossipMenuAddItem(6, "Reward 1", 300, 0)
        unit:GossipMenuAddItem(6, "Reward 2", 301, 0)
        unit:GossipMenuAddItem(6, "Reward 3", 302, 0)
        unit:GossipMenuAddItem(6, "Reward 4", 303, 0)
        unit:GossipMenuAddItem(6, "Reward 5", 304, 0)
        unit:GossipMenuAddItem(6, "Reward 6", 305, 0)
        unit:GossipMenuAddItem(2, "Nevermind", 306, 0)
        unit:GossipSendMenu(player)
        end
    end
    
    function votenpc_onSelect(pUnit, event, player, id, intid, code)
    
        if enabled == 1 then
        if(intid == 300) then
            if player:HasItem(voteid, 1) then
                if (player:HasSpell(rewid1) == false) then
                player:LearnSpell(rewid1)
                player:SendBroadcastMessage("Thank you for voting for "..servername.." and have a nice day!")
                player:GossipComplete()
                player:RemoveItem(voteid, 1)
                else
                player:SendAreaTriggerMessage("You already have this reward!")
                player:GossipComplete()
                end
            else 
            player:SendAreaTriggerMessage("You don't have enough tokens!")
            end
        end
        
        if(intid == 301) then
            if player:HasItem(voteid, 1) then
                if (player:HasSpell(rewid2) == false) then
                player:LearnSpell(rewid2)
                player:SendBroadcastMessage("Thank you for voting for "..servername.." and have a nice day!")
                player:GossipComplete()
                player:RemoveItem(voteid, 1)
                else
                player:SendAreaTriggerMessage("You already have this reward!")
                player:GossipComplete()
                end
            else 
            player:SendAreaTriggerMessage("You don't have enough tokens!")
            end
        end
        
        if(intid == 302) then
            if player:HasItem(voteid, 1) then
                if (player:HasSpell(rewid3) == false) then
                player:LearnSpell(rewid3)
                player:SendBroadcastMessage("Thank you for voting for "..servername.." and have a nice day!")
                player:GossipComplete()
                player:RemoveItem(voteid, 1)
                else
                player:SendAreaTriggerMessage("You already have this reward!")
                player:GossipComplete()
                end
            else 
            player:SendAreaTriggerMessage("You don't have enough tokens!")
            end
        end
        
        if(intid == 303) then
            if player:HasItem(voteid, 1) then
                if (player:HasSpell(rewid4) == false) then
                player:LearnSpell(rewid4)
                player:SendBroadcastMessage("Thank you for voting for "..servername.." and have a nice day!")
                player:GossipComplete()
                player:RemoveItem(voteid, 1)
                else
                player:SendAreaTriggerMessage("You already have this reward!")
                player:GossipComplete()
                end
                else
                player:SendAreaTriggerMessage("You don't have enough tokens!")
            end
        end
        
        if(intid == 304) then
            if player:HasItem(voteid, 1) then
                if (player:HasSpell(rewid5) == false) then
                player:LearnSpell(rewid5)
                player:SendBroadcastMessage("Thank you for voting for "..servername.." and have a nice day!")
                player:GossipComplete()
                player:RemoveItem(voteid, 1)
                else
                player:SendAreaTriggerMessage("You already have this reward!")
                player:GossipComplete()
                end
                else
                player:SendAreaTriggerMessage("You don't have enough tokens!")
            end
        end
        
        if(intid == 305) then
            if player:HasItem(voteid, 1) then
                if (player:HasSpell(rewid6) == false) then
                player:LearnSpell(rewid6)
                player:SendBroadcastMessage("Thank you for voting for "..servername.." and have a nice day!")
                player:GossipComplete()
                player:RemoveItem(voteid, 1)
                else
                player:SendAreaTriggerMessage("You already have this reward!")
                player:GossipComplete()
                end
                else
                player:SendAreaTriggerMessage("You don't have enough tokens!")
            end
        end
        
        if(intid == 306) then
            player:GossipComplete()
        end
        else 
        if (player:IsGm() == true) then
        player:GossipComplete()
        else
        player:SendBroadcastMessage("Sorry, this feature is currently disabled by a Member of Staff.")
        end
        end
        
        if(intid == 307) then
            if(player:IsGm() == true) then
                if enabled == 0 then
                player:SendBroadcastMessage("This unit is already disabled!")
                player:GossipComplete()
                else
                enabled = 0
                player:SendBroadcastMessage("Unit Successfully Deactivated!")
                player:GossipComplete()
                status = "Disabled"
                end
            else
            player:SendBroadcastMessage("You need to be a GM to use this Feature!")
            end
        end
        
        if(intid == 308) then
            if(player:IsGm() == true) then
                if enabled == 1 then
                player:SendBroadcastMessage("This unit is already activated!")
                player:GossipComplete()
                else
                enabled = 1
                player:SendBroadcastMessage("Unit Successfully Activated!")
                status = "Enabled"
                player:GossipComplete()
                end
            else
            player:SendBroadcastMessage("You need to be a GM to use this Feature!")
            end
        end    
    end    
    
    RegisterUnitGossipEvent(npcid, 1, "votenpc_onGossip")
    RegisterUnitGossipEvent(npcid, 2, "votenpc_onSelect")

    Enjoy.
    Last edited by Ground Zero; 12-26-2009 at 02:28 PM.

    [Lua] Vote Reward NPC.
  2. #2
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Creative creative work GZ. Maybe change the showing option on disabling it depending on being a GM.

    Just a tip . +Rep.

  3. #3
    Nikentic's Avatar Elite User
    Reputation
    453
    Join Date
    Oct 2007
    Posts
    1,556
    Thanks G/R
    10/4
    Trade Feedback
    6 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    GZ, best as usual! +4 if possible

  4. #4
    Xel's Avatar ★ Elder ★
    Authenticator enabled
    Reputation
    1179
    Join Date
    Jul 2008
    Posts
    2,906
    Thanks G/R
    94/51
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks awesome! Thanks GZ

  5. #5
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice work!
    Why do I need a signature?

  6. #6
    zade749's Avatar Member
    Reputation
    20
    Join Date
    Sep 2009
    Posts
    26
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see a lot of little errors, Ill post the fixes when I finish the edits

  7. #7
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,504
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by zade749 View Post
    I see a lot of little errors, Ill post the fixes when I finish the edits
    Works perfectly for me...

  8. #8
    blubb12345's Avatar Contributor
    Reputation
    121
    Join Date
    Feb 2007
    Posts
    193
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good job mate
    $50 SUBWAY CARD GIVEAWAY >> https://bit.ly/aMbaU5 << LIMITED TIME OFFER

  9. #9
    Found's Avatar Banned
    Reputation
    239
    Join Date
    Mar 2009
    Posts
    642
    Thanks G/R
    1/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ty Gz this is tight ( like.. nvm) and i will be using it. +rep if possible xD

  10. #10
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,504
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Updated the Script.

    None GM's can now see if its Enabled or Disabled.
    GM's can now only see GM options and can view if its currently disabled or Enabled.

  11. #11
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    Critiscm is listened too on MMOwned.

    Couldn't rep earlier, but a sexy script none the less still :P

  12. #12
    sasoritail's Avatar Contributor
    Reputation
    161
    Join Date
    Sep 2008
    Posts
    655
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hot script
    +Rep x2
    It's been a while

Similar Threads

  1. [Release] Voting Reward Script
    By TheSpidey in forum WoW EMU General Releases
    Replies: 178
    Last Post: 03-26-2009, 05:25 PM
  2. Voting Rewards
    By mafiaboy in forum Programming
    Replies: 21
    Last Post: 06-30-2008, 03:22 AM
  3. [Lua Question] Flying npc
    By bill45 in forum World of Warcraft Emulator Servers
    Replies: 15
    Last Post: 06-03-2008, 06:35 PM
  4. Voting Rewards
    By EmuGod in forum World of Warcraft Emulator Servers
    Replies: 28
    Last Post: 05-07-2008, 09:16 AM
  5. release (vote reward vendor)
    By pooooo132 in forum World of Warcraft Emulator Servers
    Replies: 8
    Last Post: 03-23-2008, 10:23 AM
All times are GMT -5. The time now is 06:47 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search