Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- screenWidth, screenHeight = guiGetScreenSize()
- scale = screenHeight * 4 / 720
- local dashboardDisplaying = false
- currentAnimationStyle = 1
- local animationStyles = {
- [1] = {"OutQuad", 400},
- [2] = {"OutBack", 700},
- [3] = {"OutElastic", 1300}
- }
- local dashboard = {
- canSwapLevel = true,
- alpha = 0,
- animationStartTime = getTickCount(),
- animationEndTime = getTickCount() + 700,
- animationEasingFunction = "OutBack",
- currentLevel = 1,
- viewportProgression = 1,
- lastViewportProgression = 1
- }
- LAST_SELECTED_PLAYER = getLocalPlayer()
- menu = {}
- local tileSize = scale * 25
- local rootMenuItems = {
- {
- name = "Donator",
- img = "img/dashboard/icons/group_full.png",
- fn = "checkDonator",
- args = {}
- },
- {
- name = "Stats",
- img = "img/dashboard/icons/statistics.png",
- fn = "swapLevel",
- args = {"statsMenu"}
- },
- {
- name = "Store",
- img = "img/dashboard/icons/shopping_cart.png",
- fn = "swapLevel",
- args = {"shopMenu"}
- },
- {
- name = "Achievements",
- img = "img/dashboard/icons/star_outline.png",
- fn = "swapLevel",
- args = {
- "achievementsMenu"
- }
- },
- {
- name = "Garage",
- img = "img/dashboard/icons/transportation_car.png",
- fn = "initiateGarage",
- args = {}
- },
- {
- name = "Tasks",
- img = "img/dashboard/icons/flag.png",
- fn = "swapLevel",
- args = {"taskMenu"}
- },
- {
- name = "Settings",
- img = "img/dashboard/icons/settings.png",
- fn = "swapLevel",
- args = {
- "settingsMenu"
- }
- }
- }
- local startingPosition = screenWidth / 2 - (tileSize * #rootMenuItems + tileSize / 20 * #rootMenuItems) / 2 - tileSize
- menu.rootMenu = {}
- menu.rootMenu.tiles = {}
- menu.rootMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- for i, k in ipairs(rootMenuItems) do
- menu.rootMenu.tiles[i] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight / 2 - tileSize / 2, tileSize, tileSize, menu.rootMenu.form)
- flowFormSetTileProperty(menu.rootMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.rootMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.rootMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.rootMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.rootMenu.tiles[i], "image", k.img)
- end
- dx_stats = {
- "Money: $",
- "Exp: ",
- "Skillpoints: ",
- "Total SP earned: ",
- "Wins: ",
- "Maps played: ",
- "Win percent: ",
- "Highest streak: ",
- "Achievements unlocked: ",
- "Tasks completed: ",
- "Times joined: ",
- "Playtime: ",
- "Hunters reached: ",
- "Hunter percent: ",
- "Toptimes taken: ",
- "Rockets fired: ",
- "Kills with Hunter: ",
- "Kills in Shooter/CTF maps: ",
- "Maps bought: ",
- "Times changed vehicle: ",
- "PVP wins: ",
- "DM Maps played: ",
- "DM Wins: ",
- "DM Win percent: ",
- "DD Maps played: ",
- "DD Wins: ",
- "DD Win percent: ",
- "Race Maps played: ",
- "Race Wins: ",
- "Race Win percent: ",
- "CTF Maps played: ",
- "CTF Wins: ",
- "CTF Win percent: ",
- "CTF Flags taken: ",
- "CTF Flags captured: ",
- "Shooter Maps played: ",
- "Shooter Wins: ",
- "Shooter Win percent: "
- }
- menu.statsMenu = {}
- menu.statsMenu.labels = {}
- menu.statsMenu.tiles = {}
- menu.statsMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local innerWidth = screenHeight / 1.4
- menu.statsMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - innerWidth / 2, scale * 40, screenWidth, screenHeight, getPlayerName(getLocalPlayer()), menu.statsMenu.form)
- flowFormSetLabelProperty(menu.statsMenu.labels[1], "colorcoded", true)
- flowFormSetLabelProperty(menu.statsMenu.labels[1], "scale", scale / 2)
- local row = 0
- local numberOfColumns = 2
- for i, k in ipairs(dx_stats) do
- local i = i - 1
- if i - row * #dx_stats / numberOfColumns == #dx_stats / numberOfColumns then
- row = row + 1
- end
- local label = flowFormCreateLabel(screenWidth / 2 - innerWidth / 2 + row * (innerWidth * 1.2 / numberOfColumns), scale * 55 + scale * 4.5 * (i - row * math.floor(#dx_stats / numberOfColumns)), screenWidth, screenHeight, k .. "0", menu.statsMenu.form)
- flowFormSetLabelProperty(label, "scale", scale / 3.1)
- table.insert(menu.statsMenu.labels, label)
- end
- menu.statsMenu.tiles[1] = flowFormCreateTile(screenWidth / 2 - innerWidth / 2, screenHeight - tileSize * 1.5, tileSize, tileSize, menu.statsMenu.form)
- flowFormSetTileProperty(menu.statsMenu.tiles[1], "fn", "swapLevel")
- flowFormSetTileProperty(menu.statsMenu.tiles[1], "args", {
- "[STEP_BACK]"
- })
- flowFormSetTileProperty(menu.statsMenu.tiles[1], "text", "Back")
- flowFormSetTileProperty(menu.statsMenu.tiles[1], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.statsMenu.tiles[1], "image", "img/dashboard/icons/arrow_full_left.png")
- menu.playerSelectionMenu = {}
- menu.playerSelectionMenu.buttons = {}
- menu.playerSelectionMenu.labels = {}
- menu.playerSelectionMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- menu.playerSelectionMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Select a player", scale / 2, "default-bold") / 2, scale * 30, screenWidth, screenHeight, "Select a player", menu.playerSelectionMenu.form)
- flowFormSetLabelProperty(menu.playerSelectionMenu.labels[1], "scale", scale / 2)
- local shopMenuItems = {
- {
- name = "Back",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- },
- {
- name = "Maps",
- img = "img/dashboard/icons/website.png",
- fn = "goToMapMenu",
- args = {}
- },
- {
- name = "Upgrades",
- img = "img/dashboard/icons/transportation_car.png",
- fn = "swapLevel",
- args = {
- "upgradesMenu"
- }
- }
- }
- local startingPosition = screenWidth / 2 - (tileSize * #shopMenuItems + tileSize / 20 * #shopMenuItems) / 2 - tileSize
- menu.shopMenu = {}
- menu.shopMenu.tiles = {}
- menu.shopMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- for i, k in ipairs(shopMenuItems) do
- menu.shopMenu.tiles[i] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight / 2 - tileSize / 2, tileSize, tileSize, menu.shopMenu.form)
- flowFormSetTileProperty(menu.shopMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.shopMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.shopMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.shopMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.shopMenu.tiles[i], "image", k.img)
- end
- menu.mapMainMenu = {}
- menu.mapMainMenu.tiles = {}
- menu.mapMainMenu.fields = {}
- menu.mapMainMenu.labels = {}
- menu.mapMainMenu.lists = {}
- menu.mapMainMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local listWidth = scale * 120
- local listHeight = scale * 90
- local fieldWidth = math.floor(scale * 80)
- local fieldHeight = math.floor(scale * 6)
- menu.mapMainMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Maps", scale / 2, "default-bold") / 2, scale * 15, screenWidth, screenHeight, "Maps", menu.mapMainMenu.form)
- flowFormSetLabelProperty(menu.mapMainMenu.labels[1], "scale", scale / 2)
- menu.mapMainMenu.lists[1] = flowFormCreateList(screenWidth / 2 - listWidth / 2, screenHeight / 2 - listHeight / 2, listWidth, listHeight, menu.mapMainMenu.form)
- flowFormSetListProperty(menu.mapMainMenu.lists[1], "itemHeight", 0.05)
- menu.mapMainMenu.fields[1] = flowFormCreateField(screenWidth / 2 - listWidth / 2, screenHeight / 2 - listHeight / 2 - fieldHeight * 1.5, fieldWidth, fieldHeight, "", menu.mapMainMenu.form)
- flowFormSetFieldProperty(menu.mapMainMenu.fields[1], "scale", math.round(scale / 3, 3))
- flowFormSetFieldProperty(menu.mapMainMenu.fields[1], "ghostText", "Search...")
- flowFormSetFieldProperty(menu.mapMainMenu.fields[1], "useSearchIcon", true)
- local mapMainMenuItems = {
- {
- name = "Back",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local startingPosition = screenWidth / 2 - (tileSize * #mapMainMenuItems + tileSize / 20 * #mapMainMenuItems) / 2 - tileSize
- for i, k in ipairs(mapMainMenuItems) do
- menu.mapMainMenu.tiles[i] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight / 2 + listHeight / 2 + tileSize / 2, tileSize, tileSize, menu.mapMainMenu.form)
- flowFormSetTileProperty(menu.mapMainMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.mapMainMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.mapMainMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.mapMainMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.mapMainMenu.tiles[i], "image", k.img)
- end
- function onServerReturnMapList(mapList, rebuild)
- MAP_LIST_CACHE = mapList
- if rebuild and mapList then
- flowFormListClear(menu.mapMainMenu.lists[1])
- for i, map in ipairs(mapList) do
- flowFormAddListItem(menu.mapMainMenu.lists[1], "mapShopViewMapDetails", {map}, map.name, scale / 4.5, "default-bold")
- end
- end
- end
- callServerFunction("getMapList", getLocalPlayer())
- addEvent("dashboard:getMapList", true)
- addEventHandler("dashboard:getMapList", getRootElement(), function(mapList, rebuild)
- MAP_LIST_CACHE = mapList
- if rebuild and mapList then
- flowFormListClear(menu.mapMainMenu.lists[1])
- for i, map in ipairs(mapList) do
- flowFormAddListItem(menu.mapMainMenu.lists[1], "mapShopViewMapDetails", {map}, map.name, scale / 4.5, "default-bold")
- end
- end
- end)
- addEvent("onFlowFormFieldChange", true)
- addEventHandler("onFlowFormFieldChange", resourceRoot, function(field, text)
- if not MAP_LIST_CACHE then
- return
- end
- if flowFormMatch(field, menu.mapMainMenu.fields[1]) then
- flowFormListClear(menu.mapMainMenu.lists[1])
- local matchingMaps = {}
- if text == "" then
- matchingMaps = MAP_LIST_CACHE
- else
- for i, map in ipairs(MAP_LIST_CACHE) do
- if string.find(map.name:lower(), text:lower()) then
- table.insert(matchingMaps, map)
- end
- end
- end
- if #matchingMaps <= 0 then
- flowFormAddListItem(menu.mapMainMenu.lists[1], nil, nil, "No maps matching your search", scale / 4.5, "default-bold", {
- 255,
- 50,
- 50
- })
- return
- end
- for i, map in ipairs(matchingMaps) do
- flowFormAddListItem(menu.mapMainMenu.lists[1], "mapShopViewMapDetails", {map}, map.name, scale / 4.5, "default-bold")
- end
- end
- end)
- function mapShopViewMapDetails(mapData)
- MAPSHOPDATA.DATA = mapData
- if menu.mapShopMapDetails.labels[1] then
- flowFormDestroyLabel(menu.mapShopMapDetails.labels[1])
- end
- if menu.mapShopMapDetails.labels[2] then
- flowFormDestroyLabel(menu.mapShopMapDetails.labels[2])
- end
- if menu.mapShopMapDetails.labels[3] then
- flowFormDestroyLabel(menu.mapShopMapDetails.labels[3])
- end
- if menu.mapShopMapDetails.labels[4] then
- flowFormDestroyLabel(menu.mapShopMapDetails.labels[4])
- end
- if menu.mapShopMapDetails.labels[5] then
- flowFormDestroyLabel(menu.mapShopMapDetails.labels[5])
- end
- if menu.mapShopMapDetails.labels[6] then
- flowFormDestroyLabel(menu.mapShopMapDetails.labels[6])
- end
- if menu.mapShopMapDetails.labels[7] then
- flowFormDestroyLabel(menu.mapShopMapDetails.labels[7])
- end
- if menu.mapShopMapDetails.labels[8] then
- flowFormDestroyLabel(menu.mapShopMapDetails.labels[8])
- end
- if menu.mapShopMapDetails.labels[9] then
- flowFormDestroyLabel(menu.mapShopMapDetails.labels[9])
- end
- menu.mapShopMapDetails.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(mapData.name, scale / 2, "default-bold") / 2, screenHeight / 3, screenWidth, screenHeight, mapData.name, menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[1], "scale", scale / 2)
- local offsetFromCenter = scale * 4
- menu.mapShopMapDetails.labels[2] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Author:", scale / 2.6, "default-bold") - offsetFromCenter, screenHeight / 2.4, screenWidth, screenHeight, "Author:", menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[2], "scale", scale / 2.6)
- menu.mapShopMapDetails.labels[3] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Times played:", scale / 2.6, "default-bold") - offsetFromCenter, screenHeight / 2.4 + scale * 7, screenWidth, screenHeight, "Times played:", menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[3], "scale", scale / 2.6)
- menu.mapShopMapDetails.labels[4] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Win Ratio:", scale / 2.6, "default-bold") - offsetFromCenter, screenHeight / 2.4 + scale * 14, screenWidth, screenHeight, "Win Ratio:", menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[4], "scale", scale / 2.6)
- menu.mapShopMapDetails.labels[5] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Uploaded on:", scale / 2.6, "default-bold") - offsetFromCenter, screenHeight / 2.4 + scale * 21, screenWidth, screenHeight, "Uploaded on:", menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[5], "scale", scale / 2.6)
- menu.mapShopMapDetails.labels[10] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Price:", scale / 2.6, "default-bold") - offsetFromCenter, screenHeight / 2.4 + scale * 28, screenWidth, screenHeight, "Price:", menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[10], "scale", scale / 2.6)
- menu.mapShopMapDetails.labels[6] = flowFormCreateLabel(screenWidth / 2 + offsetFromCenter, screenHeight / 2.4, screenWidth, screenHeight, mapData.author, menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[6], "scale", scale / 2.6)
- menu.mapShopMapDetails.labels[7] = flowFormCreateLabel(screenWidth / 2 + offsetFromCenter, screenHeight / 2.4 + scale * 7, screenWidth, screenHeight, mapData.timesPlayed, menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[7], "scale", scale / 2.6)
- menu.mapShopMapDetails.labels[8] = flowFormCreateLabel(screenWidth / 2 + offsetFromCenter, screenHeight / 2.4 + scale * 14, screenWidth, screenHeight, mapData.difficulty, menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[8], "scale", scale / 2.6)
- menu.mapShopMapDetails.labels[9] = flowFormCreateLabel(screenWidth / 2 + offsetFromCenter, screenHeight / 2.4 + scale * 21, screenWidth, screenHeight, mapData.timeUploaded, menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[9], "scale", scale / 2.6)
- menu.mapShopMapDetails.labels[11] = flowFormCreateLabel(screenWidth / 2 + offsetFromCenter, screenHeight / 2.4 + scale * 28, screenWidth, screenHeight, "$5000", menu.mapShopMapDetails.form)
- flowFormSetLabelProperty(menu.mapShopMapDetails.labels[11], "scale", scale / 2.6)
- swapLevel("mapShopMapDetails")
- end
- function goToMapMenu()
- if not getElementData(getLocalPlayer(), "dashboard:room") or getElementData(getLocalPlayer(), "dashboard:room") == "BAR_1" then
- exports.xmsg:displayMsg("error", "Map shop is not available in the bar", "Map shop")
- return
- end
- swapLevel("mapMainMenu")
- end
- MAPSHOPDATA = {DATA = nil}
- menu.mapShopMapDetails = {}
- menu.mapShopMapDetails.tiles = {}
- menu.mapShopMapDetails.labels = {}
- menu.mapShopMapDetails.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local mapShopMapDetailsItems = {
- {
- name = "Back",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- },
- {
- name = "Buy map",
- img = "img/dashboard/icons/buy.png",
- fn = "buyMapCall",
- args = {MAPSHOPDATA}
- }
- }
- local startingPosition = screenWidth / 2 - (tileSize * #mapShopMapDetailsItems + tileSize / 20 * #mapShopMapDetailsItems) / 2 - tileSize
- for i, k in ipairs(mapShopMapDetailsItems) do
- menu.mapShopMapDetails.tiles[i] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight / 2 + tileSize, tileSize, tileSize, menu.mapShopMapDetails.form)
- flowFormSetTileProperty(menu.mapShopMapDetails.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.mapShopMapDetails.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.mapShopMapDetails.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.mapShopMapDetails.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.mapShopMapDetails.tiles[i], "image", k.img)
- end
- function buyMapCall(dataPointer)
- local data = dataPointer.DATA
- if not data then
- return
- end
- buyMap(data.name)
- end
- function buildUpgradesMenu(upgradesMenuItems)
- local upgradesTileSize = math.floor(tileSize * 1.9)
- local rows = 2
- local count = 0
- local row = 1
- local startingPosition = screenWidth / 2 - (upgradesTileSize * math.ceil(#upgradesMenuItems / rows) + upgradesTileSize / 20 * math.ceil(#upgradesMenuItems / rows)) / 2 - upgradesTileSize
- menu.upgradesMenu = {}
- menu.upgradesMenu.tiles = {}
- menu.upgradesMenu.form = flowFormCreateForm(screenWidth, 0, screenWidth, screenHeight, false)
- for i, k in ipairs(upgradesMenuItems) do
- count = count + 1
- if count > math.ceil(#upgradesMenuItems / rows) then
- count = 1
- row = row + 1
- end
- menu.upgradesMenu.tiles[i] = flowFormCreateTile(startingPosition + upgradesTileSize * count + upgradesTileSize / 20 * count, screenHeight / 2 - upgradesTileSize * (rows - row) - upgradesTileSize / 20 * (rows - row), upgradesTileSize, upgradesTileSize, menu.upgradesMenu.form)
- flowFormSetTileProperty(menu.upgradesMenu.tiles[i], "fn", "upgradeViewDetails")
- flowFormSetTileProperty(menu.upgradesMenu.tiles[i], "args", {k})
- flowFormSetTileProperty(menu.upgradesMenu.tiles[i], "image", k.img)
- setElementData(menu.upgradesMenu.tiles[i].itemData._gui, "tooltip-text", k.desc, false)
- end
- local items = {
- {
- name = "Back",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local startingPosition = screenWidth / 2 - (tileSize * #items + tileSize / 20 * #items) / 2 - tileSize
- for i, k in ipairs(items) do
- menu.upgradesMenu.tiles[100] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight - tileSize * 1.5, tileSize, tileSize, menu.upgradesMenu.form)
- flowFormSetTileProperty(menu.upgradesMenu.tiles[100], "fn", k.fn)
- flowFormSetTileProperty(menu.upgradesMenu.tiles[100], "args", k.args)
- flowFormSetTileProperty(menu.upgradesMenu.tiles[100], "text", k.name)
- flowFormSetTileProperty(menu.upgradesMenu.tiles[100], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.upgradesMenu.tiles[100], "image", k.img)
- end
- end
- function upgradeViewDetails(upgradeData)
- if not menu.upgradeViewDetailsMenu then
- menu.upgradeViewDetailsMenu = {}
- menu.upgradeViewDetailsMenu.tiles = {}
- menu.upgradeViewDetailsMenu.labels = {}
- menu.upgradeViewDetailsMenu.form = flowFormCreateForm(screenWidth, 0, screenWidth, screenHeight, false)
- end
- if not upgradeData then
- return
- end
- for i, k in pairs(menu.upgradeViewDetailsMenu.tiles) do
- flowFormDestroyTile(k)
- end
- for i, k in pairs(menu.upgradeViewDetailsMenu.labels) do
- flowFormDestroyLabel(k)
- end
- menu.upgradeViewDetailsMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(upgradeData.name, scale / 1.5, "default-bold") / 2, screenHeight / 3.5, screenWidth, screenHeight, upgradeData.name, menu.upgradeViewDetailsMenu.form)
- flowFormSetLabelProperty(menu.upgradeViewDetailsMenu.labels[1], "scale", scale / 1.5)
- menu.upgradeViewDetailsMenu.labels[2] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(upgradeData.desc, scale / 3.8, "default-bold") / 2, screenHeight / 3.5 + scale * 11, screenWidth, screenHeight, upgradeData.desc, menu.upgradeViewDetailsMenu.form)
- flowFormSetLabelProperty(menu.upgradeViewDetailsMenu.labels[2], "scale", scale / 3.8)
- menu.upgradeViewDetailsMenu.labels[7] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Price", scale / 2.3, "default-bold") / 2, screenHeight / 3.5 + scale * 23, screenWidth, screenHeight, "Price", menu.upgradeViewDetailsMenu.form)
- flowFormSetLabelProperty(menu.upgradeViewDetailsMenu.labels[7], "scale", scale / 2.3)
- local offsetFromCenter = scale * 3
- menu.upgradeViewDetailsMenu.labels[3] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Money:", scale / 2.6, "default-bold") - offsetFromCenter, screenHeight / 3.5 + scale * 30, screenWidth, screenHeight, "Money:", menu.upgradeViewDetailsMenu.form)
- flowFormSetLabelProperty(menu.upgradeViewDetailsMenu.labels[3], "scale", scale / 2.6)
- menu.upgradeViewDetailsMenu.labels[4] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Skillpoints:", scale / 2.6, "default-bold") - offsetFromCenter, screenHeight / 3.5 + scale * 36, screenWidth, screenHeight, "Skillpoints:", menu.upgradeViewDetailsMenu.form)
- flowFormSetLabelProperty(menu.upgradeViewDetailsMenu.labels[4], "scale", scale / 2.6)
- menu.upgradeViewDetailsMenu.labels[5] = flowFormCreateLabel(screenWidth / 2 + offsetFromCenter, screenHeight / 3.5 + scale * 30, screenWidth, screenHeight, upgradeData.priceMoney, menu.upgradeViewDetailsMenu.form)
- flowFormSetLabelProperty(menu.upgradeViewDetailsMenu.labels[5], "scale", scale / 2.6)
- menu.upgradeViewDetailsMenu.labels[6] = flowFormCreateLabel(screenWidth / 2 + offsetFromCenter, screenHeight / 3.5 + scale * 36, screenWidth, screenHeight, upgradeData.priceSP, menu.upgradeViewDetailsMenu.form)
- flowFormSetLabelProperty(menu.upgradeViewDetailsMenu.labels[6], "scale", scale / 2.6)
- local hasUpgrade = getElementData(getLocalPlayer(), upgradeData.data) == 1 and true or false
- local items
- if hasUpgrade then
- items = {
- {
- name = "Back",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- },
- {
- name = "Refund",
- img = "img/dashboard/icons/cross.png",
- fn = "buyShopUpgrade",
- args = {upgradeData}
- }
- }
- menu.upgradeViewDetailsMenu.labels[8] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("You already own this item! If you wish to refund it, click the button below", scale / 2.8, "default-bold") / 2, screenHeight / 3.5 + scale * 45, screenWidth, screenHeight, "You already own this item! If you wish to refund it, click the button below", menu.upgradeViewDetailsMenu.form)
- flowFormSetLabelProperty(menu.upgradeViewDetailsMenu.labels[8], "scale", scale / 2.8)
- flowFormSetLabelProperty(menu.upgradeViewDetailsMenu.labels[8], "color", {
- 255,
- 100,
- 100
- })
- else
- items = {
- {
- name = "Back",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- },
- {
- name = "Purchase",
- img = "img/dashboard/icons/buy.png",
- fn = "buyShopUpgrade",
- args = {upgradeData}
- }
- }
- end
- local startingPosition = screenWidth / 2 - (tileSize * #items + tileSize / 20 * #items) / 2 - tileSize
- for i, k in ipairs(items) do
- menu.upgradeViewDetailsMenu.tiles[i] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight / 2 + tileSize, tileSize, tileSize, menu.upgradeViewDetailsMenu.form)
- flowFormSetTileProperty(menu.upgradeViewDetailsMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.upgradeViewDetailsMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.upgradeViewDetailsMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.upgradeViewDetailsMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.upgradeViewDetailsMenu.tiles[i], "image", k.img)
- if hasUpgrade then
- setElementData(menu.upgradeViewDetailsMenu.tiles[i].itemData._gui, "tooltip-text", "Click to refund this item", false)
- end
- end
- swapLevel("upgradeViewDetailsMenu")
- end
- function createAchievementsMenu(achievements)
- if menu.achievementsMenu and menu.achievementsMenu.form then
- flowFormDestroyForm(menu.achievementsMenu.form)
- end
- menu.achievementsMenu = {}
- menu.achievementsMenu.tiles = {}
- menu.achievementsMenu.labels = {}
- menu.achievementsMenu.form = flowFormCreateForm(screenWidth, 0, screenWidth, screenHeight, false)
- local achTileWidth = math.floor(scale * 52)
- local achTileHeight = math.floor(scale * 11.2)
- local achRowSpacing = math.floor(scale * 2)
- local achVerticalSpacing = math.floor(scale * 1.5)
- local totalColumns = 4
- local currentCount = 0
- local currentRow = 1
- local startingPosition = screenWidth / 2 - (achTileWidth * totalColumns + achRowSpacing * totalColumns) / 2 - achTileWidth
- local UNLOCKED_COUNT = 0
- for i, k in ipairs(achievements) do
- currentCount = currentCount + 1
- if currentCount > math.floor(#achievements / totalColumns) then
- currentCount = 1
- currentRow = currentRow + 1
- end
- local isUnlocked = getElementData(getLocalPlayer(), "Ach" .. i) == 1 and true or false
- menu.achievementsMenu.tiles[i] = flowFormCreateTile(startingPosition + achTileWidth * currentRow + achRowSpacing * currentRow, scale * 25 + achTileHeight * currentCount + achVerticalSpacing * currentCount, achTileWidth, achTileHeight, menu.achievementsMenu.form)
- setElementData(menu.achievementsMenu.tiles[i].itemData._gui, "tooltip-text", k[2], false)
- flowFormSetTileProperty(menu.achievementsMenu.tiles[i], "text", k[3])
- flowFormSetTileProperty(menu.achievementsMenu.tiles[i], "scale", scale / 4)
- if isUnlocked then
- UNLOCKED_COUNT = UNLOCKED_COUNT + 1
- flowFormSetTileProperty(menu.achievementsMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.achievementsMenu.tiles[i], "image", "img/achievement_unlocked_overlay.png")
- else
- flowFormSetTileProperty(menu.achievementsMenu.tiles[i], "color", {
- 80,
- 80,
- 80
- })
- flowFormSetTileProperty(menu.achievementsMenu.tiles[i], "image", "img/achievement_locked_overlay.png")
- end
- end
- menu.achievementsMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Achievements", scale / 1.5, "default-bold") / 2, scale * 13, screenWidth, screenHeight, "Achievements", menu.achievementsMenu.form)
- flowFormSetLabelProperty(menu.achievementsMenu.labels[1], "scale", scale / 1.5)
- menu.achievementsMenu.labels[2] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Unlocked " .. UNLOCKED_COUNT .. "/" .. #achievements, scale / 2.2, "default-bold") / 2, scale * 24, screenWidth, screenHeight, "Unlocked " .. UNLOCKED_COUNT .. "/" .. #achievements, menu.achievementsMenu.form)
- flowFormSetLabelProperty(menu.achievementsMenu.labels[2], "scale", scale / 2.2)
- local items = {
- {
- name = "Back",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local startingPosition = screenWidth / 2 - (tileSize * #items + tileSize / 20 * #items) / 2 - tileSize
- for i, k in ipairs(items) do
- menu.achievementsMenu.tiles[100] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight - tileSize * 1.4, tileSize, tileSize, menu.achievementsMenu.form)
- flowFormSetTileProperty(menu.achievementsMenu.tiles[100], "fn", k.fn)
- flowFormSetTileProperty(menu.achievementsMenu.tiles[100], "args", k.args)
- flowFormSetTileProperty(menu.achievementsMenu.tiles[100], "text", k.name)
- flowFormSetTileProperty(menu.achievementsMenu.tiles[100], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.achievementsMenu.tiles[100], "image", k.img)
- end
- ACHIEVEMENTS = achievements
- end
- addEventHandler("onClientResourceStart", resourceRoot, function()
- callServerFunction("clientRequestedAchievements", getLocalPlayer())
- end)
- addEvent("onDashboardLevelChanged", true)
- addEventHandler("onDashboardLevelChanged", getRootElement(), function(oldLevel, newLevel)
- if newLevel == "achievementsMenu" and ACHIEVEMENTS then
- createAchievementsMenu(ACHIEVEMENTS)
- end
- end)
- function initiateGarage()
- garageEnter()
- end
- local garageTileHeight = tileSize / 2
- local garageTileWidth = garageTileHeight * 4
- local items = {
- {
- name = nil,
- img = "img/dashboard/garage/vehicle.png",
- fn = "swapGarageLevel",
- args = {
- "garageVehicleMenu"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/player_skin.png",
- fn = "swapGarageLevel",
- args = {
- "garagePlayerSkinMenu"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/postcard_mode.png",
- fn = "enterPostcardMode",
- args = {}
- },
- {
- name = nil,
- img = "img/dashboard/garage/quit.png",
- fn = "garageLeave",
- args = {}
- }
- }
- local startingPosition = screenWidth / 2 - (garageTileWidth * #items + garageTileWidth / 20 * #items) / 2 - garageTileWidth
- menu.garageMainMenu = {}
- menu.garageMainMenu.tiles = {}
- menu.garageMainMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- for i, k in ipairs(items) do
- menu.garageMainMenu.tiles[i] = flowFormCreateTile(startingPosition + garageTileWidth * i + garageTileWidth / 20 * i, screenHeight - garageTileHeight * 2, garageTileWidth, garageTileHeight, menu.garageMainMenu.form)
- flowFormSetTileProperty(menu.garageMainMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.garageMainMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.garageMainMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.garageMainMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garageMainMenu.tiles[i], "image", k.img)
- end
- local items = {
- {
- name = nil,
- img = "img/dashboard/garage/headlights.png",
- fn = "swapGarageLevel",
- args = {
- "garageHeadlightsMenu"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/lights_style.png",
- fn = "swapGarageLevel",
- args = {
- "garageLightsStyleMenu"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/pick_color.png",
- fn = "swapGarageLevel",
- args = {
- "garageVehicleColorMenu"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/nitro_color.png",
- fn = "swapGarageLevel",
- args = {
- "garageNitroColorMenu"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/rims.png",
- fn = "swapGarageLevel",
- args = {
- "garageRimsMenu"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/vehicle_skin.png",
- fn = "swapGarageLevel",
- args = {
- "garageVehicleSkinMenu"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/swap_vehicle.png",
- fn = "swapGarageLevel",
- args = {
- "garageSwapVehicleMenu"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/back.png",
- fn = "swapGarageLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local rows = 3
- menu.garageVehicleMenu = {}
- menu.garageVehicleMenu.tiles = {}
- menu.garageVehicleMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local startingPosition = screenWidth / 2 - (garageTileWidth * math.ceil(#items / rows) + garageTileWidth / 20 * math.ceil(#items / rows)) / 2 - garageTileWidth
- local count = 0
- local row = 1
- for i, k in ipairs(items) do
- if count >= math.ceil(#items / rows) then
- row = row + 1
- count = 0
- local totalItemsLeft = #items - (row - 1) * math.ceil(#items / rows)
- local totalitemsLeftOnNextRow = totalItemsLeft - math.ceil(#items / rows)
- local itemsDecrement = totalitemsLeftOnNextRow < 0 and totalitemsLeftOnNextRow or 0
- startingPosition = screenWidth / 2 - (garageTileWidth * (math.ceil(#items / rows) + itemsDecrement) + garageTileWidth / 20 * (math.ceil(#items / rows) + itemsDecrement)) / 2 - garageTileWidth
- end
- count = count + 1
- menu.garageVehicleMenu.tiles[i] = flowFormCreateTile(startingPosition + garageTileWidth * count + garageTileWidth / 20 * count, screenHeight - garageTileHeight * 2 - (rows - row) * (garageTileHeight * 1.2), garageTileWidth, garageTileHeight, menu.garageVehicleMenu.form)
- flowFormSetTileProperty(menu.garageVehicleMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.garageVehicleMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.garageVehicleMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.garageVehicleMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garageVehicleMenu.tiles[i], "image", k.img)
- end
- local items = {
- {
- name = nil,
- img = "img/dashboard/garage/accept.png",
- fn = "garageDonePickingColor",
- args = {}
- }
- }
- local rows = 1
- menu.garagePickColorMenu = {}
- menu.garagePickColorMenu.tiles = {}
- menu.garagePickColorMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local startingPosition = screenWidth / 2 - (garageTileWidth * math.ceil(#items / rows) + garageTileWidth / 20 * math.ceil(#items / rows)) / 2 - garageTileWidth
- local count = 0
- local row = 1
- for i, k in ipairs(items) do
- if count >= math.ceil(#items / rows) then
- row = row + 1
- count = 0
- local totalItemsLeft = #items - (row - 1) * math.ceil(#items / rows)
- local totalitemsLeftOnNextRow = totalItemsLeft - math.ceil(#items / rows)
- local itemsDecrement = totalitemsLeftOnNextRow < 0 and totalitemsLeftOnNextRow or 0
- startingPosition = screenWidth / 2 - (garageTileWidth * (math.ceil(#items / rows) + itemsDecrement) + garageTileWidth / 20 * (math.ceil(#items / rows) + itemsDecrement)) / 2 - garageTileWidth
- end
- count = count + 1
- menu.garagePickColorMenu.tiles[i] = flowFormCreateTile(startingPosition + garageTileWidth * count + garageTileWidth / 20 * count, screenHeight - garageTileHeight * 2 - (rows - row) * (garageTileHeight * 1.2), garageTileWidth, garageTileHeight, menu.garagePickColorMenu.form)
- flowFormSetTileProperty(menu.garagePickColorMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.garagePickColorMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.garagePickColorMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.garagePickColorMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garagePickColorMenu.tiles[i], "image", k.img)
- end
- local items = {
- {
- name = nil,
- img = "img/dashboard/garage/pick_color.png",
- fn = "garagePickColor",
- args = {
- "headlights_color"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/back.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local rows = 1
- menu.garageHeadlightsMenu = {}
- menu.garageHeadlightsMenu.tiles = {}
- menu.garageHeadlightsMenu.labels = {}
- menu.garageHeadlightsMenu.strips = {}
- menu.garageHeadlightsMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local startingPosition = screenWidth / 2 - (garageTileWidth * math.ceil(#items / rows) + garageTileWidth / 20 * math.ceil(#items / rows)) / 2 - garageTileWidth
- local count = 0
- local row = 1
- for i, k in ipairs(items) do
- if count >= math.ceil(#items / rows) then
- row = row + 1
- count = 0
- local totalItemsLeft = #items - (row - 1) * math.ceil(#items / rows)
- local totalitemsLeftOnNextRow = totalItemsLeft - math.ceil(#items / rows)
- local itemsDecrement = totalitemsLeftOnNextRow < 0 and totalitemsLeftOnNextRow or 0
- startingPosition = screenWidth / 2 - (garageTileWidth * (math.ceil(#items / rows) + itemsDecrement) + garageTileWidth / 20 * (math.ceil(#items / rows) + itemsDecrement)) / 2 - garageTileWidth
- end
- count = count + 1
- menu.garageHeadlightsMenu.tiles[i] = flowFormCreateTile(startingPosition + garageTileWidth * count + garageTileWidth / 20 * count, screenHeight - garageTileHeight * 2 - (rows - row) * (garageTileHeight * 1.2), garageTileWidth, garageTileHeight, menu.garageHeadlightsMenu.form)
- flowFormSetTileProperty(menu.garageHeadlightsMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.garageHeadlightsMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.garageHeadlightsMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.garageHeadlightsMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garageHeadlightsMenu.tiles[i], "image", k.img)
- end
- local stripItems = {
- {
- text = "Rainbow lights",
- fn = "garageToggleDiscoLights",
- default = 2,
- options = {
- {
- text = "Enabled",
- args = {true}
- },
- {
- text = "Disabled",
- args = {false}
- }
- }
- },
- {
- text = "Custom headlights color",
- fn = "garageToggleHeadlightsColorEnabled",
- default = 2,
- options = {
- {
- text = "Enabled",
- args = {true}
- },
- {
- text = "Disabled",
- args = {false}
- }
- }
- }
- }
- for i, k in ipairs(stripItems) do
- local offsetFromCenter = scale * 4
- local scale = scale / 3
- menu.garageHeadlightsMenu.labels[i] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(k.text, scale, "default-bold") - offsetFromCenter, screenHeight / 2.4 + i * dxGetFontHeight(scale, "default-bold") * 1.5, screenWidth, screenHeight, k.text, menu.garageHeadlightsMenu.form)
- flowFormSetLabelProperty(menu.garageHeadlightsMenu.labels[i], "scale", scale)
- menu.garageHeadlightsMenu.strips[i] = flowFormCreateStrip(screenWidth / 2 + offsetFromCenter, screenHeight / 2.4 + i * dxGetFontHeight(scale, "default-bold") * 1.5, menu.garageHeadlightsMenu.form)
- for x, y in ipairs(k.options) do
- flowFormAddStripItem(menu.garageHeadlightsMenu.strips[i], y.text, "default-bold", scale, k.fn, y.args)
- end
- flowFormStripSetSelected(menu.garageHeadlightsMenu.strips[i], k.default)
- end
- local items = {
- {
- name = nil,
- img = "img/dashboard/garage/primary_color.png",
- fn = "garagePickColor",
- args = {
- "vehicle_color_primary"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/secondary_color.png",
- fn = "garagePickColor",
- args = {
- "vehicle_color_secondary"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/back.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local rows = 1
- menu.garageVehicleColorMenu = {}
- menu.garageVehicleColorMenu.tiles = {}
- menu.garageVehicleColorMenu.labels = {}
- menu.garageVehicleColorMenu.strips = {}
- menu.garageVehicleColorMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local startingPosition = screenWidth / 2 - (garageTileWidth * math.ceil(#items / rows) + garageTileWidth / 20 * math.ceil(#items / rows)) / 2 - garageTileWidth
- local count = 0
- local row = 1
- for i, k in ipairs(items) do
- if count >= math.ceil(#items / rows) then
- row = row + 1
- count = 0
- local totalItemsLeft = #items - (row - 1) * math.ceil(#items / rows)
- local totalitemsLeftOnNextRow = totalItemsLeft - math.ceil(#items / rows)
- local itemsDecrement = totalitemsLeftOnNextRow < 0 and totalitemsLeftOnNextRow or 0
- startingPosition = screenWidth / 2 - (garageTileWidth * (math.ceil(#items / rows) + itemsDecrement) + garageTileWidth / 20 * (math.ceil(#items / rows) + itemsDecrement)) / 2 - garageTileWidth
- end
- count = count + 1
- menu.garageVehicleColorMenu.tiles[i] = flowFormCreateTile(startingPosition + garageTileWidth * count + garageTileWidth / 20 * count, screenHeight - garageTileHeight * 2 - (rows - row) * (garageTileHeight * 1.2), garageTileWidth, garageTileHeight, menu.garageVehicleColorMenu.form)
- flowFormSetTileProperty(menu.garageVehicleColorMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.garageVehicleColorMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.garageVehicleColorMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.garageVehicleColorMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garageVehicleColorMenu.tiles[i], "image", k.img)
- end
- local stripItems = {
- {
- text = "Custom vehicle color",
- fn = "garageToggleVehicleColorEnabled",
- default = 2,
- options = {
- {
- text = "Enabled",
- args = {true}
- },
- {
- text = "Disabled",
- args = {false}
- }
- }
- }
- }
- for i, k in ipairs(stripItems) do
- local offsetFromCenter = scale * 4
- local scale = scale / 3
- menu.garageVehicleColorMenu.labels[i] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(k.text, scale, "default-bold") - offsetFromCenter, screenHeight / 2.4 + i * dxGetFontHeight(scale, "default-bold") * 1.5, screenWidth, screenHeight, k.text, menu.garageVehicleColorMenu.form)
- flowFormSetLabelProperty(menu.garageVehicleColorMenu.labels[i], "scale", scale)
- menu.garageVehicleColorMenu.strips[i] = flowFormCreateStrip(screenWidth / 2 + offsetFromCenter, screenHeight / 2.4 + i * dxGetFontHeight(scale, "default-bold") * 1.5, menu.garageVehicleColorMenu.form)
- for x, y in ipairs(k.options) do
- flowFormAddStripItem(menu.garageVehicleColorMenu.strips[i], y.text, "default-bold", scale, k.fn, y.args)
- end
- flowFormStripSetSelected(menu.garageVehicleColorMenu.strips[i], k.default)
- end
- local items = {
- {
- name = nil,
- img = "img/dashboard/garage/pick_color.png",
- fn = "garagePickColor",
- args = {
- "nitro_color"
- }
- },
- {
- name = nil,
- img = "img/dashboard/garage/back.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local rows = 1
- menu.garageNitroColorMenu = {}
- menu.garageNitroColorMenu.tiles = {}
- menu.garageNitroColorMenu.labels = {}
- menu.garageNitroColorMenu.strips = {}
- menu.garageNitroColorMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local startingPosition = screenWidth / 2 - (garageTileWidth * math.ceil(#items / rows) + garageTileWidth / 20 * math.ceil(#items / rows)) / 2 - garageTileWidth
- local count = 0
- local row = 1
- for i, k in ipairs(items) do
- if count >= math.ceil(#items / rows) then
- row = row + 1
- count = 0
- local totalItemsLeft = #items - (row - 1) * math.ceil(#items / rows)
- local totalitemsLeftOnNextRow = totalItemsLeft - math.ceil(#items / rows)
- local itemsDecrement = totalitemsLeftOnNextRow < 0 and totalitemsLeftOnNextRow or 0
- startingPosition = screenWidth / 2 - (garageTileWidth * (math.ceil(#items / rows) + itemsDecrement) + garageTileWidth / 20 * (math.ceil(#items / rows) + itemsDecrement)) / 2 - garageTileWidth
- end
- count = count + 1
- menu.garageNitroColorMenu.tiles[i] = flowFormCreateTile(startingPosition + garageTileWidth * count + garageTileWidth / 20 * count, screenHeight - garageTileHeight * 2 - (rows - row) * (garageTileHeight * 1.2), garageTileWidth, garageTileHeight, menu.garageNitroColorMenu.form)
- flowFormSetTileProperty(menu.garageNitroColorMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.garageNitroColorMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.garageNitroColorMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.garageNitroColorMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garageNitroColorMenu.tiles[i], "image", k.img)
- end
- local stripItems = {
- {
- text = "Custom nitro color",
- fn = "garageToggleNitroColorEnabled",
- default = 2,
- options = {
- {
- text = "Enabled",
- args = {true}
- },
- {
- text = "Disabled",
- args = {false}
- }
- }
- }
- }
- for i, k in ipairs(stripItems) do
- local offsetFromCenter = scale * 4
- local scale = scale / 3
- menu.garageNitroColorMenu.labels[i] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(k.text, scale, "default-bold") - offsetFromCenter, screenHeight / 2.4 + i * dxGetFontHeight(scale, "default-bold") * 1.5, screenWidth, screenHeight, k.text, menu.garageNitroColorMenu.form)
- flowFormSetLabelProperty(menu.garageNitroColorMenu.labels[i], "scale", scale)
- menu.garageNitroColorMenu.strips[i] = flowFormCreateStrip(screenWidth / 2 + offsetFromCenter, screenHeight / 2.4 + i * dxGetFontHeight(scale, "default-bold") * 1.5, menu.garageNitroColorMenu.form)
- for x, y in ipairs(k.options) do
- flowFormAddStripItem(menu.garageNitroColorMenu.strips[i], y.text, "default-bold", scale, k.fn, y.args)
- end
- flowFormStripSetSelected(menu.garageNitroColorMenu.strips[i], k.default)
- end
- menu.garageRimsMenu = {}
- menu.garageRimsMenu.buttons = {}
- menu.garageRimsMenu.labels = {}
- menu.garageRimsMenu.tiles = {}
- menu.garageRimsMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local buttonWidth = tileSize * 0.7
- local buttonHeight = buttonWidth / 2
- local middleOffset = buttonWidth * 1.7
- menu.garageRimsMenu.buttons[1] = flowFormCreateButton(screenWidth / 2 - middleOffset / 2 - buttonWidth, screenHeight - buttonHeight * 2.5, buttonWidth, buttonHeight, "<", menu.garageRimsMenu.form)
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[1], "colorcoded", false)
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[1], "fn", "garageCycleRims")
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[1], "args", {"prev"})
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[1], "color", {
- 35,
- 35,
- 35
- })
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[1], "scale", scale / 1.5)
- menu.garageRimsMenu.buttons[2] = flowFormCreateButton(screenWidth / 2 + middleOffset / 2, screenHeight - buttonHeight * 2.5, buttonWidth, buttonHeight, ">", menu.garageRimsMenu.form)
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[2], "colorcoded", false)
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[2], "fn", "garageCycleRims")
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[2], "args", {"next"})
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[2], "color", {
- 35,
- 35,
- 35
- })
- flowFormSetButtonProperty(menu.garageRimsMenu.buttons[2], "scale", scale / 1.5)
- local fontScale = scale / 1.2
- menu.garageRimsMenu.labels[1] = flowFormCreateLabel(0, screenHeight - buttonHeight * 2.7, screenWidth, screenHeight, "0/0", menu.garageRimsMenu.form)
- flowFormSetLabelProperty(menu.garageRimsMenu.labels[1], "scale", fontScale)
- flowFormSetLabelProperty(menu.garageRimsMenu.labels[1], "align_horizontal", "center")
- menu.garageRimsMenu.labels[2] = flowFormCreateLabel(0, screenHeight - buttonHeight * 4, screenWidth, screenHeight, "", menu.garageRimsMenu.form)
- flowFormSetLabelProperty(menu.garageRimsMenu.labels[2], "scale", scale / 2)
- flowFormSetLabelProperty(menu.garageRimsMenu.labels[2], "align_horizontal", "center")
- menu.garageRimsMenu.labels[3] = flowFormCreateLabel(0, screenHeight - buttonHeight * 1.2, screenWidth, screenHeight, "Default rims", menu.garageRimsMenu.form)
- flowFormSetLabelProperty(menu.garageRimsMenu.labels[3], "scale", scale / 3)
- flowFormSetLabelProperty(menu.garageRimsMenu.labels[3], "align_horizontal", "center")
- menu.garageRimsMenu.tiles[1] = flowFormCreateTile(screenWidth / 2 - garageTileWidth * 2, screenHeight - buttonHeight * 2.5, garageTileWidth, garageTileHeight, menu.garageRimsMenu.form)
- flowFormSetTileProperty(menu.garageRimsMenu.tiles[1], "fn", "garageAcceptRims")
- flowFormSetTileProperty(menu.garageRimsMenu.tiles[1], "args", {})
- flowFormSetTileProperty(menu.garageRimsMenu.tiles[1], "text", nil)
- flowFormSetTileProperty(menu.garageRimsMenu.tiles[1], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garageRimsMenu.tiles[1], "image", "img/dashboard/garage/accept.png")
- menu.garageVehicleSkinMenu = {}
- menu.garageVehicleSkinMenu.buttons = {}
- menu.garageVehicleSkinMenu.labels = {}
- menu.garageVehicleSkinMenu.tiles = {}
- menu.garageVehicleSkinMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local buttonWidth = tileSize * 0.7
- local buttonHeight = buttonWidth / 2
- local middleOffset = buttonWidth * 1.7
- menu.garageVehicleSkinMenu.buttons[1] = flowFormCreateButton(screenWidth / 2 - middleOffset / 2 - buttonWidth, screenHeight - buttonHeight * 2.5, buttonWidth, buttonHeight, "<", menu.garageVehicleSkinMenu.form)
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[1], "colorcoded", false)
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[1], "fn", "garageCycleVehicleSkin")
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[1], "args", {"prev"})
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[1], "color", {
- 35,
- 35,
- 35
- })
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[1], "scale", scale / 1.5)
- menu.garageVehicleSkinMenu.buttons[2] = flowFormCreateButton(screenWidth / 2 + middleOffset / 2, screenHeight - buttonHeight * 2.5, buttonWidth, buttonHeight, ">", menu.garageVehicleSkinMenu.form)
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[2], "colorcoded", false)
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[2], "fn", "garageCycleVehicleSkin")
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[2], "args", {"next"})
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[2], "color", {
- 35,
- 35,
- 35
- })
- flowFormSetButtonProperty(menu.garageVehicleSkinMenu.buttons[2], "scale", scale / 1.5)
- local fontScale = scale / 1.2
- menu.garageVehicleSkinMenu.labels[1] = flowFormCreateLabel(0, screenHeight - buttonHeight * 2.7, screenWidth, screenHeight, "0/0", menu.garageVehicleSkinMenu.form)
- flowFormSetLabelProperty(menu.garageVehicleSkinMenu.labels[1], "scale", fontScale)
- flowFormSetLabelProperty(menu.garageVehicleSkinMenu.labels[1], "align_horizontal", "center")
- menu.garageVehicleSkinMenu.labels[2] = flowFormCreateLabel(0, screenHeight - buttonHeight * 4, screenWidth, screenHeight, "", menu.garageVehicleSkinMenu.form)
- flowFormSetLabelProperty(menu.garageVehicleSkinMenu.labels[2], "scale", scale / 2)
- flowFormSetLabelProperty(menu.garageVehicleSkinMenu.labels[2], "align_horizontal", "center")
- menu.garageVehicleSkinMenu.labels[3] = flowFormCreateLabel(0, screenHeight - buttonHeight * 1.2, screenWidth, screenHeight, "Default vehicle skin", menu.garageVehicleSkinMenu.form)
- flowFormSetLabelProperty(menu.garageVehicleSkinMenu.labels[3], "scale", scale / 3)
- flowFormSetLabelProperty(menu.garageVehicleSkinMenu.labels[3], "align_horizontal", "center")
- menu.garageVehicleSkinMenu.tiles[1] = flowFormCreateTile(screenWidth / 2 - garageTileWidth * 2, screenHeight - buttonHeight * 2.5, garageTileWidth, garageTileHeight, menu.garageVehicleSkinMenu.form)
- flowFormSetTileProperty(menu.garageVehicleSkinMenu.tiles[1], "fn", "garageAcceptVehicleSkin")
- flowFormSetTileProperty(menu.garageVehicleSkinMenu.tiles[1], "args", {})
- flowFormSetTileProperty(menu.garageVehicleSkinMenu.tiles[1], "text", nil)
- flowFormSetTileProperty(menu.garageVehicleSkinMenu.tiles[1], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garageVehicleSkinMenu.tiles[1], "image", "img/dashboard/garage/accept.png")
- menu.garageSwapVehicleMenu = {}
- menu.garageSwapVehicleMenu.tiles = {}
- menu.garageSwapVehicleMenu.fields = {}
- menu.garageSwapVehicleMenu.labels = {}
- menu.garageSwapVehicleMenu.lists = {}
- menu.garageSwapVehicleMenu.form = flowFormCreateForm(screenWidth, 0, screenWidth, screenHeight, false)
- local listWidth = scale * 120
- local listHeight = scale * 90
- local fieldWidth = math.floor(scale * 80)
- local fieldHeight = math.floor(scale * 6)
- menu.garageSwapVehicleMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Available vehicles", scale / 2, "default-bold") / 2, scale * 15, screenWidth, screenHeight, "Available vehicles", menu.garageSwapVehicleMenu.form)
- flowFormSetLabelProperty(menu.garageSwapVehicleMenu.labels[1], "scale", scale / 2)
- menu.garageSwapVehicleMenu.lists[1] = flowFormCreateList(screenWidth / 2 - listWidth / 2, screenHeight / 2 - listHeight / 2, listWidth, listHeight, menu.garageSwapVehicleMenu.form)
- flowFormSetListProperty(menu.garageSwapVehicleMenu.lists[1], "itemHeight", 0.05)
- flowFormSetListProperty(menu.garageSwapVehicleMenu.lists[1], "color", {
- 70,
- 70,
- 70
- })
- flowFormSetListProperty(menu.garageSwapVehicleMenu.lists[1], "listBackgroundMultiplier", 2)
- menu.garageSwapVehicleMenu.fields[1] = flowFormCreateField(screenWidth / 2 - listWidth / 2, screenHeight / 2 - listHeight / 2 - fieldHeight * 1.5, fieldWidth, fieldHeight, "", menu.garageSwapVehicleMenu.form)
- flowFormSetFieldProperty(menu.garageSwapVehicleMenu.fields[1], "scale", math.round(scale / 3, 3))
- flowFormSetFieldProperty(menu.garageSwapVehicleMenu.fields[1], "ghostText", "Search...")
- flowFormSetFieldProperty(menu.garageSwapVehicleMenu.fields[1], "useSearchIcon", true)
- addEventHandler("onClientResourceStart", resourceRoot, function()
- for i, k in ipairs(garageVehiclesList) do
- flowFormAddListItem(menu.garageSwapVehicleMenu.lists[1], "garageSwapVehicle", {k}, getVehicleNameFromModel(k), scale / 4.5, "default-bold")
- end
- end)
- local items = {
- {
- name = nil,
- img = "img/dashboard/garage/back.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local rows = 1
- local startingPosition = screenWidth / 2 - (garageTileWidth * math.ceil(#items / rows) + garageTileWidth / 20 * math.ceil(#items / rows)) / 2 - garageTileWidth
- local count = 0
- local row = 1
- for i, k in ipairs(items) do
- if count >= math.ceil(#items / rows) then
- row = row + 1
- count = 0
- local totalItemsLeft = #items - (row - 1) * math.ceil(#items / rows)
- local totalitemsLeftOnNextRow = totalItemsLeft - math.ceil(#items / rows)
- local itemsDecrement = totalitemsLeftOnNextRow < 0 and totalitemsLeftOnNextRow or 0
- startingPosition = screenWidth / 2 - (garageTileWidth * (math.ceil(#items / rows) + itemsDecrement) + garageTileWidth / 20 * (math.ceil(#items / rows) + itemsDecrement)) / 2 - garageTileWidth
- end
- count = count + 1
- menu.garageSwapVehicleMenu.tiles[i] = flowFormCreateTile(startingPosition + garageTileWidth * count + garageTileWidth / 20 * count, screenHeight - garageTileHeight * 2 - (rows - row) * (garageTileHeight * 1.2), garageTileWidth, garageTileHeight, menu.garageSwapVehicleMenu.form)
- flowFormSetTileProperty(menu.garageSwapVehicleMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.garageSwapVehicleMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.garageSwapVehicleMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.garageSwapVehicleMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garageSwapVehicleMenu.tiles[i], "image", k.img)
- end
- addEvent("onFlowFormFieldChange", true)
- addEventHandler("onFlowFormFieldChange", resourceRoot, function(field, text)
- if flowFormMatch(field, menu.garageSwapVehicleMenu.fields[1]) then
- flowFormListClear(menu.garageSwapVehicleMenu.lists[1])
- local matchingVehicles = {}
- if text == "" then
- matchingVehicles = garageVehiclesList
- else
- for i, veh in ipairs(garageVehiclesList) do
- if string.find(getVehicleNameFromModel(veh):lower(), text:lower()) then
- table.insert(matchingVehicles, veh)
- end
- end
- end
- if #matchingVehicles <= 0 then
- flowFormAddListItem(menu.garageSwapVehicleMenu.lists[1], nil, nil, "No vehicles matching your search", scale / 4.5, "default-bold", {
- 255,
- 50,
- 50
- })
- return
- end
- for i, veh in ipairs(matchingVehicles) do
- flowFormAddListItem(menu.garageSwapVehicleMenu.lists[1], "garageSwapVehicle", {veh}, getVehicleNameFromModel(veh), scale / 4.5, "default-bold")
- end
- end
- end)
- menu.garageLightsStyleMenu = {}
- menu.garageLightsStyleMenu.buttons = {}
- menu.garageLightsStyleMenu.labels = {}
- menu.garageLightsStyleMenu.tiles = {}
- menu.garageLightsStyleMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local buttonWidth = tileSize * 0.7
- local buttonHeight = buttonWidth / 2
- local middleOffset = buttonWidth * 1.7
- menu.garageLightsStyleMenu.buttons[1] = flowFormCreateButton(screenWidth / 2 - middleOffset / 2 - buttonWidth, screenHeight - buttonHeight * 2.5, buttonWidth, buttonHeight, "<", menu.garageLightsStyleMenu.form)
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[1], "colorcoded", false)
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[1], "fn", "garageCycleLightsStyle")
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[1], "args", {"prev"})
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[1], "color", {
- 35,
- 35,
- 35
- })
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[1], "scale", scale / 1.5)
- menu.garageLightsStyleMenu.buttons[2] = flowFormCreateButton(screenWidth / 2 + middleOffset / 2, screenHeight - buttonHeight * 2.5, buttonWidth, buttonHeight, ">", menu.garageLightsStyleMenu.form)
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[2], "colorcoded", false)
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[2], "fn", "garageCycleLightsStyle")
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[2], "args", {"next"})
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[2], "color", {
- 35,
- 35,
- 35
- })
- flowFormSetButtonProperty(menu.garageLightsStyleMenu.buttons[2], "scale", scale / 1.5)
- local fontScale = scale / 1.2
- menu.garageLightsStyleMenu.labels[1] = flowFormCreateLabel(0, screenHeight - buttonHeight * 2.7, screenWidth, screenHeight, "0/0", menu.garageLightsStyleMenu.form)
- flowFormSetLabelProperty(menu.garageLightsStyleMenu.labels[1], "scale", fontScale)
- flowFormSetLabelProperty(menu.garageLightsStyleMenu.labels[1], "align_horizontal", "center")
- menu.garageLightsStyleMenu.labels[2] = flowFormCreateLabel(0, screenHeight - buttonHeight * 4, screenWidth, screenHeight, "", menu.garageLightsStyleMenu.form)
- flowFormSetLabelProperty(menu.garageLightsStyleMenu.labels[2], "scale", scale / 2)
- flowFormSetLabelProperty(menu.garageLightsStyleMenu.labels[2], "align_horizontal", "center")
- menu.garageLightsStyleMenu.labels[3] = flowFormCreateLabel(0, screenHeight - buttonHeight * 1.2, screenWidth, screenHeight, "Default lights", menu.garageLightsStyleMenu.form)
- flowFormSetLabelProperty(menu.garageLightsStyleMenu.labels[3], "scale", scale / 3)
- flowFormSetLabelProperty(menu.garageLightsStyleMenu.labels[3], "align_horizontal", "center")
- menu.garageLightsStyleMenu.tiles[1] = flowFormCreateTile(screenWidth / 2 - garageTileWidth * 2, screenHeight - buttonHeight * 2.5, garageTileWidth, garageTileHeight, menu.garageLightsStyleMenu.form)
- flowFormSetTileProperty(menu.garageLightsStyleMenu.tiles[1], "fn", "garageAcceptLightsStyle")
- flowFormSetTileProperty(menu.garageLightsStyleMenu.tiles[1], "args", {})
- flowFormSetTileProperty(menu.garageLightsStyleMenu.tiles[1], "text", nil)
- flowFormSetTileProperty(menu.garageLightsStyleMenu.tiles[1], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garageLightsStyleMenu.tiles[1], "image", "img/dashboard/garage/accept.png")
- menu.garagePlayerSkinMenu = {}
- menu.garagePlayerSkinMenu.buttons = {}
- menu.garagePlayerSkinMenu.labels = {}
- menu.garagePlayerSkinMenu.tiles = {}
- menu.garagePlayerSkinMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- local buttonWidth = tileSize * 0.7
- local buttonHeight = buttonWidth / 2
- local middleOffset = buttonWidth * 1.7
- menu.garagePlayerSkinMenu.buttons[1] = flowFormCreateButton(screenWidth / 2 - middleOffset / 2 - buttonWidth, screenHeight - buttonHeight * 2.5, buttonWidth, buttonHeight, "<", menu.garagePlayerSkinMenu.form)
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[1], "colorcoded", false)
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[1], "fn", "garageCyclePlayerSkin")
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[1], "args", {"prev"})
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[1], "color", {
- 35,
- 35,
- 35
- })
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[1], "scale", scale / 1.5)
- menu.garagePlayerSkinMenu.buttons[2] = flowFormCreateButton(screenWidth / 2 + middleOffset / 2, screenHeight - buttonHeight * 2.5, buttonWidth, buttonHeight, ">", menu.garagePlayerSkinMenu.form)
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[2], "colorcoded", false)
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[2], "fn", "garageCyclePlayerSkin")
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[2], "args", {"next"})
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[2], "color", {
- 35,
- 35,
- 35
- })
- flowFormSetButtonProperty(menu.garagePlayerSkinMenu.buttons[2], "scale", scale / 1.5)
- local fontScale = scale / 1.7
- menu.garagePlayerSkinMenu.labels[1] = flowFormCreateLabel(0, screenHeight - buttonHeight * 2.7, screenWidth, screenHeight, "0/0", menu.garagePlayerSkinMenu.form)
- flowFormSetLabelProperty(menu.garagePlayerSkinMenu.labels[1], "scale", fontScale)
- flowFormSetLabelProperty(menu.garagePlayerSkinMenu.labels[1], "align_horizontal", "center")
- menu.garagePlayerSkinMenu.labels[2] = flowFormCreateLabel(0, screenHeight - buttonHeight * 4, screenWidth, screenHeight, "", menu.garagePlayerSkinMenu.form)
- flowFormSetLabelProperty(menu.garagePlayerSkinMenu.labels[2], "scale", scale / 2)
- flowFormSetLabelProperty(menu.garagePlayerSkinMenu.labels[2], "align_horizontal", "center")
- menu.garagePlayerSkinMenu.labels[3] = flowFormCreateLabel(0, screenHeight - buttonHeight * 1.2, screenWidth, screenHeight, "Default skin", menu.garagePlayerSkinMenu.form)
- flowFormSetLabelProperty(menu.garagePlayerSkinMenu.labels[3], "scale", scale / 3)
- flowFormSetLabelProperty(menu.garagePlayerSkinMenu.labels[3], "align_horizontal", "center")
- menu.garagePlayerSkinMenu.tiles[1] = flowFormCreateTile(screenWidth / 2 - garageTileWidth * 2, screenHeight - buttonHeight * 2.5, garageTileWidth, garageTileHeight, menu.garagePlayerSkinMenu.form)
- flowFormSetTileProperty(menu.garagePlayerSkinMenu.tiles[1], "fn", "garageAcceptPlayerSkin")
- flowFormSetTileProperty(menu.garagePlayerSkinMenu.tiles[1], "args", {})
- flowFormSetTileProperty(menu.garagePlayerSkinMenu.tiles[1], "text", nil)
- flowFormSetTileProperty(menu.garagePlayerSkinMenu.tiles[1], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.garagePlayerSkinMenu.tiles[1], "image", "img/dashboard/garage/accept.png")
- function constructTaskMenu()
- if menu.taskMenu then
- flowFormDestroyForm(menu.taskMenu.form)
- menu.taskMenu = nil
- end
- menu.taskMenu = {}
- menu.taskMenu.tiles = {}
- menu.taskMenu.labels = {}
- menu.taskMenu.bars = {}
- menu.taskMenu.form = flowFormCreateForm(screenWidth, 0, screenWidth, screenHeight, false)
- local taskMenuItems = {
- {
- name = "Back",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- if getElementData(getLocalPlayer(), "TaskActive") == 1 then
- if TASK_DATA then
- menu.taskMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Current Task", scale / 1.5, "default-bold") / 2, scale * 17, screenWidth, screenHeight, "Current Task", menu.taskMenu.form)
- flowFormSetLabelProperty(menu.taskMenu.labels[1], "scale", scale / 1.5)
- local difficulty = "#00DD00Easy - 1 SP"
- if TASK_DATA.difficulty == 2 then
- difficulty = "#00AAFFMedium - 2 SP"
- elseif TASK_DATA.difficulty == 3 then
- difficulty = "#FF4400Hard - 3 SP"
- end
- menu.taskMenu.labels[3] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(TASK_DATA.text1, scale / 1.5, "default-bold") / 2, scale * 76, screenWidth, screenHeight, TASK_DATA.text1, menu.taskMenu.form)
- flowFormSetLabelProperty(menu.taskMenu.labels[3], "scale", scale / 1.5)
- menu.taskMenu.labels[4] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(difficulty:gsub("#%x%x%x%x%x%x", ""), scale / 2, "default-bold") / 2, scale * 87, screenWidth, screenHeight, difficulty, menu.taskMenu.form)
- flowFormSetLabelProperty(menu.taskMenu.labels[4], "scale", scale / 2)
- flowFormSetLabelProperty(menu.taskMenu.labels[4], "colorcoded", true)
- menu.taskMenu.labels[5] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(TASK_DATA.text2, scale / 2.8, "default-bold") / 2, scale * 109.2, screenWidth, screenHeight, TASK_DATA.text2, menu.taskMenu.form)
- flowFormSetLabelProperty(menu.taskMenu.labels[5], "scale", scale / 2.8)
- local width = scale * 140
- local height = scale * 7
- menu.taskMenu.bars[1] = flowFormCreateProgressBar(screenWidth / 2 - width / 2, screenHeight - height * 9, width, height, menu.taskMenu.form)
- flowFormSetProgressBarProperty(menu.taskMenu.bars[1], "scale", scale / 2.4)
- flowFormSetProgressBarProperty(menu.taskMenu.bars[1], "textcolor", {
- 255,
- 255,
- 255
- })
- if TASK_DATA.progress == 0 then
- flowFormSetProgressBarProperty(menu.taskMenu.bars[1], "progress", 0)
- else
- flowFormSetProgressBarProperty(menu.taskMenu.bars[1], "progress", 100 / TASK_DATA.target * TASK_DATA.progress / 100)
- end
- table.insert(taskMenuItems, {
- name = "Abandon Task",
- img = "img/dashboard/icons/cross.png",
- fn = "swapLevel",
- args = {
- "abandonTaskMenu"
- }
- })
- end
- else
- menu.taskMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Tasks", scale / 1.5, "default-bold") / 2, scale * 17, screenWidth, screenHeight, "Tasks", menu.taskMenu.form)
- flowFormSetLabelProperty(menu.taskMenu.labels[1], "scale", scale / 1.5)
- menu.taskMenu.labels[2] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("You do not have an active Task at the moment", scale / 2.5, "default-bold") / 2, scale * 75, screenWidth, screenHeight, "You do not have an active Task at the moment", menu.taskMenu.form)
- flowFormSetLabelProperty(menu.taskMenu.labels[2], "scale", scale / 2.5)
- menu.taskMenu.labels[3] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Click the \"New Task\" button below to get a new Task", scale / 2.5, "default-bold") / 2, scale * 83, screenWidth, screenHeight, "Click the \"New Task\" button below to get a new Task", menu.taskMenu.form)
- flowFormSetLabelProperty(menu.taskMenu.labels[3], "scale", scale / 2.5)
- table.insert(taskMenuItems, {
- name = "New Task",
- img = "img/dashboard/icons/flag.png",
- fn = "swapLevel",
- args = {
- "newTaskMenu"
- }
- })
- end
- local startingPosition = screenWidth / 2 - (tileSize * #taskMenuItems + tileSize / 20 * #taskMenuItems) / 2 - tileSize
- for i, k in ipairs(taskMenuItems) do
- menu.taskMenu.tiles[i] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight / 2 + listHeight / 2 + tileSize / 2, tileSize, tileSize, menu.taskMenu.form)
- flowFormSetTileProperty(menu.taskMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.taskMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.taskMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.taskMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.taskMenu.tiles[i], "image", k.img)
- end
- end
- menu.newTaskMenu = {}
- menu.newTaskMenu.tiles = {}
- menu.newTaskMenu.labels = {}
- menu.newTaskMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- menu.newTaskMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Select Difficulty", scale / 1.5, "default-bold") / 2, scale * 35, screenWidth, screenHeight, "Select Difficulty", menu.newTaskMenu.form)
- flowFormSetLabelProperty(menu.newTaskMenu.labels[1], "scale", scale / 1.5)
- local newTaskMenuItems = {
- {
- name = nil,
- img = "img/task-easy.png",
- fn = "startNewTask",
- args = {1}
- },
- {
- name = nil,
- img = "img/task-medium.png",
- fn = "startNewTask",
- args = {2}
- },
- {
- name = nil,
- img = "img/task-hard.png",
- fn = "startNewTask",
- args = {3}
- }
- }
- local taskTileWidth = math.floor(tileSize * 4)
- local taskTileHeight = math.floor(taskTileWidth / 4)
- for i, k in ipairs(newTaskMenuItems) do
- menu.newTaskMenu.tiles[i] = flowFormCreateTile(screenWidth / 2 - taskTileWidth / 2, scale * 30 + taskTileHeight * 1.1 * i, taskTileWidth, taskTileHeight, menu.newTaskMenu.form)
- flowFormSetTileProperty(menu.newTaskMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.newTaskMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.newTaskMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.newTaskMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.newTaskMenu.tiles[i], "image", k.img)
- end
- menu.abandonTaskMenu = {}
- menu.abandonTaskMenu.tiles = {}
- menu.abandonTaskMenu.labels = {}
- menu.abandonTaskMenu.form = flowFormCreateForm(0, 0, screenWidth, screenHeight, false)
- menu.abandonTaskMenu.labels[1] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth("Do you wish to abandon your current task?", scale / 1.5, "default-bold") / 2, scale * 38, screenWidth, screenHeight, "Do you wish to abandon your current task?", menu.abandonTaskMenu.form)
- flowFormSetLabelProperty(menu.abandonTaskMenu.labels[1], "scale", scale / 1.5)
- local text = "If you don't like your current Task, you can abandon it and get a new one"
- menu.abandonTaskMenu.labels[2] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), scale / 2.5, "default-bold") / 2, scale * 60, screenWidth, screenHeight, text, menu.abandonTaskMenu.form)
- flowFormSetLabelProperty(menu.abandonTaskMenu.labels[2], "scale", scale / 2.5)
- local text = "To abandon a Task, you need to pay a fee of #FF8C00$20,000"
- menu.abandonTaskMenu.labels[3] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), scale / 2.5, "default-bold") / 2, scale * 60 + scale * 6, screenWidth, screenHeight, text, menu.abandonTaskMenu.form)
- flowFormSetLabelProperty(menu.abandonTaskMenu.labels[3], "scale", scale / 2.5)
- flowFormSetLabelProperty(menu.abandonTaskMenu.labels[3], "colorcoded", true)
- local text = "All progress you made so far will be lost!"
- menu.abandonTaskMenu.labels[4] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), scale / 2.5, "default-bold") / 2, scale * 60 + scale * 15, screenWidth, screenHeight, text, menu.abandonTaskMenu.form)
- flowFormSetLabelProperty(menu.abandonTaskMenu.labels[4], "scale", scale / 2.5)
- local abandonTaskMenuItems = {
- {
- name = nil,
- img = "img/task-abandon.png",
- fn = "abandonCurrentTask",
- args = {}
- },
- {
- name = nil,
- img = "img/task-continue.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local taskTileWidth = math.floor(tileSize * 4)
- local taskTileHeight = math.floor(taskTileWidth / 4)
- for i, k in ipairs(abandonTaskMenuItems) do
- menu.abandonTaskMenu.tiles[i] = flowFormCreateTile(screenWidth / 2 - taskTileWidth / 2, scale * 70 + taskTileHeight * 1.1 * i, taskTileWidth, taskTileHeight, menu.abandonTaskMenu.form)
- flowFormSetTileProperty(menu.abandonTaskMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.abandonTaskMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.abandonTaskMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.abandonTaskMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.abandonTaskMenu.tiles[i], "image", k.img)
- end
- local yFix = 70
- function constructSettingsMenu()
- if menu.settingsMenu and menu.settingsMenu.form then
- flowFormDestroyForm(menu.settingsMenu.form)
- end
- menu.settingsMenu = {}
- menu.settingsMenu.tiles = {}
- menu.settingsMenu.labels = {}
- menu.settingsMenu.strips = {}
- menu.settingsMenu.form = flowFormCreateForm(screenWidth, 0, screenWidth, screenHeight, false)
- local settingsMenuItems = {
- {
- name = "Accept",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- }
- }
- local startingPosition = screenWidth / 2 - (tileSize * #settingsMenuItems + tileSize / 20 * #settingsMenuItems) / 2 - tileSize
- for i, k in ipairs(settingsMenuItems) do
- menu.settingsMenu.tiles[i] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight - tileSize * 1.6, tileSize, tileSize, menu.settingsMenu.form)
- flowFormSetTileProperty(menu.settingsMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.settingsMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.settingsMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.settingsMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.settingsMenu.tiles[i], "image", k.img)
- end
- for i, k in ipairs(SETTINGS_LIST) do
- if k.text then
- local offsetFromCenter = scale * 4
- local scale = scale / 3
- menu.settingsMenu.labels[i] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(k.text, scale, "default-bold") - offsetFromCenter, scale * 80 + i * dxGetFontHeight(scale, "default-bold") * 1.5 - yFix, screenWidth, screenHeight, k.text, menu.settingsMenu.form)
- flowFormSetLabelProperty(menu.settingsMenu.labels[i], "scale", scale)
- menu.settingsMenu.strips[i] = flowFormCreateStrip(screenWidth / 2 + offsetFromCenter, scale * 80 + i * dxGetFontHeight(scale, "default-bold") * 1.5 - yFix, menu.settingsMenu.form)
- for x, y in ipairs(k.options) do
- flowFormAddStripItem(menu.settingsMenu.strips[i], y[1], "default-bold", scale, "saveSetting", {
- k.data,
- y[2]
- })
- end
- if SETTINGS[k.data] then
- flowFormStripSetSelected(menu.settingsMenu.strips[i], SETTINGS[k.data])
- else
- flowFormStripSetSelected(menu.settingsMenu.strips[i], k.default)
- end
- end
- end
- end
- for i, thisMenu in pairs(menu) do
- flowFormSetPosition(thisMenu.form, screenWidth, 0)
- flowFormSetProperty(thisMenu.form, "visible", false)
- flowFormSetProperty(thisMenu.form, "alpha", 0)
- end
- function preRenderDashboardOperations()
- if dashboard.alpha <= 0 then
- for i, thisMenu in pairs(menu) do
- flowFormSetPosition(thisMenu.form, screenWidth, 0)
- flowFormSetProperty(thisMenu.form, "visible", false)
- end
- return
- end
- local now = getTickCount()
- local elapsedTime = now - dashboard.animationStartTime
- local duration = dashboard.animationEndTime - dashboard.animationStartTime
- local progress = elapsedTime / duration
- if now > dashboard.animationEndTime then
- progress = 1
- end
- if dashboard.animationEasingFunction == "OutBack" then
- fAnimationTime = getEasingValue(progress, dashboard.animationEasingFunction, 0, 0, 1)
- elseif dashboard.animationEasingFunction == "OutElastic" then
- fAnimationTime = getEasingValue(progress, dashboard.animationEasingFunction, 0.35, 1)
- else
- fAnimationTime = getEasingValue(progress, dashboard.animationEasingFunction)
- end
- local addition = (dashboard.currentLevel - dashboard.lastViewportProgression) * fAnimationTime
- dashboard.viewportProgression = dashboard.lastViewportProgression + addition
- local levelsOnScreen = {}
- for i, thisMenu in pairs(menu) do
- local match = false
- for x, level in ipairs(menuLevels) do
- if level == i then
- match = {x, level}
- end
- end
- if match then
- flowFormSetProperty(menu[match[2]].form, "visible", true)
- flowFormSetProperty(menu[match[2]].form, "alpha", dashboard.alpha)
- flowFormSetPosition(menu[match[2]].form, screenWidth * (match[1] - 1), 0)
- table.insert(levelsOnScreen, match[1], menu[match[2]])
- else
- flowFormSetProperty(menu[i].form, "alpha", 0)
- flowFormSetProperty(menu[i].form, "visible", false)
- end
- end
- for i, level in pairs(levelsOnScreen) do
- local px, py = flowFormGetPosition(level.form)
- if px then
- px = px - screenWidth * (dashboard.viewportProgression - 1)
- flowFormSetPosition(level.form, px, py)
- end
- end
- for i, level in pairs(levelsOnScreen) do
- local px, py = flowFormGetPosition(level.form)
- if px then
- local levelOffset = math.abs(px) / (screenWidth * 1.5)
- local levelAlpha = math.min(math.max(dashboard.alpha - dashboard.alpha * levelOffset, 0), dashboard.alpha)
- flowFormSetProperty(level.form, "alpha", levelAlpha)
- if levelAlpha <= 0 then
- flowFormSetProperty(level.form, "visible", false)
- else
- flowFormSetProperty(level.form, "visible", true)
- end
- end
- end
- end
- addEventHandler("onClientPreRender", getRootElement(), preRenderDashboardOperations)
- function drawPanel()
- if dashboardDisplaying == false then
- dashboard.alpha = math.max(dashboard.alpha - 14, 0)
- if dashboard.alpha == 0 then
- dashboard.currentLevel = 1
- dashboard.viewportProgression = 1
- for i, thisMenu in pairs(menu) do
- flowFormSetProperty(thisMenu.form, "alpha", 0)
- flowFormSetProperty(thisMenu.form, "visible", false)
- end
- end
- return false
- else
- dashboard.alpha = math.min(dashboard.alpha + 14, 255)
- end
- if dashboard.alpha > 0 and not IN_GARAGE then
- dxDrawRectangle(0, 0, screenWidth, screenHeight, tocolor(0, 0, 0, dashboard.alpha / 2))
- local imgW = scale * 95
- local imgH = imgW / 4
- local px, py = flowFormGetProperty(menu.rootMenu.form, "posX"), flowFormGetProperty(menu.rootMenu.form, "posY")
- dxDrawImage(px + screenWidth / 2 - imgW / 2, py + screenHeight / 2 - imgH * 1.7, imgW, imgH, "img/dashboard.png", 0, 0, 0, tocolor(255, 255, 255, flowFormGetProperty(menu.rootMenu.form, "alpha")))
- dxDrawText("Dashboard created by Rointep aka Nextreme @ Zur.io", screenWidth / 2, screenHeight - 10)
- end
- end
- addEventHandler("onClientRender", getRootElement(), drawPanel)
- menuLevels = {
- [1] = "rootMenu"
- }
- function swapLevel(level)
- if dashboard.canSwapLevel == false then
- return
- end
- local oldLevel = ""
- local newLevel = ""
- dashboard.lastViewportProgression = dashboard.viewportProgression
- if level == "[STEP_BACK]" then
- oldLevel = menuLevels[dashboard.currentLevel]
- newLevel = menuLevels[math.max(dashboard.currentLevel - 1, 1)]
- dashboard.currentLevel = math.max(dashboard.currentLevel - 1, 1)
- else
- oldLevel = menuLevels[dashboard.currentLevel]
- newLevel = level
- dashboard.currentLevel = dashboard.currentLevel + 1
- menuLevels[dashboard.currentLevel] = level
- end
- dashboard.animationStartTime = getTickCount()
- dashboard.animationEndTime = dashboard.animationStartTime + animationStyles[currentAnimationStyle][2]
- dashboard.animationEasingFunction = animationStyles[currentAnimationStyle][1]
- if isTimer(levelSwapTimer) then
- killTimer(levelSwapTimer)
- end
- levelSwapTimer = setTimer(function()
- dashboard.canSwapLevel = true
- end, 100, 1)
- dashboard.canSwapLevel = false
- triggerEvent("onDashboardLevelChanged", getRootElement(), oldLevel, newLevel)
- end
- function toggleDashboard()
- if isPlayerGuest(getLocalPlayer()) or IN_GARAGE then
- return
- end
- if menu.mapMainMenu.fields[1] then
- flowFormClearFocus(menu.mapMainMenu.fields[1])
- end
- if menu.garageSwapVehicleMenu.fields[1] then
- flowFormClearFocus(menu.garageSwapVehicleMenu.fields[1])
- end
- dashboardDisplaying = not dashboardDisplaying
- flowFormActive = dashboardDisplaying
- if dashboardDisplaying then
- showCursor(true)
- for i, tile in ipairs(menu.rootMenu.tiles) do
- tile.itemData.DX3D.enabled = true
- tile.itemData.DX3D.frozen = true
- tile.itemData.DX3D.rotX = 90
- setTimer(function()
- tile.itemData.DX3D.frozen = false
- end, 110 * i, 1)
- end
- else
- showCursor(false)
- end
- end
- bindKey("F7", "down", toggleDashboard)
- addEvent("onDashboardLevelChanged", true)
- addEventHandler("onDashboardLevelChanged", getRootElement(), function(oldLevel, newLevel)
- if oldLevel == "playerSelectionMenu" and newLevel == "statsMenu" then
- player_stats[1] = getPlayerName(LAST_SELECTED_PLAYER)
- reloadPlayerStats(LAST_SELECTED_PLAYER, "_ALL_")
- updateStatsDisplay()
- elseif newLevel == "statsMenu" then
- reloadPlayerStats(getLocalPlayer(), "_ALL_")
- updateStatsDisplay()
- elseif newLevel == "taskMenu" or oldLevel == "newTaskMenu" then
- callServerFunction("getCurrentTaskInfo", getLocalPlayer())
- end
- end)
- viewingOwnStats = true
- player_stats = {
- getPlayerName(getLocalPlayer())
- }
- stats_names = {
- "<PlayerName>",
- "Cash",
- "Exp",
- "SP",
- "TotalSP",
- "Wins",
- "Attempts",
- "Percent",
- "WinStreak",
- "Achievements",
- "TasksCompleted",
- "Joined",
- "Playtime",
- "TimesTaken",
- "HunterPercent",
- "Toptimes",
- "RocketsFired",
- "KilledHunter",
- "KilledShooterCTF",
- "MapsBought",
- "TimesChangedVehicle",
- "PVPWins",
- "DMAttempts",
- "DMWins",
- "DMPercent",
- "DDAttempts",
- "DDWins",
- "DDPercent",
- "RACEAttempts",
- "RACEWins",
- "RACEPercent",
- "CTFAttempts",
- "CTFWins",
- "CTFPercent",
- "CTFFlagsTaken",
- "CTFFlagsCaptured",
- "SHAttempts",
- "SHWins",
- "SHPercent"
- }
- function updateStatsDisplay()
- flowFormSetLabelProperty(menu.statsMenu.labels[1], "text", player_stats[1])
- for i, text in pairs(dx_stats) do
- if text:lower():find("playtime") ~= nil then
- local playtime = tonumber(player_stats[i + 1])
- local time = {m = 0, h = 0}
- repeat
- if playtime >= 60 then
- playtime = playtime - 60
- time.h = time.h + 1
- else
- time.m = playtime
- playtime = 0
- end
- until playtime == 0
- if time.m < 10 then
- time.m = "0" .. time.m
- end
- if time.h < 10 then
- time.h = "0" .. time.h
- end
- flowFormSetLabelProperty(menu.statsMenu.labels[i + 1], "text", text .. time.h .. ":" .. time.m)
- else
- local append = ""
- if text:lower():find("percent") ~= nil then
- player_stats[i + 1] = math.round(player_stats[i + 1], 2)
- append = "%"
- end
- flowFormSetLabelProperty(menu.statsMenu.labels[i + 1], "text", text .. player_stats[i + 1] .. append)
- end
- end
- end
- function reloadPlayerStats(who, reloadWhat)
- reloadWhat = reloadWhat or "_ALL_"
- if getElementData(who, "Cash") == "Guest" then
- return
- end
- if not viewingOwnStats then
- return
- end
- if reloadWhat == "_ALL_" then
- for i, data in pairs(stats_names) do
- player_stats[i] = tostring(getElementData(who, data))
- end
- else
- local counter = 0
- for i, check in pairs(stats_names) do
- if reloadWhat == check then
- counter = i
- break
- end
- end
- if counter ~= 0 then
- player_stats[counter] = tostring(getElementData(who, stats_names[counter]))
- else
- outputDebugString("Failed to update stat " .. reloadWhat .. "!")
- end
- end
- local pName = getElementData(who, "Player.Name")
- if not pName or pName == "" then
- pName = getPlayerName(who)
- end
- player_stats[1] = pName
- end
- addEventHandler("onClientResourceStart", resourceRoot, function()
- reloadPlayerStats(getLocalPlayer(), "_ALL_")
- end)
- function setSelectedPlayer(player)
- LAST_SELECTED_PLAYER = player
- swapLevel("[STEP_BACK]")
- end
- function reloadPlayerListForSelectionScreen()
- end
- for k, gui in ipairs(getElementsByType("gui-window", resourceRoot)) do
- guiSetVisible(gui, false)
- end
- local yFix = -70
- function constructdonatorMenu()
- if menu.donatorMenu and menu.donatorMenu.form then
- flowFormDestroyForm(menu.donatorMenu.form)
- end
- menu.donatorMenu = {}
- menu.donatorMenu.tiles = {}
- menu.donatorMenu.labels = {}
- menu.donatorMenu.strips = {}
- menu.donatorMenu.form = flowFormCreateForm(screenWidth, 0, screenWidth, screenHeight, false)
- local donatorMenuItems = {
- {
- name = "Accept",
- img = "img/dashboard/icons/arrow_full_left.png",
- fn = "swapLevel",
- args = {
- "[STEP_BACK]"
- }
- },
- {
- name = "Watch Live CW",
- img = "img/dashboard/icons/star_outline.png",
- fn = "joinCW",
- args = {}
- }
- }
- local startingPosition = screenWidth / 2 - (tileSize * #donatorMenuItems + tileSize / 20 * #donatorMenuItems) / 2 - tileSize
- for i, k in ipairs(donatorMenuItems) do
- menu.donatorMenu.tiles[i] = flowFormCreateTile(startingPosition + tileSize * i + tileSize / 20 * i, screenHeight - tileSize * 1.6, tileSize, tileSize, menu.donatorMenu.form)
- flowFormSetTileProperty(menu.donatorMenu.tiles[i], "fn", k.fn)
- flowFormSetTileProperty(menu.donatorMenu.tiles[i], "args", k.args)
- flowFormSetTileProperty(menu.donatorMenu.tiles[i], "text", k.name)
- flowFormSetTileProperty(menu.donatorMenu.tiles[i], "color", {
- 255,
- 100,
- 0
- })
- flowFormSetTileProperty(menu.donatorMenu.tiles[i], "image", k.img)
- end
- for i, k in ipairs(DONATOR_LIST) do
- if k.text then
- if k.info then
- k.options[1][1] = getElementData(localPlayer, "freeMaps") .. " Maps Left"
- end
- local offsetFromCenter = scale * 4
- local scale = scale / 3
- menu.donatorMenu.labels[i] = flowFormCreateLabel(screenWidth / 2 - dxGetTextWidth(k.text, scale, "default-bold") - offsetFromCenter, scale * 80 + i * dxGetFontHeight(scale, "default-bold") * 1.5 - yFix, screenWidth, screenHeight, k.text, menu.donatorMenu.form)
- flowFormSetLabelProperty(menu.donatorMenu.labels[i], "scale", scale)
- menu.donatorMenu.strips[i] = flowFormCreateStrip(screenWidth / 2 + offsetFromCenter, scale * 80 + i * dxGetFontHeight(scale, "default-bold") * 1.5 - yFix, menu.donatorMenu.form)
- for x, y in ipairs(k.options) do
- flowFormAddStripItem(menu.donatorMenu.strips[i], y[1], "default-bold", scale, "saveDonatorSetting", {
- k.data,
- y[2]
- })
- end
- if DONATOR[k.data] then
- flowFormStripSetSelected(menu.donatorMenu.strips[i], DONATOR[k.data])
- else
- flowFormStripSetSelected(menu.donatorMenu.strips[i], k.default)
- end
- end
- end
- end
- function checkDonator()
- if getElementData(getLocalPlayer(), "isDonator") then
- swapLevel("donatorMenu")
- else
- exports.xmsg:displayMsg("error", "You're not donator!", "Access Denied")
- end
- end
- function joinCW()
- if getElementData(getLocalPlayer(), "isDonator") then
- triggerServerEvent("watchCWlive", localPlayer)
- else
- exports.xmsg:displayMsg("error", "You're not donator!", "Access Denied")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment