[Release] Advanced CodeBoxNPC (Add Codes Ingame!) menu

User Tag List

Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 54
  1. #16
    kaato's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If anyone could do this in c++ it would be awesome!
    https://nordicwow.servegame.com/ +Rep

    [Release] Advanced CodeBoxNPC (Add Codes Ingame!)
  2. #17
    Herleybob's Avatar Contributor
    Reputation
    178
    Join Date
    Jul 2007
    Posts
    663
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im thinking about it.

    Nom Nom Nom :P

  3. #18
    Hellgawd's Avatar Account not activated by Email
    Reputation
    710
    Join Date
    Jun 2007
    Posts
    2,480
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Absolutelyfreakingfantastic.
    I thought Stoneharry's was epic, but this is 3x as epic!
    I can't really express how good this is! +5Rep

    Edit: Need to spread
    Last edited by Hellgawd; 04-21-2009 at 09:47 PM.

  4. #19
    onesbronson's Avatar Member
    Reputation
    7
    Join Date
    Aug 2007
    Posts
    142
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    almost had a heart attack

  5. #20
    XxCyanidexX's Avatar Member
    Reputation
    56
    Join Date
    Nov 2008
    Posts
    138
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kaato View Post
    If anyone could do this in c++ it would be awesome!
    Almost done.

  6. #21
    Fireblast's Avatar Contributor
    Reputation
    195
    Join Date
    Aug 2008
    Posts
    883
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i see a great future on this, keep it up bro.

  7. #22
    Megosh's Avatar Member
    Reputation
    1
    Join Date
    Mar 2008
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Hellgawd View Post
    Absolutelyfreakingfantastic.
    I thought Stoneharry's was epic, but this is 3x as epic!
    I can't really express how good this is! +5Rep

    Edit: Need to spread
    ^ What he said...

  8. #23
    locbones's Avatar Member
    Reputation
    1
    Join Date
    Jun 2008
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well most of the script works for me. The item and NPC spawn correctly and all of the menus seem to be working fine, but after i create a key for a player, and i attempt to use that key to test it out, it says the key has already been used. yet if i go to the "Lookup" option on the GM key creator, it shows the key code as being unused and available for use. Is this because i am creating the key for myself on a GM account, or do I simply have some configuration or something of the sort messed up, any help would be greatly appreciated, as this is an amazing script with lots of potential. Thank you for your time.

    EDIT: It seems that it just didn't like me using the key for the character that created the key in the first place, I created a key for a character on the same account and it worked fine. Which is perfectly fine, it was just to test it anyways, but just thought I would let you know.
    Last edited by locbones; 04-22-2009 at 12:09 PM.

  9. #24
    Claiver's Avatar Member
    Reputation
    138
    Join Date
    Mar 2009
    Posts
    217
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey everyone! I got back today from a schooltrip ('t was awesome xD) and I want to thank you all for your feedback, and will continue to enhance this script.

    Locbones, I'll get back to you shortly ;D.

    xx.Claiver

  10. #25
    Claiver's Avatar Member
    Reputation
    138
    Join Date
    Mar 2009
    Posts
    217
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by brue View Post
    If I use the item I get the -GM LAUNCHER INITIATED- but no window, here I got 2 screenies:



    1 is of my world and the other of WoW itselve, does anyone know how to fix and does anyone else got this to?
    Fixed this in version 1.5! Please download this new version at the main post (fixed the 'script' error.) or copy Version 1.5 from below:

    Code:
    local VERSION = "1.5"
    --[[====================================--
    --			  Rewardance NPC			--
    --	 	[ Fully Made by Claiver ]		--
    --	  REPORT FEEDBACK AT MMOWNED.COM	--
    --======================================--
    
    ================================================================================================
    =========== ( General Settings ) ===============================================================
    ================================================================================================
    ====]]local NPC_ID = 107107107 --[[-> This is the ID of the NPC whom contains the script. (Set Gossip Flags!)
    ====]]local ITEM_ID = 20770 --[[-> The Item EntryID of the GM Event Tool
    ====]]local DataFile = "scripts/EventData_AccessCodes.txt" --[[-> File the data is saved in. Be sure to have the file set-up before use.
    
    ================================================================================================
    =========== ( Define the Rewards ) =============================================================
    ================================================================================================
    -- 		   RewardName , EnterCode , ItemID1, ItemCount1, ItemID2, ItemCount2, ... 			  --
    -- 	You can set the Global Password(usable by everyone!) , and add as many items as you want, --
    --	as long as you have ItemID and ItemCount present!										  --
    ==============================================================================================]]
    local Rewards = 
    {
    	{"Spectral Tiger", "PREMIUM-23", 11846, 5, 101001, 1, 14156, 1},
    	{"Bag", "KGI-23542-Z", 14156, 1, 11846, 1},
    	{"Candy", "DFIER356", 11846, 2},
    	{"Weapon", "G83JF-3JH", 11846, 5},
    	{"Token", "G92JD03D", 11846, 5},
    	{"Jukebox", "39FJK20F", 11846, 5},
    }
    
    
    
    
    
    -- ********************* END OF CONFIG | DO NOT EDIT BELOW THESE LINES	*************************************  --
    
    
    
    
    
    
    
    
    
    
    function RewardNPC_OnGossipTalk(pUnit, event, Player, pMisc)
    	local i = 0
    		if (Player:IsInCombat() == true) then
    			Player:SendAreaTriggerMessage("You are in combat! Please first leave combat!")
    			Player:SendBroadcastMessage("You are in combat! Please first leave combat!")
    			Player:GossipComplete()
    		else
    			pUnit:GossipCreateMenu(107107107, Player, 0)
    			for k,v in pairs(Rewards) do
    				i = i + 1
    				pUnit:GossipMenuAddItem(30, "I would like a "..v[1], i, 1)
    			end
    		pUnit:GossipSendMenu(Player)
    	end
    end
    
    function RewardNPC_OnGossipSelect(pUnit, event, Player, id, intid, Code, pMisc)
    	local i = 0
    	for k,v in pairs(Rewards) do
    		i = i + 1
    		if (intid == i) then
    				Check_Key(Player, Code)
    				if (KEY == "TRUE") or (Code == v[2]) then
    					Player:SendBroadcastMessage("Congratulations, you've entered a valid Code!")
    						for i = 4,#v,2 do
    							if (v[i] ~= nil) then
    								Player:AddItem(v[i-1],v[i])
    							end
    						end
    					Player:GossipComplete()
    					Set_CurrentKey(Player, Code, "False")
    				else
    					Check_Key(Player, Code)
    					if (KEY == "FALSE") then
    						Player:SendBroadcastMessage("[ERROR] Code: \'"..Code.."\' has already been used!")	
    					else
    						Player:SendBroadcastMessage("[ERROR] Code: \'"..Code.."\' is invalid!")	
    					end
    					Player:GossipComplete()
    				end
    		end
    		KEY = "FALSE"
    	end
    end
    RegisterUnitGossipEvent(NPC_ID, 1, "RewardNPC_OnGossipTalk")
    RegisterUnitGossipEvent(NPC_ID, 2, "RewardNPC_OnGossipSelect")
    
    --[[============================================================================================
    =========== ( General Configuration ) ==========================================================
    ==============================================================================================]]
    function GMEvent_OnUse(Item, event, Player)	
        GMEvent_Menu(Item, event, Player)
    end
    function GMEvent_Menu(Item, event, Player)
    		Player:SendAreaTriggerMessage("- GM LAUNCHER INITIATED -") 
    		Item:GossipCreateMenu(7773, Player, 0) 
    		Item:GossipMenuAddItem(10, "< LAUNCH >", 900, 0)
    		Item:GossipSendMenu(Player)
    end
    
    function GMEvent_OnSelect(Item, event, Player, id, intid, Code)
    	if(intid == 900) then
    		print (" ["..Player:GetName().."] has launched the GM_Event Tool.")
    		Item:GossipCreateMenu(3543, Player, 0)
    		Item:GossipMenuAddItem(10, "Event: Launch Event Manager", 9754, 0)
    		Item:GossipMenuAddItem(10, " - Shut Down - ", 24340, 0)
    		Item:GossipSendMenu(Player)
    	end
    	if (intid == 24340) then
    		Player:SendAreaTriggerMessage("")
    		Player:GossipComplete()
    	end
    	if (intid == 9754) then
    		Item:GossipCreateMenu(3543, Player, 0)	
    			Item:GossipMenuAddItem(10, "[Create] New Player Access-Key", 4389485, 0)
    			Item:GossipMenuAddItem(10, "[Lookup] Existing Player Access-Key", 2389485, 0)
    			Item:GossipMenuAddItem(10, "[Disable] Existing Player Access-Key", 2389486, 0)
    			Item:GossipMenuAddItem(10, "[Modify] Existing Player Access-Key", 2389487, 0)
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)
    		Item:GossipSendMenu(Player)
    	end
    	--| MODIFY PLAYERKEY
    	if (intid == 2389487) then
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "[+] Change Owner of Key.", 204005, 0)			
    			Item:GossipMenuAddItem(10, "[+] Change Key of Player.", 204001, 0)	
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)			
    		Item:GossipSendMenu(Player)	
    	end		
    	if (intid == 204001) then
    		Player:SendBroadcastMessage("Please enter Player's name.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Enter PlayerName", 204002, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204005) then
    		Player:SendBroadcastMessage("Please enter the Key you wish the owner of.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Enter Key", 204006, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204006) then
    		Key = Code
    		Player:SendBroadcastMessage("Please enter current owner.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Current Owner", 204007, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204007) then
    		CurrentOwner = Code
    		Player:SendBroadcastMessage("Please enter the new owner.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "New Owner", 204008, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204008) then
    		NewOwner = Code
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[1] == CurrentOwner) and (v[2] == Key) then
    				v[1] = NewOwner
    			end
    		end
    		Save_File(Current_Table, DataFile)
    		Player:SendBroadcastMessage("[SUCCESS] Changed the new owner of Code '"..Key.."' to '"..NewOwner.."'")
    		Player:GossipComplete()
    	end		
    	if (intid == 204002) then
    		PlayerName = Code
    		Player:SendBroadcastMessage("Please enter current Access-Key.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Current Key", 204003, 1)			
    		Item:GossipSendMenu(Player)	
    	end		
    	if (intid == 204003) then
    		CurrentKey = Code
    		Player:SendBroadcastMessage("Please enter a new Access-Key.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "New Key", 204004, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204004) then
    		NewKey = Code
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[1] == PlayerName) and (v[2] == CurrentKey) then
    				v[2] = NewKey
    			end
    		end
    		Save_File(Current_Table, DataFile)
    		Player:SendBroadcastMessage("[SUCCESS] Changed "..PlayerName.."'s Code: '"..CurrentKey.."' to '"..NewKey.."'")
    		Player:GossipComplete()
    	end	
    	--| REMOVE PLAYERKEY
    	if (intid == 2389486) then
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "[+] Disable Access-Key by Name.", 203001, 0)			
    			Item:GossipMenuAddItem(10, "[+] Disable Access-Key by Key.", 203002, 0)	
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)			
    		Item:GossipSendMenu(Player)	
    	end		
    	if (intid == 203001) then
    		Player:SendBroadcastMessage("Please enter Player's name.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Enter PlayerName", 203003, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 203003) then
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[1] == Code) then
    				v[3] = "False"
    			end
    		end
    		Save_File(Current_Table, DataFile)
    		Player:SendBroadcastMessage("[SUCCESS] All Keys for '"..Code.."' are disabled!")
    		Player:GossipComplete()
    	end	
    	if (intid == 203002) then
    		Player:SendBroadcastMessage("Please enter Access-Key.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Enter AccessKey", 203004, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 203004) then
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[2] == Code) then
    				v[3] = "False"
    			end
    		end
    		Save_File(Current_Table, DataFile)
    		Player:SendBroadcastMessage("[SUCCESS] All entries with code '"..Code.."' are disabled!")
    		Player:GossipComplete()
    	end	
    
    	
    	--| LOOKUP PLAYER
    	if (intid == 2389485) then
    		Player:SendBroadcastMessage("[1] Please enter name of Player you wish to look up.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "1) Please enter name of Player you wish to look up", 202001, 1)			
    		Item:GossipSendMenu(Player)	
    	end		
    	if (intid == 202001) then
    		Player:SendBroadcastMessage("=== Access-Keys for Player '"..Code.."' ===")
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[1] == string.format("%s", Code)) then
    				Player:SendBroadcastMessage("o "..v[1].." - Key: ["..v[2].."], Usable: "..v[3].."")
    			end
    		end
    		Player:SendBroadcastMessage("")
    		Player:GossipComplete()
    	end
    	--| ADD PLAYER-KEY
    	if (intid == 4389485) then
    		Player:SendBroadcastMessage("[1] Please enter Player's name.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "1) Add PlayerName", 201001, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 201001) then
    		z1_Name = Code
    		Player:SendBroadcastMessage("[2] You have entered Player: "..z1_Name)
    		Player:SendBroadcastMessage("[3] Please enter the Key-Code.")
    		Item:GossipCreateMenu(3543, Player, 0)	
    			Item:GossipMenuAddItem(10, "2) Add Access-Key", 201002, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 201002) then	
    		z2_Key = Code
    		Code_Data = {z1_Name, z2_Key, "True"}
    		Item:GossipCreateMenu(3543, Player, 0)
    			Player:SendBroadcastMessage("[4] You have entered Code: "..z2_Key)
    			Player:SendBroadcastMessage("Please press 'Import Data' to finish.")
    			Item:GossipMenuAddItem(10, "3) Import Data", 201003, 0)
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 201003) then
    		Add_NewKey(Code_Data)
    		Item:GossipCreateMenu(3543, Player, 0)	
    			Player:SendBroadcastMessage("[5] Player \""..z1_Name.."\" may now use key: \""..z2_Key.."\"")
    			Item:GossipMenuAddItem(10, "-> Add Another Key", 4389485, 0)
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)
    		Item:GossipSendMenu(Player)	
    	end
    end
    
    RegisterItemGossipEvent(ITEM_ID,1,"GMEvent_OnUse")
    RegisterItemGossipEvent(ITEM_ID,2,"GMEvent_OnSelect")
    
    --================================================================================================================--
    --=== GLOBAL FUNCTIONS  ==========================================================================================--
    --================================================================================================================--
    function Serialize_Table(tab)
      local ser = {} -- Serialize Table
      function ser.number (n)return tostring(n)end                        -- Serializes numbers
      function ser.string (str)return ("%q"):format(str)end               -- strings
      function ser.boolean (b) return tostring(b) end                     -- booleans
      function ser.thread (t)error "Threads are unsupported" end          -- unsupported
      ser["function"] = function (f) error "Functions are unsupported"end -- unsupported
      ser["nil"] = function(n) return "nil" end                           -- nils
      function ser.userdata(u) error "Userdatas are unsupported" end      -- unsupported
      local indent = 0
      local indc = "  "
      local knowntabs = {}
      function ser.table (tab)
        if knowntabs[tab] then error("Cyclic table not allowed") end
        knowntabs[tab] = true
        local out = {"{\n"}--{"{\n"}
        indent = indent + 1
        local ind = indc:rep(indent)
        local keys = {}
        for i,v in pairs(tab) do
          keys[#keys+1] = i -- ...
        end
        table.sort(keys,function(a,b)
          if type(a)=="number" and type(b)=="number" then return a<b end
          if type(a)=="number" then return true end
          if type(b)=="number" then return false end
          return tostring(a)<tostring(b)
        end)
        local n = 0
        for i,v in ipairs(keys) do
          local i,v = v,tab[v]
          local key,value = ser[type(i)](i),ser[type(v)](v)
          if n then
             n = n + 1
             if n == i then 
               out[#out+1] = ind..value..","--\n"
             else
               n = nil 
              out[#out+1] = ind.."["..key.."] = "..value..", \n"
            end
          else
            out[#out+1] = ind.."["..key.."] = "..value..", \n"
          end
        end
        indent = indent - 1
        out[#out+1] = indc:rep(indent).."}"
        return table.concat(out)
    	end
     
    	return "return "..ser.table(tab)
    end 
    
    function Check_Key(_Player, _Code)
    	Current_Table = Load_File(DataFile)
    	for k,v in pairs(Current_Table) do
    		if 	(v[1] == _Player:GetName()) and (v[2] == _Code) then
    			if (v[3] == "False") then KEY="FALSE" return KEY end
    			if (v[3] == "True") then KEY="TRUE" return KEY end
    			if (v[3] == nil) then KEY="NONE" return KEY end
    		end
    	end
    end
    
    function Set_CurrentKey(_Player, _Code, _Status)
    	Current_Table = Load_File(DataFile)
    	for k,v in pairs(Current_Table) do
    	if (v[1] == _Player:GetName()) and (v[2] == _Code) then
    		v[3] = _Status
    		end
    	end
    	Save_File(Current_Table, DataFile)
    end
    
    function Add_NewKey(_Data)
    	Current_Table = Load_File(DataFile)
    	table.insert(Current_Table, _Data)
    	Save_File(Current_Table, DataFile)	
    end
    
    function Save_File(tab, file)
    	local str = Serialize_Table(tab)
    	local fp = assert(io.open(file,"w"))
    	fp:write(str)
    	fp:close()
    end
    
    function Load_File(file)
      return dofile(file)
    end
    
    print ("\n ====================================================")
    print ("  Loaded: \"Redeemer NPC\" (V"..VERSION..") by Claiver. ")
    print ("  	NPC: 		"..NPC_ID.."")
    print ("  	GM-EVENTTOOL:	"..ITEM_ID.." \n")
    print ("  Make sure that the following file is existing: \n  '"..DataFile.."'")
    print (" ====================================================\n")

  11. #26
    Scubast3ve's Avatar Member
    Reputation
    55
    Join Date
    Apr 2009
    Posts
    125
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i almost thought it was going to be a flop, like nice code but i though u were aiming for a global table to store it all i was like :'( then i see oh wait he has an output file very nice ive seen very few people use an output file like that +rep

    Btw what is the input command to bring up that input box?

    Item:GossipMenuAddItem(10, "1) Add PlayerName", 201001, 1) i see a difference in structure but nothing to suggest that a box would appear could you supply detail on how this works?

    Edit: Ohhh soz fail on my part by calling variable "code" it calls a box... why did i not look -.- gj
    Last edited by Scubast3ve; 04-24-2009 at 05:21 AM.

  12. #27
    Claiver's Avatar Member
    Reputation
    138
    Join Date
    Mar 2009
    Posts
    217
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Scubast3ve View Post
    i almost thought it was going to be a flop, like nice code but i though u were aiming for a global table to store it all i was like :'( then i see oh wait he has an output file very nice ive seen very few people use an output file like that +rep

    Btw what is the input command to bring up that input box?

    Item:GossipMenuAddItem(10, "1) Add PlayerName", 201001, 1) i see a difference in structure but nothing to suggest that a box would appear could you supply detail on how this works?

    Edit: Ohhh soz fail on my part by calling variable "code" it calls a box... why did i not look -.- gj
    Yes the Code is defined in the function. (Code), and with the variable Code you can load the input data :-).

    xx.Claiver

  13. #28
    brue's Avatar Member
    Reputation
    1
    Join Date
    Jul 2008
    Posts
    33
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Claiver View Post
    Fixed this in version 1.5! Please download this new version at the main post (fixed the 'script' error.) or copy Version 1.5 from below:

    Code:
    local VERSION = "1.5"
    --[[====================================--
    --			  Rewardance NPC			--
    --	 	[ Fully Made by Claiver ]		--
    --	  REPORT FEEDBACK AT MMOWNED.COM	--
    --======================================--
    
    ================================================================================================
    =========== ( General Settings ) ===============================================================
    ================================================================================================
    ====]]local NPC_ID = 107107107 --[[-> This is the ID of the NPC whom contains the script. (Set Gossip Flags!)
    ====]]local ITEM_ID = 20770 --[[-> The Item EntryID of the GM Event Tool
    ====]]local DataFile = "scripts/EventData_AccessCodes.txt" --[[-> File the data is saved in. Be sure to have the file set-up before use.
    
    ================================================================================================
    =========== ( Define the Rewards ) =============================================================
    ================================================================================================
    -- 		   RewardName , EnterCode , ItemID1, ItemCount1, ItemID2, ItemCount2, ... 			  --
    -- 	You can set the Global Password(usable by everyone!) , and add as many items as you want, --
    --	as long as you have ItemID and ItemCount present!										  --
    ==============================================================================================]]
    local Rewards = 
    {
    	{"Spectral Tiger", "PREMIUM-23", 11846, 5, 101001, 1, 14156, 1},
    	{"Bag", "KGI-23542-Z", 14156, 1, 11846, 1},
    	{"Candy", "DFIER356", 11846, 2},
    	{"Weapon", "G83JF-3JH", 11846, 5},
    	{"Token", "G92JD03D", 11846, 5},
    	{"Jukebox", "39FJK20F", 11846, 5},
    }
    
    
    
    
    
    -- ********************* END OF CONFIG | DO NOT EDIT BELOW THESE LINES	*************************************  --
    
    
    
    
    
    
    
    
    
    
    function RewardNPC_OnGossipTalk(pUnit, event, Player, pMisc)
    	local i = 0
    		if (Player:IsInCombat() == true) then
    			Player:SendAreaTriggerMessage("You are in combat! Please first leave combat!")
    			Player:SendBroadcastMessage("You are in combat! Please first leave combat!")
    			Player:GossipComplete()
    		else
    			pUnit:GossipCreateMenu(107107107, Player, 0)
    			for k,v in pairs(Rewards) do
    				i = i + 1
    				pUnit:GossipMenuAddItem(30, "I would like a "..v[1], i, 1)
    			end
    		pUnit:GossipSendMenu(Player)
    	end
    end
    
    function RewardNPC_OnGossipSelect(pUnit, event, Player, id, intid, Code, pMisc)
    	local i = 0
    	for k,v in pairs(Rewards) do
    		i = i + 1
    		if (intid == i) then
    				Check_Key(Player, Code)
    				if (KEY == "TRUE") or (Code == v[2]) then
    					Player:SendBroadcastMessage("Congratulations, you've entered a valid Code!")
    						for i = 4,#v,2 do
    							if (v[i] ~= nil) then
    								Player:AddItem(v[i-1],v[i])
    							end
    						end
    					Player:GossipComplete()
    					Set_CurrentKey(Player, Code, "False")
    				else
    					Check_Key(Player, Code)
    					if (KEY == "FALSE") then
    						Player:SendBroadcastMessage("[ERROR] Code: \'"..Code.."\' has already been used!")	
    					else
    						Player:SendBroadcastMessage("[ERROR] Code: \'"..Code.."\' is invalid!")	
    					end
    					Player:GossipComplete()
    				end
    		end
    		KEY = "FALSE"
    	end
    end
    RegisterUnitGossipEvent(NPC_ID, 1, "RewardNPC_OnGossipTalk")
    RegisterUnitGossipEvent(NPC_ID, 2, "RewardNPC_OnGossipSelect")
    
    --[[============================================================================================
    =========== ( General Configuration ) ==========================================================
    ==============================================================================================]]
    function GMEvent_OnUse(Item, event, Player)	
        GMEvent_Menu(Item, event, Player)
    end
    function GMEvent_Menu(Item, event, Player)
    		Player:SendAreaTriggerMessage("- GM LAUNCHER INITIATED -") 
    		Item:GossipCreateMenu(7773, Player, 0) 
    		Item:GossipMenuAddItem(10, "< LAUNCH >", 900, 0)
    		Item:GossipSendMenu(Player)
    end
    
    function GMEvent_OnSelect(Item, event, Player, id, intid, Code)
    	if(intid == 900) then
    		print (" ["..Player:GetName().."] has launched the GM_Event Tool.")
    		Item:GossipCreateMenu(3543, Player, 0)
    		Item:GossipMenuAddItem(10, "Event: Launch Event Manager", 9754, 0)
    		Item:GossipMenuAddItem(10, " - Shut Down - ", 24340, 0)
    		Item:GossipSendMenu(Player)
    	end
    	if (intid == 24340) then
    		Player:SendAreaTriggerMessage("")
    		Player:GossipComplete()
    	end
    	if (intid == 9754) then
    		Item:GossipCreateMenu(3543, Player, 0)	
    			Item:GossipMenuAddItem(10, "[Create] New Player Access-Key", 4389485, 0)
    			Item:GossipMenuAddItem(10, "[Lookup] Existing Player Access-Key", 2389485, 0)
    			Item:GossipMenuAddItem(10, "[Disable] Existing Player Access-Key", 2389486, 0)
    			Item:GossipMenuAddItem(10, "[Modify] Existing Player Access-Key", 2389487, 0)
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)
    		Item:GossipSendMenu(Player)
    	end
    	--| MODIFY PLAYERKEY
    	if (intid == 2389487) then
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "[+] Change Owner of Key.", 204005, 0)			
    			Item:GossipMenuAddItem(10, "[+] Change Key of Player.", 204001, 0)	
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)			
    		Item:GossipSendMenu(Player)	
    	end		
    	if (intid == 204001) then
    		Player:SendBroadcastMessage("Please enter Player's name.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Enter PlayerName", 204002, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204005) then
    		Player:SendBroadcastMessage("Please enter the Key you wish the owner of.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Enter Key", 204006, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204006) then
    		Key = Code
    		Player:SendBroadcastMessage("Please enter current owner.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Current Owner", 204007, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204007) then
    		CurrentOwner = Code
    		Player:SendBroadcastMessage("Please enter the new owner.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "New Owner", 204008, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204008) then
    		NewOwner = Code
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[1] == CurrentOwner) and (v[2] == Key) then
    				v[1] = NewOwner
    			end
    		end
    		Save_File(Current_Table, DataFile)
    		Player:SendBroadcastMessage("[SUCCESS] Changed the new owner of Code '"..Key.."' to '"..NewOwner.."'")
    		Player:GossipComplete()
    	end		
    	if (intid == 204002) then
    		PlayerName = Code
    		Player:SendBroadcastMessage("Please enter current Access-Key.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Current Key", 204003, 1)			
    		Item:GossipSendMenu(Player)	
    	end		
    	if (intid == 204003) then
    		CurrentKey = Code
    		Player:SendBroadcastMessage("Please enter a new Access-Key.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "New Key", 204004, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 204004) then
    		NewKey = Code
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[1] == PlayerName) and (v[2] == CurrentKey) then
    				v[2] = NewKey
    			end
    		end
    		Save_File(Current_Table, DataFile)
    		Player:SendBroadcastMessage("[SUCCESS] Changed "..PlayerName.."'s Code: '"..CurrentKey.."' to '"..NewKey.."'")
    		Player:GossipComplete()
    	end	
    	--| REMOVE PLAYERKEY
    	if (intid == 2389486) then
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "[+] Disable Access-Key by Name.", 203001, 0)			
    			Item:GossipMenuAddItem(10, "[+] Disable Access-Key by Key.", 203002, 0)	
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)			
    		Item:GossipSendMenu(Player)	
    	end		
    	if (intid == 203001) then
    		Player:SendBroadcastMessage("Please enter Player's name.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Enter PlayerName", 203003, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 203003) then
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[1] == Code) then
    				v[3] = "False"
    			end
    		end
    		Save_File(Current_Table, DataFile)
    		Player:SendBroadcastMessage("[SUCCESS] All Keys for '"..Code.."' are disabled!")
    		Player:GossipComplete()
    	end	
    	if (intid == 203002) then
    		Player:SendBroadcastMessage("Please enter Access-Key.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "Enter AccessKey", 203004, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 203004) then
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[2] == Code) then
    				v[3] = "False"
    			end
    		end
    		Save_File(Current_Table, DataFile)
    		Player:SendBroadcastMessage("[SUCCESS] All entries with code '"..Code.."' are disabled!")
    		Player:GossipComplete()
    	end	
    
    	
    	--| LOOKUP PLAYER
    	if (intid == 2389485) then
    		Player:SendBroadcastMessage("[1] Please enter name of Player you wish to look up.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "1) Please enter name of Player you wish to look up", 202001, 1)			
    		Item:GossipSendMenu(Player)	
    	end		
    	if (intid == 202001) then
    		Player:SendBroadcastMessage("=== Access-Keys for Player '"..Code.."' ===")
    		Current_Table = Load_File(DataFile)
    		for k,v in pairs(Current_Table) do
    			if (v[1] == string.format("%s", Code)) then
    				Player:SendBroadcastMessage("o "..v[1].." - Key: ["..v[2].."], Usable: "..v[3].."")
    			end
    		end
    		Player:SendBroadcastMessage("")
    		Player:GossipComplete()
    	end
    	--| ADD PLAYER-KEY
    	if (intid == 4389485) then
    		Player:SendBroadcastMessage("[1] Please enter Player's name.")
    		Item:GossipCreateMenu(3543, Player, 0)
    			Item:GossipMenuAddItem(10, "1) Add PlayerName", 201001, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 201001) then
    		z1_Name = Code
    		Player:SendBroadcastMessage("[2] You have entered Player: "..z1_Name)
    		Player:SendBroadcastMessage("[3] Please enter the Key-Code.")
    		Item:GossipCreateMenu(3543, Player, 0)	
    			Item:GossipMenuAddItem(10, "2) Add Access-Key", 201002, 1)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 201002) then	
    		z2_Key = Code
    		Code_Data = {z1_Name, z2_Key, "True"}
    		Item:GossipCreateMenu(3543, Player, 0)
    			Player:SendBroadcastMessage("[4] You have entered Code: "..z2_Key)
    			Player:SendBroadcastMessage("Please press 'Import Data' to finish.")
    			Item:GossipMenuAddItem(10, "3) Import Data", 201003, 0)
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)			
    		Item:GossipSendMenu(Player)	
    	end
    	if (intid == 201003) then
    		Add_NewKey(Code_Data)
    		Item:GossipCreateMenu(3543, Player, 0)	
    			Player:SendBroadcastMessage("[5] Player \""..z1_Name.."\" may now use key: \""..z2_Key.."\"")
    			Item:GossipMenuAddItem(10, "-> Add Another Key", 4389485, 0)
    			Item:GossipMenuAddItem(10, "-> Return to Main Menu", 900, 0)
    		Item:GossipSendMenu(Player)	
    	end
    end
    
    RegisterItemGossipEvent(ITEM_ID,1,"GMEvent_OnUse")
    RegisterItemGossipEvent(ITEM_ID,2,"GMEvent_OnSelect")
    
    --================================================================================================================--
    --=== GLOBAL FUNCTIONS  ==========================================================================================--
    --================================================================================================================--
    function Serialize_Table(tab)
      local ser = {} -- Serialize Table
      function ser.number (n)return tostring(n)end                        -- Serializes numbers
      function ser.string (str)return ("%q"):format(str)end               -- strings
      function ser.boolean (b) return tostring(b) end                     -- booleans
      function ser.thread (t)error "Threads are unsupported" end          -- unsupported
      ser["function"] = function (f) error "Functions are unsupported"end -- unsupported
      ser["nil"] = function(n) return "nil" end                           -- nils
      function ser.userdata(u) error "Userdatas are unsupported" end      -- unsupported
      local indent = 0
      local indc = "  "
      local knowntabs = {}
      function ser.table (tab)
        if knowntabs[tab] then error("Cyclic table not allowed") end
        knowntabs[tab] = true
        local out = {"{\n"}--{"{\n"}
        indent = indent + 1
        local ind = indc:rep(indent)
        local keys = {}
        for i,v in pairs(tab) do
          keys[#keys+1] = i -- ...
        end
        table.sort(keys,function(a,b)
          if type(a)=="number" and type(b)=="number" then return a<b end
          if type(a)=="number" then return true end
          if type(b)=="number" then return false end
          return tostring(a)<tostring(b)
        end)
        local n = 0
        for i,v in ipairs(keys) do
          local i,v = v,tab[v]
          local key,value = ser[type(i)](i),ser[type(v)](v)
          if n then
             n = n + 1
             if n == i then 
               out[#out+1] = ind..value..","--\n"
             else
               n = nil 
              out[#out+1] = ind.."["..key.."] = "..value..", \n"
            end
          else
            out[#out+1] = ind.."["..key.."] = "..value..", \n"
          end
        end
        indent = indent - 1
        out[#out+1] = indc:rep(indent).."}"
        return table.concat(out)
    	end
     
    	return "return "..ser.table(tab)
    end 
    
    function Check_Key(_Player, _Code)
    	Current_Table = Load_File(DataFile)
    	for k,v in pairs(Current_Table) do
    		if 	(v[1] == _Player:GetName()) and (v[2] == _Code) then
    			if (v[3] == "False") then KEY="FALSE" return KEY end
    			if (v[3] == "True") then KEY="TRUE" return KEY end
    			if (v[3] == nil) then KEY="NONE" return KEY end
    		end
    	end
    end
    
    function Set_CurrentKey(_Player, _Code, _Status)
    	Current_Table = Load_File(DataFile)
    	for k,v in pairs(Current_Table) do
    	if (v[1] == _Player:GetName()) and (v[2] == _Code) then
    		v[3] = _Status
    		end
    	end
    	Save_File(Current_Table, DataFile)
    end
    
    function Add_NewKey(_Data)
    	Current_Table = Load_File(DataFile)
    	table.insert(Current_Table, _Data)
    	Save_File(Current_Table, DataFile)	
    end
    
    function Save_File(tab, file)
    	local str = Serialize_Table(tab)
    	local fp = assert(io.open(file,"w"))
    	fp:write(str)
    	fp:close()
    end
    
    function Load_File(file)
      return dofile(file)
    end
    
    print ("\n ====================================================")
    print ("  Loaded: \"Redeemer NPC\" (V"..VERSION..") by Claiver. ")
    print ("  	NPC: 		"..NPC_ID.."")
    print ("  	GM-EVENTTOOL:	"..ITEM_ID.." \n")
    print ("  Make sure that the following file is existing: \n  '"..DataFile.."'")
    print (" ====================================================\n")
    I'm sorry I'm this annoying but now it's still not working when I create a new code for a player everything goes fine till the 3) Import Data, if i press that button nothing happens and I get this at my arcemu-world.exe:

  14. #29
    Scubast3ve's Avatar Member
    Reputation
    55
    Join Date
    Apr 2009
    Posts
    125
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wrote this off the top of my head and dont have the chance to test can any1 verify this?

    Code:
    function Coder_OnGossip(pUnit, event, player)
    pUnit:GossipCreateMenu(200, player, 0)
    pUnit:GossipMenuAddItem(10, "Say Hi To Continue", 1, 0)
    pUnit:GossipMenuAddItem(10, "Say Lol To Continue", 2, 0)
    pUnit:GossipSendMenu(player)
    end
    
    function Coder_OnSelect(pUnit, event, elayer, id, intid, code, pMisc)
    if intid == 1 then
    if code == "Hi" then
    pUnit:SendChatMessage(14, 0, "Gratz you can type Hi... Noob")
    end
    end
    
    if intid == 2 then
    if code == "Lol" then
    pUnit:SendChatMessage(14, 0, "Gratz You Can Type Lol... Noob")
    end
    end
    end
    
    RegisterUnitGossipEvent(7000004, 1, "Coder_OnGossip")
    RegisterUnitGossipEvent(7000004, 2, "Coder_OnSelect")
    @brue
    right click on the file that you added for the program to use and deselect read-only
    Last edited by Scubast3ve; 04-24-2009 at 10:20 AM.

  15. #30
    brue's Avatar Member
    Reputation
    1
    Join Date
    Jul 2008
    Posts
    33
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Scubast3ve View Post
    I wrote this off the top of my head and dont have the chance to test can any1 verify this?

    Code:
    function Coder_OnGossip(pUnit, event, player)
    pUnit:GossipCreateMenu(200, player, 0)
    pUnit:GossipMenuAddItem(10, "Say Hi To Continue", 1, 0)
    pUnit:GossipMenuAddItem(10, "Say Lol To Continue", 2, 0)
    pUnit:GossipSendMenu(player)
    end
    
    function Coder_OnSelect(pUnit, event, elayer, id, intid, code, pMisc)
    if intid == 1 then
    if code == "Hi" then
    pUnit:SendChatMessage(14, 0, "Gratz you can type Hi... Noob")
    end
    end
    
    if intid == 2 then
    if code == "Lol" then
    pUnit:SendChatMessage(14, 0, "Gratz You Can Type Lol... Noob")
    end
    end
    end
    
    RegisterUnitGossipEvent(7000004, 1, "Coder_OnGossip")
    RegisterUnitGossipEvent(7000004, 2, "Coder_OnSelect")
    @brue
    right click on the file that you added for the program to use and deselect read-only

    oh lol, I thought it was way more scripted then that so I didn't even thought about that but it it working ty

    EDIT: tried it out now, but now I can't use the key I regestered at one of my chars: [ERROR] code: 'test1' has already been used! while I didnt use it at all :S
    Last edited by brue; 04-24-2009 at 11:22 AM.

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. [Release] Advanced Welcome NPC VERSION 1.0
    By Scubast3ve in forum WoW EMU General Releases
    Replies: 27
    Last Post: 05-23-2009, 10:41 PM
  2. [Release] Advance Weapon Skill NPC - C++
    By LaAevie in forum WoW EMU General Releases
    Replies: 21
    Last Post: 04-13-2009, 11:02 AM
  3. [RELEASE] Visual Basic 2008 Codes
    By EmiloZ in forum Programming
    Replies: 25
    Last Post: 01-03-2009, 06:13 AM
  4. [Release]Advanced WarpNPC
    By Hermess in forum WoW EMU General Releases
    Replies: 17
    Last Post: 12-13-2008, 09:00 AM
  5. [Release] Inject Managed .Net Code!
    By bigtimt in forum WoW Memory Editing
    Replies: 6
    Last Post: 10-12-2008, 03:52 PM
All times are GMT -5. The time now is 04:33 PM. 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