jakson Posted June 6, 2019 Share Posted June 6, 2019 هلا شباب كيف حالكم انشاء الله بخير كان عندي مشكله في gui مو راضيه تفتح فا ياريت لو حد يقدر يساعدني فيها كود GUIEditor = { button = {}, window = {}, edit = {}, label = {} } addEvent("showGarage", true) addEventHandler("showGarage", root, function(id, zn, onam, sale, pric, gpk, isown, mapb) gpk2 = gpk setElementData(gpk2, "USE", true) local x, y, z = getElementPosition(gpk2) lcol = createColTube(x, y, z-1, 1, 2) requestHotkey("h", "open garage panel", lcol, id, zn, onam, sale, pric, gpk, isown, mapb) addEventHandler("onClientHotkey", localPlayer, showGarage) addEventHandler("onClientColShapeLeave", lcol, function (p) if p == localPlayer then setElementData(gpk2, "USE", false) removeEventHandler("onClientHotkey", localPlayer, showGarage) destroyElement(source) end end) end ) function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function hideGui() if isElement(GUIEditor.window[1]) then destroyElement(GUIEditor.window[1]) showCursor(false) setElementData(gpk2, "USE", false) setElementFrozen(localPlayer, false) destroyElement(lcol) removeEventHandler("onClientHotkey", localPlayer, showGarage) end end addEvent("hideGarage", true) addEventHandler("hideGarage", root, hideGui) function showGarage(data) local id = data[1] local zn = data[2] local sale = data[3] local pric = data[4] local gpk = data[5] local isown = data[6] local mapb = data[7] gpk2 = gpk local screenW, screenH = guiGetScreenSize() if not isCursorShowing() then showCursor(true) end setElementFrozen(localPlayer, true) GUIEditor.window[1] = guiCreateWindow((screenW - 340) / 2, (screenH - 212) / 2, 340, 212, "Garage System (double-click to close)", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(10, 25, 330, 72, "Garage ID: "..id.." ("..mapb.." maps)\nGarage Location: "..zn.."\nGarage Owner: "..onam.."\nFor Sale: "..sale.."\nGarage Price: "..convertNumber(pric).."$", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.label[2] = guiCreateLabel(0, 92, 498, 15, "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) GUIEditor.label[3] = guiCreateLabel(-1, 87, 498, 15, "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false) GUIEditor.button[1] = guiCreateButton(177, 111, 147, 24, "Set Owner", false, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(9, 145, 158, 26, "Price", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(9, 112, 158, 24, "Toggle Sale", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(9, 178, 158, 24, "Buy Garage", false, GUIEditor.window[1]) GUIEditor.edit[2] = guiCreateEdit(177, 145, 150, 26, "New Owner's Account", false, GUIEditor.window[1]) if not isown then guiSetEnabled(GUIEditor.button[1], false) guiSetEnabled(GUIEditor.button[2], false) guiSetEnabled(GUIEditor.edit[1], false) guiSetEnabled(GUIEditor.edit[2], false) end addEventHandler("onClientGUIClick", GUIEditor.button[3], function () if not (getElementType(source) == "gui-button") then return end if(sale == "Yes" and not isown) then if(getPlayerMoney(localPlayer) > pric) then triggerServerEvent("gAct", localPlayer, "Buy", id, {pric, onam}) hideGui(gpk) end end end) addEventHandler("onClientGUIClick", GUIEditor.button[2], function () if not (getElementType(source) == "gui-button") then return end if(isown) then if sale == "No" then nfs = true else nfs = false end if nfs and tonumber(guiGetText(GUIEditor.edit[1])) ~= nil then triggerServerEvent("gAct", localPlayer, "Sale", id, {nfs, tonumber(guiGetText(GUIEditor.edit[1]))}) hideGui(gpk) elseif(not nfs) then triggerServerEvent("gAct", localPlayer, "Sale", id, {nfs, pric}) hideGui(gpk) end end end) addEventHandler("onClientGUIClick", GUIEditor.button[1], function () if not (getElementType(source) == "gui-button") then return end if(isown and guiGetText(GUIEditor.edit[2]) ~= nil) then triggerServerEvent("gAct", localPlayer, "SetOwner", id, guiGetText(GUIEditor.edit[2])) hideGui(gpk) end end) addEventHandler("onClientGUIDoubleClick", GUIEditor.window[1], function () hideGui(gpk) end) Link to comment
+Source|> Posted June 6, 2019 Share Posted June 6, 2019 (edited) 1 hour ago, jakson said: هلا شباب كيف حالكم انشاء الله بخير كان عندي مشكله في gui مو راضيه تفتح فا ياريت لو حد يقدر يساعدني فيها كود GUIEditor = { button = {}, window = {}, edit = {}, label = {} } addEvent("showGarage", true) addEventHandler("showGarage", root, function(id, zn, onam, sale, pric, gpk, isown, mapb) gpk2 = gpk setElementData(gpk2, "USE", true) local x, y, z = getElementPosition(gpk2) lcol = createColTube(x, y, z-1, 1, 2) requestHotkey("h", "open garage panel", lcol, id, zn, onam, sale, pric, gpk, isown, mapb) addEventHandler("onClientHotkey", localPlayer, showGarage) addEventHandler("onClientColShapeLeave", lcol, function (p) if p == localPlayer then setElementData(gpk2, "USE", false) removeEventHandler("onClientHotkey", localPlayer, showGarage) destroyElement(source) end end) end ) function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function hideGui() if isElement(GUIEditor.window[1]) then destroyElement(GUIEditor.window[1]) showCursor(false) setElementData(gpk2, "USE", false) setElementFrozen(localPlayer, false) destroyElement(lcol) removeEventHandler("onClientHotkey", localPlayer, showGarage) end end addEvent("hideGarage", true) addEventHandler("hideGarage", root, hideGui) function showGarage(data) local id = data[1] local zn = data[2] local sale = data[3] local pric = data[4] local gpk = data[5] local isown = data[6] local mapb = data[7] gpk2 = gpk local screenW, screenH = guiGetScreenSize() if not isCursorShowing() then showCursor(true) end setElementFrozen(localPlayer, true) GUIEditor.window[1] = guiCreateWindow((screenW - 340) / 2, (screenH - 212) / 2, 340, 212, "Garage System (double-click to close)", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(10, 25, 330, 72, "Garage ID: "..id.." ("..mapb.." maps)Garage Location: "..zn.."\nGarage Owner: "..onam.."\nFor Sale: "..sale.."\nGarage Price: "..convertNumber(pric).."$", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.label[2] = guiCreateLabel(0, 92, 498, 15, "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) GUIEditor.label[3] = guiCreateLabel(-1, 87, 498, 15, "---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false) GUIEditor.button[1] = guiCreateButton(177, 111, 147, 24, "Set Owner", false, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(9, 145, 158, 26, "Price", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(9, 112, 158, 24, "Toggle Sale", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(9, 178, 158, 24, "Buy Garage", false, GUIEditor.window[1]) GUIEditor.edit[2] = guiCreateEdit(177, 145, 150, 26, "New Owner's Account", false, GUIEditor.window[1]) if not isown then guiSetEnabled(GUIEditor.button[1], false) guiSetEnabled(GUIEditor.button[2], false) guiSetEnabled(GUIEditor.edit[1], false) guiSetEnabled(GUIEditor.edit[2], false) end addEventHandler("onClientGUIClick", GUIEditor.button[3], function () if not (getElementType(source) == "gui-button") then return end if(sale == "Yes" and not isown) then if(getPlayerMoney(localPlayer) > pric) then triggerServerEvent("gAct", localPlayer, "Buy", id, {pric, onam}) hideGui(gpk) end end end) addEventHandler("onClientGUIClick", GUIEditor.button[2], function () if not (getElementType(source) == "gui-button") then return end if(isown) then if sale == "No" then nfs = true else nfs = false end if nfs and tonumber(guiGetText(GUIEditor.edit[1])) ~= nil then triggerServerEvent("gAct", localPlayer, "Sale", id, {nfs, tonumber(guiGetText(GUIEditor.edit[1]))}) hideGui(gpk) elseif(not nfs) then triggerServerEvent("gAct", localPlayer, "Sale", id, {nfs, pric}) hideGui(gpk) end end end) addEventHandler("onClientGUIClick", GUIEditor.button[1], function () if not (getElementType(source) == "gui-button") then return end if(isown and guiGetText(GUIEditor.edit[2]) ~= nil) then triggerServerEvent("gAct", localPlayer, "SetOwner", id, guiGetText(GUIEditor.edit[2])) hideGui(gpk) end end) addEventHandler("onClientGUIDoubleClick", GUIEditor.window[1], function () hideGui(gpk) end) onClientHotkey ايش ذا ؟ + ناقصك end Edited June 6, 2019 by +Source|> Link to comment
jakson Posted June 6, 2019 Author Share Posted June 6, 2019 (edited) Just now, +Source|> said: onClientHotkey ايش ذا ؟ + ناقصك end و وين ال end الي نقصاني؟ مشكله ظهرت اني لما اجي اشفر gui يظهرلي مشكله ERROR Could not compile file Edited June 6, 2019 by jakson Link to comment
+Source|> Posted June 6, 2019 Share Posted June 6, 2019 34 minutes ago, jakson said: و وين ال end الي نقصاني؟ اخر شي 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now