Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("")
- print("-----------------------------------------------------------------------------")
- print("")
- print("@@-GAMEOBJECT-@@..Build 2.9...........")
- print("@@--|_MOVE_|--@@..Script by Mordred...")
- print("______________________________________")
- print("Gate required - by Kenuvis............")
- print("")
- print("-----------------------------------------------------------------------------")
- print("")
- ------------------------------------------------ Deklaration -----------------------------------------------------------
- local GOobject = {}
- local GOobjEntry = {}
- local GOsaved = {}
- local GOsavedStatic = {}
- --------------------------------------------------- OnChat -------------------------------------------------------------
- function OnChat(Event, Player, Message, Type, Language, Misc)
- if (Message==".gomove") or (Message==".gom") or (Message==".GOMove") or (Message==".gomo") or (Message==".gomov") then
- if (Player:IsGm()) then
- Player:SendBroadcastMessage("|cFFFFAA00GO Move successfully loaded!|r")
- if (GOobject[Player]~=nil) then
- GameObjectMove(Player) --"GameObjectFind" if Menu not closed
- Player:SendBroadcastMessage("|cFFFFAA00Move your Game Object from bevor.|r")
- else
- GameObjectFind(Player) --"GameObjectFind" start #1 function
- Player:SendBroadcastMessage("|cFFFFAA00Search now for your Game Object you want to move.|r")
- end
- else
- Player:SendBroadcastMessage("|cFFFF0000You have no permission for this application!|r")
- end
- elseif (Message==".test") or (Message==".t") then
- RegisterTimedEvent("Test", 1000, 0, Player)
- end
- end
- RegisterServerHook(16, OnChat)
- --------------------------------------------------- Events -------------------------------------------------------------
- ---------------------------------------------------- #1 --------------------------------------------------------------
- function GameObjectFind(Player)
- local GOFind = CreateFrame("GameObjectFind")
- local SearchB = GOFind:CreateButton("SearchButton")
- GOFind:SetText("GO Search")
- GOFind:SetCantMove(true)
- GOFind:SetYOffset(280)
- GOFind:SetHeight(70) --Frame
- GOFind:SetWidth(150)
- SearchB:SetText("Search") --Button
- SearchB:SetHeight(40)
- SearchB:SetWidth(139)
- SearchB:SetYOffset(-8)
- SearchB:SetXOffset(2)
- SearchB:SetEvent("OnClick", function(self, event, player,_)
- GOobject[Player] = Player:GetSelectedGO()
- if (GOobject[Player]~=nil) then
- GameObjectMove(Player) --"GameObjectMove" start #2 function
- GOFind:Hide(Player)
- else
- local OK = CreateDialogFrame("OKframe")
- OK:SetText("No GameObject")
- OK:SetYOffset(260)
- OK:SetHeight(115)
- OK:SetWidth(150)
- OK:Send(Player)
- end
- end)
- GOFind:Send(Player)
- end
- ---------------------------------------------------- #2 --------------------------------------------------------------
- function GameObjectMove(Player)
- GOsaved[Player] = {}
- GOsavedStatic[Player] = {}
- -- Frame --
- local Main = CreateFrame("Main")
- local XAxisPlus = Main:CreateButton("XAxisPlus")
- local YAxisPlus = Main:CreateButton("YAxisPlus")
- local XAxisMins = Main:CreateButton("XAxisMinus") --XY Move Buttons + EditBox + CheckBox
- local YAxisMins = Main:CreateButton("YAxisMinus")
- local XYEditBox = Main:CreateEditBox("XYEditBox")
- local XYCheckBox = Main:CreateCheckBox("XYCheckBox")
- local ZAxisMins = Main:CreateButton("ZAxisMinus")
- local ZAxisPlus = Main:CreateButton("ZAxisPlus") --Z Move Buttons + EditBox
- local ZEditBox = Main:CreateEditBox("ZEditBox")
- local RotateClockwise = Main:CreateButton("RotateClockwise")
- local RotateAntiClock = Main:CreateButton("RotateAntiClockwise") --Rotate Buttons + EditBox
- local RotateEditBox = Main:CreateEditBox("RotateEditBox")
- local ScalePlus = Main:CreateButton("ScalePlus")
- local ScaleMins = Main:CreateButton("ScaleMinus") --Scale Buttons + EditBox
- local ScaleEditBox = Main:CreateEditBox("ScaleEditBox")
- local InjectGO = Main:CreateButton("InjectGameObject")
- local ReInject = Main:CreateButton("ReInjectGameObject") --Inject Buttons + EditBox
- local InjectEditBox = Main:CreateEditBox("InjectEditBox")
- local ReSearch = Main:CreateButton("ReSearch")
- local Save = Main:CreateButton("Save") --Sideoption Buttons
- local Delete = Main:CreateButton("Delete")
- local SaveCheckBox = Main:CreateCheckBox("SaveCheckBox")
- ------------------------------------------------------------------------------------------------------------------------
- -- Main Settings --
- Main:SetText("GameObject Move")
- Main:SetHeight(140)
- Main:SetWidth(500)
- Main:SetCantMove(true)
- Main:SetYOffset(318)
- ------------------------------------------------------------------------------------------------------------------------
- -- X-Y Axis Settings --
- -- X Plus --
- XAxisPlus:SetText("N")
- XAxisPlus:SetYOffset(20)
- XAxisPlus:SetXOffset(-175)
- XAxisPlus:SetWidth(40)
- XAxisPlus:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[5]==nil then return end
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local x = x + (ECB[5]*0.1)
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,entry,scale)
- GOobject[Player] = GO
- if (ECB[3]) then
- Player:SetPosition(Player:GetX(), Player:GetY(), Player:GetZ(), 0)
- end
- end)
- -- Y Plus --
- YAxisPlus:SetText("E")
- YAxisPlus:SetYOffset(-5)
- YAxisPlus:SetXOffset(-215)
- YAxisPlus:SetWidth(40)
- YAxisPlus:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[5]==nil then return end
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local y = y + (ECB[5]*0.1)
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,entry,scale)
- GOobject[Player] = GO
- if (ECB[3]) then
- Player:SetPosition(Player:GetX(), Player:GetY(), Player:GetZ(), 0)
- end
- end)
- -- X Minus --
- XAxisMins:SetText("S")
- XAxisMins:SetYOffset(-30)
- XAxisMins:SetXOffset(-175)
- XAxisMins:SetWidth(40)
- XAxisMins:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[5]==nil then return end
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local x = x - (ECB[5]*0.1)
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,entry,scale)
- GOobject[Player] = GO
- if (ECB[3]) then
- Player:SetPosition(Player:GetX(), Player:GetY(), Player:GetZ(), 0)
- end
- end)
- -- Y Minus --
- YAxisMins:SetText("W")
- YAxisMins:SetYOffset(-5)
- YAxisMins:SetXOffset(-135)
- YAxisMins:SetWidth(40)
- YAxisMins:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[5]==nil then return end
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local y = y - (ECB[5]*0.1)
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,entry,scale)
- GOobject[Player] = GO
- if (ECB[3]) then
- Player:SetPosition(Player:GetX(), Player:GetY(), Player:GetZ(), 0)
- end
- end)
- -- X-Y CheckBox --
- XYCheckBox:SetWidth(25)
- XYCheckBox:SetYOffset(-53)
- XYCheckBox:SetXOffset(-225)
- XYCheckBox:SetText("North Orientate")
- XYCheckBox:SetStatusLink("XAxisPlus")
- XYCheckBox:SetStatusLink("YAxisPlus")
- XYCheckBox:SetStatusLink("XAxisMinus")
- XYCheckBox:SetStatusLink("YAxisMinus")
- XYCheckBox:SetTooltip("If checked you are always looking at north to have a better orientation")
- -- X-Y EditBox --
- XYEditBox:SetWidth(25)
- XYEditBox:SetYOffset(-5)
- XYEditBox:SetXOffset(-173)
- XYEditBox:SetStatusLink("XAxisPlus")
- XYEditBox:SetStatusLink("YAxisPlus")
- XYEditBox:SetStatusLink("XAxisMinus")
- XYEditBox:SetStatusLink("YAxisMinus")
- XYEditBox:SetTooltip("Enter your multiplicator here which amount you want to move the GameObject")
- ------------------------------------------------------------------------------------------------------------------------
- -- Z Axis Settings --
- -- Z Minus --
- ZAxisMins:SetText("Down")
- ZAxisMins:SetYOffset(-30)
- ZAxisMins:SetXOffset(-90)
- ZAxisMins:SetWidth(50)
- ZAxisMins:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[3]==nil then return end
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local z = z - (ECB[3]*0.1)
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,entry,scale)
- GOobject[Player] = GO
- end)
- -- Z Plus --
- ZAxisPlus:SetText("Up")
- ZAxisPlus:SetYOffset(20)
- ZAxisPlus:SetXOffset(-90)
- ZAxisPlus:SetWidth(50)
- ZAxisPlus:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[3]==nil then return end
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local z = z + (ECB[3]*0.1)
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,entry,scale)
- GOobject[Player] = GO
- end)
- -- Z EditBox --
- ZEditBox:SetWidth(35)
- ZEditBox:SetYOffset(-5)
- ZEditBox:SetXOffset(-87)
- ZEditBox:SetStatusLink("ZAxisMinus")
- ZEditBox:SetStatusLink("ZAxisPlus")
- ZEditBox:SetTooltip("Enter your multiplicator here which amount you want to move the GameObject up and down")
- ------------------------------------------------------------------------------------------------------------------------
- -- Rotate Settings --
- -- Rotate Clockwise --
- RotateClockwise:SetText("Right")
- RotateClockwise:SetYOffset(20)
- RotateClockwise:SetXOffset(-40)
- RotateClockwise:SetWidth(50)
- RotateClockwise:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[3]==nil then return end
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local o = o - (ECB[3]*0.1)
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,entry,scale)
- GOobject[Player] = GO
- end)
- -- Rotate Anti-Clockwise --
- RotateAntiClock:SetText("Left")
- RotateAntiClock:SetYOffset(-30)
- RotateAntiClock:SetXOffset(-40)
- RotateAntiClock:SetWidth(50)
- RotateAntiClock:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[3]==nil then return end
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local o = o + (ECB[3]*0.1)
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,entry,scale)
- GOobject[Player] = GO
- end)
- -- Rotate EditBox --
- RotateEditBox:SetWidth(35)
- RotateEditBox:SetYOffset(-5)
- RotateEditBox:SetXOffset(-37)
- RotateEditBox:SetStatusLink("RotateClockwise")
- RotateEditBox:SetStatusLink("RotateAntiClockwise")
- RotateEditBox:SetTooltip("Enter your multiplicator here which amount you want to rotate the GameObject")
- ------------------------------------------------------------------------------------------------------------------------
- -- Scale Settings --
- -- Scale bigger --
- ScalePlus:SetText("Bigger")
- ScalePlus:SetYOffset(20)
- ScalePlus:SetXOffset(10)
- ScalePlus:SetWidth(50)
- ScalePlus:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[3]==nil then return end
- if GOobject[Player]:GetScale()==nil then return end
- GOobject[Player]:ChangeScale(GOobject[Player]:GetScale() + (ECB[3]*0.1), true)
- end)
- -- Scale smaller --
- ScaleMins:SetText("Smaller")
- ScaleMins:SetYOffset(-30)
- ScaleMins:SetXOffset(10)
- ScaleMins:SetWidth(50)
- ScaleMins:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[3]==nil then return end
- if GOobject[Player]:GetScale()==nil then return end
- GOobject[Player]:ChangeScale(GOobject[Player]:GetScale() - (ECB[3]*0.1), true)
- end)
- -- Scale EditBox --
- ScaleEditBox:SetWidth(35)
- ScaleEditBox:SetYOffset(-5)
- ScaleEditBox:SetXOffset(13)
- ScaleEditBox:SetStatusLink("ScalePlus")
- ScaleEditBox:SetStatusLink("ScaleMinus")
- ScaleEditBox:SetTooltip("Enter your multiplicator here which amount you want to modify the GameObject's scale")
- ------------------------------------------------------------------------------------------------------------------------
- -- Inject Settings --
- -- Inject --
- InjectGO:SetText("Inject")
- InjectGO:SetYOffset(20)
- InjectGO:SetXOffset(60)
- InjectGO:SetWidth(50)
- InjectGO:SetEvent("OnClick", function(self, event, player, ECB)
- if ECB[3]==nil then return end
- GOobjEntry[Player] = GOobject[Player]:GetEntry()
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,ECB[3],scale)
- GOobject[Player] = GO
- end)
- -- ReInject --
- ReInject:SetText("Reinject")
- ReInject:SetYOffset(-30)
- ReInject:SetXOffset(60)
- ReInject:SetWidth(50)
- ReInject:SetEvent("OnClick", function(self, event, player, ECB)
- if (GOobjEntry[Player]~=nil) then
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- local GO = GOMove(Player,GOobject[Player],x,y,z,o,GOobjEntry[Player],scale)
- GOobject[Player] = GO
- end
- end)
- -- Inject EditBox --
- InjectEditBox:SetWidth(35)
- InjectEditBox:SetYOffset(-5)
- InjectEditBox:SetXOffset(63)
- InjectEditBox:SetStatusLink("InjectGameObject")
- InjectEditBox:SetTooltip("Enter your Entry here to change the position of the GameObject with the new one")
- ------------------------------------------------------------------------------------------------------------------------
- -- Sideoption Settings --
- -- ReSearch --
- ReSearch:SetText("Research")
- ReSearch:SetYOffset(22)
- ReSearch:SetXOffset(190)
- ReSearch:SetWidth(70)
- ReSearch:SetEvent("OnClick", function(self, event, player,_)
- if (Player:GetSelectedGO()~=nil) then
- GOobject[Player] = Player:GetSelectedGO()
- else
- local OK = CreateDialogFrame("OKframe")
- OK:SetText("No GameObject")
- OK:Send(Player)
- end
- end)
- -- Save --
- Save:SetText("Save")
- Save:SetYOffset(-5)
- Save:SetXOffset(190)
- Save:SetWidth(70)
- Save:SetEvent("OnClick", function(self, event, player,ECB)
- local x,y,z,o,entry,scale = VarsFunc(GOobject[Player])
- if x==nil then return end
- if (ECB[3]) then
- maxid = WorldDBQuery("SELECT MAX(`id`) FROM `gameobject_staticspawns`"):GetColumn(0):GetString()
- else
- maxid = WorldDBQuery("SELECT MAX(`id`) FROM `gameobject_spawns`"):GetColumn(0):GetString()
- end
- if maxid~=nil then
- n = (tonumber(maxid)+1)
- else
- n = 1
- end
- table.insert(GOsaved[Player], {})
- GOsaved[Player][table.getn(GOsaved[Player])][n] = GOobject[Player]
- if (ECB[3]) then
- table.insert(GOsavedStatic[Player], 1)
- WorldDBQuery("INSERT INTO `gameobject_staticspawns` VALUES ('"..n.."', '"..entry.."', '"..GOobject[Player]:GetMapId().."', '"..x.."', '"..y.."', '"..z.."', '"..o.."', '0', '0', '0', '0', '1', '0', '0', '"..scale.."', '0', '"..GOobject[Player]:GetPhase().."', '0');")
- else
- table.insert(GOsavedStatic[Player], 0)
- WorldDBQuery("INSERT INTO `gameobject_spawns` VALUES ('"..n.."', '"..entry.."', '"..GOobject[Player]:GetMapId().."', '"..x.."', '"..y.."', '"..z.."', '"..o.."', '0', '0', '0', '0', '1', '0', '0', '"..scale.."', '0', '"..GOobject[Player]:GetPhase().."', '0');")
- end
- GOobject[Player] = Player:SpawnGameObject(entry, x, y, z, o, 0, scale)
- GOobject[Player]:ChangeScale(scale, true)
- end)
- -- Delete --
- Delete:SetText("Delete")
- Delete:SetYOffset(-32)
- Delete:SetXOffset(190)
- Delete:SetWidth(70)
- Delete:SetEvent("OnClick", function(self, event, player,_)
- if (GOsaved[Player][table.getn(GOsaved[Player])]~=nil) then
- for k,v in pairs(GOsaved[Player][table.getn(GOsaved[Player])]) do
- if k~=nil and v~=nil then
- v:Despawn(0,0)
- if (GOsavedStatic[Player][table.getn(GOsavedStatic[Player])]==1) then
- WorldDBQuery("DELETE FROM `gameobject_staticspawns` WHERE `id` = "..k)
- else
- WorldDBQuery("DELETE FROM `gameobject_spawns` WHERE `id` = "..k)
- end
- table.remove(GOsaved[Player], table.getn(GOsaved[Player]))
- table.remove(GOsavedStatic[Player], table.getn(GOsavedStatic[Player]))
- end
- end
- else
- local OK = CreateDialogFrame("OKframe")
- OK:SetText("No Saved GO")
- OK:Send(Player)
- end
- end)
- -- Save CheckBox --
- SaveCheckBox:SetWidth(25)
- SaveCheckBox:SetYOffset(-53)
- SaveCheckBox:SetXOffset(145)
- SaveCheckBox:SetText("Static Save")
- SaveCheckBox:SetStatusLink("Save")
- SaveCheckBox:SetTooltip("If checked you will save to 'gameobject_staticspawns' table")
- ------------------------------------------------------------------------------------------------------------------------
- Main:Send(Player)
- end
- function VarsFunc(GO)
- if (GO==nil) then return end
- local x = GO:GetX()
- local y = GO:GetY()
- local z = GO:GetZ()
- local o = GO:GetO()
- local entry = GO:GetEntry()
- local scale = GO:GetScale()
- return x,y,z,o,entry,scale
- end
- function GOMove(Player,GO,x,y,z,o,entry,scale)
- GO:Despawn(0,0)
- GO = Player:SpawnGameObject(entry, x, y, z, o, 0, scale)
- GO:ChangeScale(scale, true)
- return GO
- end
- --[[ >CHANGES<
- 2.9 - Some fixes and compatible with default scripting engine 'LuaEngine'
- 2.8 - Tooltips fixed
- 2.7 - Added new Feature: 'Save to Staticspawns' and 'Delete' fixed with new features
- 2.6 - Compressed Code up from 798 lines to 384 lines!
- 2.5 - 'Save' fixed and new feature: Delete
- 2.4 - 'Inject' and 'ReInject' fixed and fully compatible with default scripting engine 'luabridge'
- 2.3 - Bug Fixes and 'Save'-Button
- 2.2 - Tooltips!
- 2.1 - Bug Fixes
- 2.0 - Fully rescripted
- ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement