PDA

View Full Version : [Lua] Player & Admin Event Control Panel



Wise
22-03-10, 05:33 AM
What is it?

Basically this is a script which affects 2 items.
1 Item (Sqls included below) <GM> Control Panel allows GMs/Admins to control what happens.

They can define what a player can win, how much and what the code is.

In Theory this is what its used for:
Every player has a "Player Control Panel" which allows them to do two things, Bind their location if the <GM> Control Panel has enabled it, and the second one is for the event. Say they win the event the GM sets what they win, and how much of it they win before the event starts and then whispers the code which can only be used once to the player who then puts it in their player control panel and gets the reward and then the code resets so nobody else can use it, the GM must then define a new code before anyone can win anything else via the <GM> panel.

http://i44.tinypic.com/t8ruwo.jpg
http://i42.tinypic.com/169jepd.jpg
http://i44.tinypic.com/5camio.jpg

The SQL

UPDATE `items` SET `entry` = '90001', `class` = '0', `subclass` = '-1', `field4` = '-1', `name1` = '<GM> Control Panel', `displayid` = '7984', `quality` = '4', `flags` = '0', `faction` = '0', `buyprice` = '0', `sellprice` = '0', `inventorytype` = '0', `allowableclass` = '-1', `allowablerace` = '-1', `itemlevel` = '0', `requiredlevel` = '0', `RequiredSkill` = '0', `RequiredSkillRank` = '0', `RequiredSpell` = '0', `RequiredPlayerRank1` = '0', `RequiredPlayerRank2` = '0', `RequiredFaction` = '0', `RequiredFactionStanding` = '0', `Unique` = '0', `maxcount` = '1', `ContainerSlots` = '0', `itemstatscount` = '0', `stat_type1` = '0', `stat_value1` = '0', `stat_type2` = '0', `stat_value2` = '0', `stat_type3` = '0', `stat_value3` = '0', `stat_type4` = '0', `stat_value4` = '0', `stat_type5` = '0', `stat_value5` = '0', `stat_type6` = '0', `stat_value6` = '0', `stat_type7` = '0', `stat_value7` = '0', `stat_type8` = '0', `stat_value8` = '0', `stat_type9` = '0', `stat_value9` = '0', `stat_type10` = '0', `stat_value10` = '0', `ScaledStatsDistributionId` = '0', `ScaledStatsDistributionFlags` = '0', `dmg_min1` = '0', `dmg_max1` = '0', `dmg_type1` = '0', `dmg_min2` = '0', `dmg_max2` = '0', `dmg_type2` = '0', `armor` = '0', `holy_res` = '0', `fire_res` = '0', `nature_res` = '0', `frost_res` = '0', `shadow_res` = '0', `arcane_res` = '0', `delay` = '1500', `ammo_type` = '0', `range` = '0', `spellid_1` = '40499', `spelltrigger_1` = '0', `spellcharges_1` = '0', `spellcooldown_1` = '0', `spellcategory_1` = '0', `spellcategorycooldown_1` = '0', `spellid_2` = '0', `spelltrigger_2` = '0', `spellcharges_2` = '0', `spellcooldown_2` = '0', `spellcategory_2` = '0', `spellcategorycooldown_2` = '0', `spellid_3` = '0', `spelltrigger_3` = '0', `spellcharges_3` = '0', `spellcooldown_3` = '0', `spellcategory_3` = '0', `spellcategorycooldown_3` = '0', `spellid_4` = '0', `spelltrigger_4` = '0', `spellcharges_4` = '0', `spellcooldown_4` = '0', `spellcategory_4` = '0', `spellcategorycooldown_4` = '0', `spellid_5` = '0', `spelltrigger_5` = '0', `spellcharges_5` = '0', `spellcooldown_5` = '0', `spellcategory_5` = '0', `spellcategorycooldown_5` = '0', `bonding` = '1', `description` = '<GM> Control Panel', `page_id` = '0', `page_language` = '0', `page_material` = '0', `quest_id` = '0', `lock_id` = '0', `lock_material` = '0', `sheathID` = '0', `randomprop` = '0', `randomsuffix` = '0', `block` = '0', `itemset` = '0', `MaxDurability` = '0', `ZoneNameID` = '0', `mapid` = NULL, `bagfamily` = '0', `TotemCategory` = NULL, `socket_color_1` = '0', `unk201_3` = '0', `socket_color_2` = '0', `unk201_5` = '0', `socket_color_3` = '0', `unk201_7` = '0', `socket_bonus` = '0', `GemProperties` = NULL, `ReqDisenchantSkill` = '-1', `ArmorDamageModifier` = '0', `existingduration` = '0', `ItemLimitCategoryId` = '0', `HolidayId` = '0' WHERE `entry` = 90001 LIMIT 1;
UPDATE `items` SET `entry` = '90000', `class` = '0', `subclass` = '-1', `field4` = '-1', `name1` = 'Player Control Panel', `displayid` = '7984', `quality` = '4', `flags` = '0', `faction` = '0', `buyprice` = '0', `sellprice` = '0', `inventorytype` = '0', `allowableclass` = '-1', `allowablerace` = '-1', `itemlevel` = '0', `requiredlevel` = '0', `RequiredSkill` = '0', `RequiredSkillRank` = '0', `RequiredSpell` = '0', `RequiredPlayerRank1` = '0', `RequiredPlayerRank2` = '0', `RequiredFaction` = '0', `RequiredFactionStanding` = '0', `Unique` = '0', `maxcount` = '1', `ContainerSlots` = '0', `itemstatscount` = '0', `stat_type1` = '0', `stat_value1` = '0', `stat_type2` = '0', `stat_value2` = '0', `stat_type3` = '0', `stat_value3` = '0', `stat_type4` = '0', `stat_value4` = '0', `stat_type5` = '0', `stat_value5` = '0', `stat_type6` = '0', `stat_value6` = '0', `stat_type7` = '0', `stat_value7` = '0', `stat_type8` = '0', `stat_value8` = '0', `stat_type9` = '0', `stat_value9` = '0', `stat_type10` = '0', `stat_value10` = '0', `ScaledStatsDistributionId` = '0', `ScaledStatsDistributionFlags` = '0', `dmg_min1` = '0', `dmg_max1` = '0', `dmg_type1` = '0', `dmg_min2` = '0', `dmg_max2` = '0', `dmg_type2` = '0', `armor` = '0', `holy_res` = '0', `fire_res` = '0', `nature_res` = '0', `frost_res` = '0', `shadow_res` = '0', `arcane_res` = '0', `delay` = '1500', `ammo_type` = '0', `range` = '0', `spellid_1` = '40499', `spelltrigger_1` = '0', `spellcharges_1` = '0', `spellcooldown_1` = '0', `spellcategory_1` = '0', `spellcategorycooldown_1` = '0', `spellid_2` = '0', `spelltrigger_2` = '0', `spellcharges_2` = '0', `spellcooldown_2` = '0', `spellcategory_2` = '0', `spellcategorycooldown_2` = '0', `spellid_3` = '0', `spelltrigger_3` = '0', `spellcharges_3` = '0', `spellcooldown_3` = '0', `spellcategory_3` = '0', `spellcategorycooldown_3` = '0', `spellid_4` = '0', `spelltrigger_4` = '0', `spellcharges_4` = '0', `spellcooldown_4` = '0', `spellcategory_4` = '0', `spellcategorycooldown_4` = '0', `spellid_5` = '0', `spelltrigger_5` = '0', `spellcharges_5` = '0', `spellcooldown_5` = '0', `spellcategory_5` = '0', `spellcategorycooldown_5` = '0', `bonding` = '1', `description` = 'You can use this to access your player control panel.', `page_id` = '0', `page_language` = '0', `page_material` = '0', `quest_id` = '0', `lock_id` = '0', `lock_material` = '0', `sheathID` = '0', `randomprop` = '0', `randomsuffix` = '0', `block` = '0', `itemset` = '0', `MaxDurability` = '0', `ZoneNameID` = '0', `mapid` = NULL, `bagfamily` = '0', `TotemCategory` = NULL, `socket_color_1` = '0', `unk201_3` = '0', `socket_color_2` = '0', `unk201_5` = '0', `socket_color_3` = '0', `unk201_7` = '0', `socket_bonus` = '0', `GemProperties` = NULL, `ReqDisenchantSkill` = '-1', `ArmorDamageModifier` = '0', `existingduration` = '0', `ItemLimitCategoryId` = '0', `HolidayId` = '0' WHERE `entry` = 90000 LIMIT 1;
The Script:
Lua | local ccode = nil local icode - Ground Zero - 3LSfh8US - Pastebin.com (http://groundzero.pastebin.com/3LSfh8US)

OR


local ccode = nil
local icode = nil
local iam = nil
local allow = 1

function ppanel(item, event, player)
item:GossipCreateMenu(320, player, 1)
item:GossipMenuAddItem(1, "Claim a Reward", 101, 1)
item:GossipMenuAddItem(4, "Set this location as my Hearthstone", 102, 0)
item:GossipMenuAddItem(2, "Nevermind.", 100, 0)
item:GossipSendMenu(player)
end

function plpanel(item, event, player, id, intid, code)
if(intid == 102) then
if allow == 1 then
PlyrX = player:GetX()
PlyrY = player:GetY()
PlyrZ = player:GetZ()
PlyrMapID = player:GetMapId()
PlyrAreaID = player:GetAreaId()
player:SetBindPoint(PlyrX, PlyrY, PlyrZ, PlyrMapID, PlyrAreaID)
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r New Hearthstone Bound at Map: "..PlyrMapID.." Area: "..PlyrAreaID.." X: "..PlyrX.." Y: "..PlyrY.." Z: "..PlyrZ.."")
player:GossipComplete()
else
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r This Function has been disabled by a <GM> or <Admin>")
player:GossipComplete()
end
end

if(intid == 101) then
if(code == ccode) then
if(ccode == nil) then
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r No Reward has been specified by the Host!")
player:GossipComplete()
end
if(icode == nil) then
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r No Reward has been specified by the Host!")
player:GossipComplete()
end
if(iam == nil) then
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r No Reward Amount has been specified by the Host!")
player:GossipComplete()
end
player:AddItem(icode, iam)
ccode = nil
icode = nil
iam = nil
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r Correct Code! Enjoy your Prize. (This code can no longer be used!)")
player:GossipComplete()
else
player:SendBroadcastMessage("|cFFFF0000[NOTICE]:|r Invalid Code Inserted!")
player:GossipComplete()
end
end

if(intid == 100) then
player:GossipComplete()
end
end

RegisterItemGossipEvent(90000, 1, "ppanel")
RegisterItemGossipEvent(90000, 2, "plpanel")

function apanel(item, event, player)
item:GossipCreateMenu(321, player, 1)
item:GossipMenuAddItem(4, "Set Code", 105, 1)
item:GossipMenuAddItem(4, "Set Reward ID", 106, 1)
item:GossipMenuAddItem(4, "Set Reward Amount", 107, 1)
item:GossipMenuAddItem(4, "Print Current Values", 110, 0)
item:GossipMenuAddItem(5, "Reset All", 108, 0)
if allow == 1 then
item:GossipMenuAddItem(5, "Disable Bind Location", 104, 0)
else
item:GossipMenuAddItem(5, "Enable Bind Location", 103, 0)
end
item:GossipMenuAddItem(2, "Nevermind.", 109, 0)
item:GossipSendMenu(player)
end

function adpanel(item, event, player, id, intid, code)
if(intid == 110) then
if(ccode == nil) then
player:GossipComplete()
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r No Code Value Set!")
end

if(icode == nil) then
player:GossipComplete()
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r No Item Value Set!")
end

if(iam == nil) then
player:GossipComplete()
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r No Amount Value Set!")
end

player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Current Correct Code is "..ccode..".")
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Current Reward ID is "..icode..".")
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Current Reward Amount is "..iam..".")
player:GossipCompelte()
end

if(intid == 104) then
if allow == 0 then
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Bind Location is already disabled.")
player:GossipComplete()
else
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Bind Location has been disabled.")
player:GossipComplete()
allow = 0
end
end

if(intid == 103) then
if allow == 1 then
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Bind Location is already enabled.")
player:GossipComplete()
else
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Bind Location has been enabled.")
player:GossipComplete()
allow = 1
end
end

if(intid == 109) then
player:GossipComplete()
end

if(intid == 108) then
ccode = nil
icode = nil
iam = nil
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r All Values Reset.")
player:GossipComplete()
end

if(intid == 107) then
iam = code
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Set Reward Amount to "..code.."")
player:GossipComplete()
end

if(intid == 106) then
icode = code
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Set Reward ID to "..code.."")
player:GossipComplete()
end

if(intid == 105) then
ccode = code
player:SendBroadcastMessage("|cFFFF0000[GM-NOTICE]:|r Set Correct Code to "..code.."")
player:GossipComplete()
end
end

RegisterItemGossipEvent(90001, 1, "apanel")
RegisterItemGossipEvent(90001, 2, "adpanel")

Enjoy.

Credits to ~GroundZero~

zwroblewski
22-09-10, 07:40 PM
Today i was going around testing lua scripts and this one works! :) thanks for sharing

Bing
22-09-10, 08:04 PM
Necroposting again. Infracted >:3