Hello in this script the gui window is not opening in my server.
before it was opening but the object is not moving and i had updated some things and then the gui is not opening
Please fix the problem
SERVER:
--Creating Of The Parts
local hull1 = createObject(1680, 139.78, -1919.66, 17.07, 0, 0, 180) --Hull1
local sail1 = createObject(1683, 140.56, -1912.22, 20.16, 0, 0, 180) --Sails1
--Attachments Of The Parts
attachElements(sail1, hull1, 0, 0, 0)
function GUIness(source)
local taccount = getPlayerAccount ( source )
if isAdminAccount(taccount) then
triggerClientEvent(source, "makeGUI1", root)
end
end
addCommandHandler("balloon", GUIness) --Command for opening GUI
function goToballoon(source)
local taccount = getPlayerAccount(source)
if isAdminAccount(taccount) then
local x,y,z = getElementPosition(hull1)
setElementPosition(source, x, y + 5, z - 9)
end
end
addCommandHandler("gotoballoon", goToballoon) --Command for warping to the balloon
function setballoonHeightFunc(playerSource, commandName, height)
if (height) then
local taccount = getPlayerAccount(source)
if isAdminAccount(taccount) then
local x,y,z = getElementPosition(hull1)
setElementPosition(hull1, x, y, tonumber(height))
end
end
end
addCommandHandler("balloonheight", setballoonHeightFunc)
function stopballoonFunc()
stopObject(hull1)
end
addEvent("stopballoon", true)
addEventHandler("stopballoon", root, stopballoonFunc)
--balloon Ship Raise/Lower/Reset
function balloonHeightFunc(theValue)
local x,y,z = getElementPosition(hull1)
if theValue == 17 then
moveObject(hull1, 0, x, y, 17)
else
moveObject(hull1, 5000, x, y, z + theValue)
end
end
addEvent("balloonHeight", true)
addEventHandler("balloonHeight", root, balloonHeightFunc)
--balloon Ship Warper
function balloonWarper(x, y, z, rx, ry, rz)
moveObject(hull1, 0, x, y, z, rx, ry, rz)
end
addEvent("moveToBut1", true)
addEventHandler("moveToBut1", root, balloonWarper)
--Directional Movement Controls
function balloonMove(xD, yD, zD)
local x,y,z = getElementPosition(hull1)
moveObject(hull1, 20000000, x + xD, y + yD, z + zD)
end
addEvent("balloonMoveEvent", true)
addEventHandler("balloonMoveEvent", root, balloonMove)
--Rotational Movement Controls
function balloonRotateFunc(rX, rY, rZ)
local x,y,z = getElementPosition(hull1)
moveObject(hull1, 5000, x, y, z, rX, rY, rZ)
end
addEvent("balloonRotate", true)
addEventHandler("balloonRotate", root, balloonRotateFunc)
--Stop Bind
function BindM()
if (not isKeyBound(source, "m")) then
bindKey(source, "m", "down", createM)
end
end
addEventHandler("onPlayerSpawn", getRootElement(), BindM)
function createM(player, commandName)
local account = getPlayerAccount(player)
if isAdminAccount(account) then
stopObject(hull1)
end
end
addCommandHandler("m", createM)
function isAdminAccount(account)
local nick = ""
local group = aclGetGroup("Admin")
if (account and group) then
nick = string.lower(getAccountName(account) or "")
for _, object in ipairs(aclGroupListObjects(group) or {}) do
if (gettok(object, 1, string.byte('.')) == "user") then
if (nick == string.lower(gettok(object, 2, string.byte('.')))) then
return true
end
end
end
end
return false
end
CLIENT:
local resX, resY = guiGetScreenSize()
function createGUI(thePlayer)
cWindow = guiCreateWindow((resX/2)-315,(resY/2)-100,629,200,"Balloon Controls",false)
buttonSAC = guiCreateButton(0.3418,0.485,0.0668,0.195,"Stop",true,cWindow)
NW = guiCreateButton(0.2655,0.255,0.0668,0.195,"NW",true,cWindow)
N = guiCreateButton(0.3418,0.255,0.0668,0.195,"N",true,cWindow)
NE = guiCreateButton(0.4213,0.26,0.0668,0.195,"NE",true,cWindow)
W = guiCreateButton(0.2671,0.485,0.0668,0.195,"W",true,cWindow)
E = guiCreateButton(0.4213,0.49,0.0668,0.195,"E",true,cWindow)
SW = guiCreateButton(0.2671,0.73,0.0668,0.195,"SW",true,cWindow)
S = guiCreateButton(0.3434,0.73,0.0668,0.195,"S",true,cWindow)
SE = guiCreateButton(0.4213,0.725,0.0668,0.195,"SE",true,cWindow)
NWr = guiCreateButton(0.5119,0.26,0.0668,0.195,"45",true,cWindow)
GoUp = guiCreateButton(0.5919,0.26,0.0668,0.195,"Up",true,cWindow)
resetH = guiCreateButton(0.6750,0.12,0.0600,0.1,"Reset",true,cWindow)
NEr = guiCreateButton(0.6693,0.26,0.0668,0.195,"45",true,cWindow)
Wr = guiCreateButton(0.5119,0.49,0.0668,0.195,"90",true,cWindow)
GoDn = guiCreateButton(0.5919,0.49,0.0668,0.195,"Down",true,cWindow)
Er = guiCreateButton(0.6693,0.495,0.0668,0.195,"90",true,cWindow)
button1 = guiCreateButton(0.7663,0.26,0.213,0.150,"Move To LS",true,cWindow)
button2 = guiCreateButton(0.7663,0.440,0.213,0.150,"Move To SF",true,cWindow)
button3 = guiCreateButton(0.7663,0.620,0.213,0.150,"Move To LV",true,cWindow)
button4 = guiCreateButton(0.5175,0.725,0.213,0.195,"Close",true,cWindow)
TiltUp = guiCreateButton(0.0143,0.49,0.1113,0.195,"Tilt Up",true,cWindow)
TiltDown = guiCreateButton(0.0143,0.72,0.1113,0.195,"Tilt Down",true,cWindow)
TiltRight = guiCreateButton(0.1430,0.49,0.1113,0.195,"Tilt Right",true,cWindow)
TiltLeft = guiCreateButton(0.1430,0.72,0.1113,0.195,"Tilt Left",true,cWindow)
GUIEditor_Label1 = guiCreateLabel(0.2766,0.125,0.2051,0.075, "Movement Controls",true,cWindow)
guiLabelSetColor(GUIEditor_Label1,255,255,255)
guiLabelSetVerticalAlign(GUIEditor_Label1,"top")
guiLabelSetHorizontalAlign(GUIEditor_Label1,"left",false)
GUIEditor_Label2 = guiCreateLabel(0.5158,0.125,0.1781,0.08,"Rotation Controls",true,cWindow)
guiLabelSetColor(GUIEditor_Label2,255,255,255)
guiLabelSetVerticalAlign(GUIEditor_Label2,"top")
guiLabelSetHorizontalAlign(GUIEditor_Label2,"left",false)
GUIEditor_Label3 = guiCreateLabel(0.806,0.125,0.1669,0.0739,"Warp Controls",true,cWindow)
guiLabelSetColor(GUIEditor_Label3,255,255,255)
guiLabelSetVerticalAlign(GUIEditor_Label3,"top")
guiLabelSetHorizontalAlign(GUIEditor_Label3,"left",false)
GUIEditor_Label4 = guiCreateLabel(0.0525,0.135,0.1669,0.0739,"Tilt Controls",true,cWindow)
guiLabelSetColor(GUIEditor_Label4,255,255,255)
guiLabelSetVerticalAlign(GUIEditor_Label4,"top")
guiLabelSetHorizontalAlign(GUIEditor_Label4,"left",false)
addEventHandler("onClientGUIClick", GoUp, function() triggerServerEvent("balloonHeight", root, 3) end, false)
addEventHandler("onClientGUIClick", GoDn, function() triggerServerEvent("balloonHeight", root, -3) end, false)
addEventHandler("onClientGUIClick", resetH, function() triggerServerEvent("balloonHeight", root, 17) end, false)
addEventHandler("onClientGUIClick", buttonSAC, function() triggerServerEvent("stopballoon", root) end, false)
addEventHandler("onClientGUIClick", button1, function() triggerServerEvent("moveToBut1", root, 139.78, -1919.66, 17.07, 0, 0, 0) end, false)
addEventHandler("onClientGUIClick", button2, function() triggerServerEvent("moveToBut1", root, -1716.25, 1457.45, 17.07, 0, 0, 0) end, false)
addEventHandler("onClientGUIClick", button3, function() triggerServerEvent("moveToBut1", root, 2289.28, 516.86, 17.07, 0, 0, 90) end, false)
addEventHandler("onClientGUIClick", button4, closeCgui, false)
addEventHandler("onClientGUIClick", NW, function() triggerServerEvent("balloonMoveEvent", root, -9999, 9999, 0) end, false)
addEventHandler("onClientGUIClick", N, function() triggerServerEvent("balloonMoveEvent", root, 0, 9999, 0) end, false)
addEventHandler("onClientGUIClick", NE, function() triggerServerEvent("balloonMoveEvent", root, 9999, 9999, 0) end, false)
addEventHandler("onClientGUIClick", E, function() triggerServerEvent("balloonMoveEvent", root, 9999, 0, 0) end, false)
addEventHandler("onClientGUIClick", SE, function() triggerServerEvent("balloonMoveEvent", root, 9999, -9999, 0) end, false)
addEventHandler("onClientGUIClick", S, function() triggerServerEvent("balloonMoveEvent", root, 0, -9999, 0) end, false)
addEventHandler("onClientGUIClick", SW, function() triggerServerEvent("balloonMoveEvent", root, -9999, -9999, 0) end, false)
addEventHandler("onClientGUIClick", W, function() triggerServerEvent("balloonMoveEvent", root, -9999, 0, 0) end, false)
addEventHandler("onClientGUIClick", NWr, function() triggerServerEvent("balloonRotate", root, 0, 0, 45) end, false)
addEventHandler("onClientGUIClick", NEr, function() triggerServerEvent("balloonRotate", root, 0, 0, -45) end, false)
addEventHandler("onClientGUIClick", Er, function() triggerServerEvent("balloonRotate", root, 0, 0, -90) end, false)
addEventHandler("onClientGUIClick", Wr, function() triggerServerEvent("balloonRotate", root, 0, 0, 90) end, false)
addEventHandler("onClientGUIClick", TiltUp, function() triggerServerEvent("balloonRotate", root, 3, 0, 0) end, false)
addEventHandler("onClientGUIClick", TiltDown, function() triggerServerEvent("balloonRotate", root, -3, 0, 0) end, false)
addEventHandler("onClientGUIClick", TiltRight, function() triggerServerEvent("balloonRotate", root, 0, 3, 0) end, false)
addEventHandler("onClientGUIClick", TiltLeft, function() triggerServerEvent("balloonRotate", root, 0, -3, 0) end, false)
guiSetVisible (cWindow, false)
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),createGUI)
function openGUI(thePlayer)
if (cWindow ~= nil) then
guiSetVisible(cWindow, true)
showCursor(true)
end
end