Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getSidebarSetting(_ARG_0_)
- return Settings[_ARG_0_]
- end
- function setSidebarSetting(_ARG_0_, _ARG_1_)
- Settings[_ARG_0_] = _ARG_1_
- if isTimer(saveSettingsTimer) then
- killTimer(saveSettingsTimer)
- end
- saveSettingsTimer = setTimer(saveSettings, 2000, 1, true)
- end
- addEventHandler("onClientChatMessage", root, function(_ARG_0_)
- if string.gsub(_ARG_0_, " ", "") == "" then
- cancelEvent()
- end
- end)
- sidebar = {}
- sidebar.r = 5
- sidebar.g = 5
- sidebar.b = 5
- sidebar.a = 250
- sidebar.tr = 255
- sidebar.tg = 255
- sidebar.tb = 255
- theBoundSidebarKey = "u"
- sidebar.weekday = {
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- }
- sidebar.month = {
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- }
- sidebar.appbgr = {
- [0] = 0
- }
- sx, sy = guiGetScreenSize()
- white = tocolor(255, 255, 255, 255)
- sidebar.width = 160
- sidebar.app = {
- "Maps",
- "Store",
- "Music",
- "Stats",
- "9GAG",
- "Screenshots",
- "Clan Manager",
- "Settings"
- }
- sidebar.commands = {
- "maps",
- "store",
- "music",
- "stats",
- "9gag",
- "screenshots",
- "clan",
- "settings"
- }
- for _FORV_4_, _FORV_5_ in ipairs(sidebar.app) do
- sidebar.appbgr[_FORV_4_] = 0
- end
- sidebar.hover = {}
- sidebar.hover[8] = function(_ARG_0_)
- return _ARG_0_ * 10
- end
- if sy < 10 + 3 * 15 + 1 * 15 + 10 + #sidebar.app * (64 + 15) + 100 then
- sidebar.width = 120
- end
- function drawSidebar()
- if sidebar.state ~= 0 then
- showCursor(true)
- end
- checkStates()
- dxDrawRectangle(sx - sidebar.pos, 0, sidebar.pos, sy, tocolor(sidebar.r, sidebar.g, sidebar.b, sidebar.a), true)
- dxDrawLine(sx - sidebar.pos, 0, sx - sidebar.pos, sy, tocolor(100, 100, 100, 100), 1, true)
- dxDrawText(string.format("%02d:%02d", getRealTime().hour, getRealTime().minute), sx - sidebar.pos, _UPVALUE0_, sx - sidebar.pos + sidebar.width, _UPVALUE0_ + _UPVALUE1_ * 15, white, _UPVALUE1_, "default-bold", "center", "top", false, false, true)
- dxDrawText(sidebar.weekday[getRealTime().weekday + 1] .. ", " .. sidebar.month[getRealTime().month + 1] .. " " .. getRealTime().monthday, sx - sidebar.pos, _UPVALUE0_ + _UPVALUE1_ * 15, sx - sidebar.pos + sidebar.width, _UPVALUE0_ + _UPVALUE1_ * 15 + _UPVALUE2_ * 15, white, _UPVALUE2_, "default-bold", "center", "top", false, false, true)
- if getCursorPosition() and getCursorPosition() * sx and (getCursorPosition() and getCursorPosition() * sx) >= sx - sidebar.pos and 0 <= getCursorPosition() * sy and getCursorPosition() * sy < _UPVALUE3_ then
- if getKeyState("mouse1") then
- sidebar.appbgr[0] = 1.4
- else
- sidebar.appbgr[0] = math.min(1, sidebar.appbgr[0] + 0.1)
- end
- else
- sidebar.appbgr[0] = math.max(0, sidebar.appbgr[0] - 0.1)
- end
- dxDrawRectangle(sx - sidebar.pos, 0, sidebar.width, _UPVALUE3_, tocolor(255, 255, 255, sidebar.appbgr[0] * 20), true)
- if 0 < sidebar.appbgr[0] then
- dxDrawRectangle(sx - sidebar.pos - sidebar.width, 0, sidebar.width, _UPVALUE3_, tocolor(sidebar.r, sidebar.g, sidebar.b, sidebar.appbgr[0] * sidebar.a * 0.9), true)
- dxDrawText(string.format("%02d:%02d", getRealTime(getRealTime().timestamp + serverTimestampDifference).hour, getRealTime(getRealTime().timestamp + serverTimestampDifference).minute), sx - sidebar.pos - sidebar.width, _UPVALUE0_, sx - sidebar.pos, _UPVALUE3_, tocolor(255, 255, 255, sidebar.appbgr[0] * 255), _UPVALUE1_, "default-bold", "center", "top", false, false, true)
- dxDrawText("Server Time", sx - sidebar.pos - sidebar.width, _UPVALUE0_ + _UPVALUE1_ * 15, sx - sidebar.pos, _UPVALUE0_ + _UPVALUE1_ * 15 + _UPVALUE2_ * 15, tocolor(255, 255, 255, sidebar.appbgr[0] * 255), _UPVALUE2_, "default-bold", "center", "top", false, false, true)
- end
- for _FORV_9_, _FORV_10_ in ipairs(sidebar.app) do
- if getCursorPosition() and getCursorPosition() * sx and (getCursorPosition() and getCursorPosition() * sx) >= sx - sidebar.pos and getCursorPosition() * sy >= _UPVALUE3_ + (_FORV_9_ - 1) * _UPVALUE4_ and getCursorPosition() * sy < _UPVALUE3_ + _FORV_9_ * _UPVALUE4_ then
- if getKeyState("mouse1") then
- sidebar.appbgr[_FORV_9_] = 1.4
- else
- sidebar.appbgr[_FORV_9_] = math.min(1, sidebar.appbgr[_FORV_9_] + 0.1)
- _UPVALUE5_[_FORV_9_] = (_UPVALUE5_[_FORV_9_] or 0) + 0.1
- end
- else
- sidebar.appbgr[_FORV_9_] = math.max(0, sidebar.appbgr[_FORV_9_] - 0.1)
- _UPVALUE5_[_FORV_9_] = 0
- end
- dxDrawRectangle(sx - sidebar.pos, _UPVALUE3_ + (_FORV_9_ - 1) * _UPVALUE4_, sidebar.width, _UPVALUE4_, tocolor(255, 255, 255, sidebar.appbgr[_FORV_9_] * 20), true)
- dxDrawImage(sx - sidebar.pos + _UPVALUE6_, _UPVALUE3_ + (_FORV_9_ - 1) * _UPVALUE4_ + _UPVALUE7_, _UPVALUE8_, _UPVALUE8_, "images/icons/" .. sidebar.commands[_FORV_9_] .. ".png", sidebar.hover[_FORV_9_] and sidebar.hover[_FORV_9_](_UPVALUE5_[_FORV_9_]) or math.sin(_UPVALUE5_[_FORV_9_] * 1.5) * 10, 0, 0, white, true)
- dxDrawText(_FORV_10_, sx - sidebar.pos, _UPVALUE3_ + (_FORV_9_ - 1) * _UPVALUE4_ + _UPVALUE7_ + _UPVALUE8_ + 5, sx - sidebar.pos + sidebar.width, _UPVALUE3_ + _FORV_9_ * _UPVALUE4_, white, _UPVALUE2_, "default-bold", "center", "top", false, false, true)
- end
- end
- function setServerTimestampDifference(_ARG_0_)
- serverTimestampDifference = _ARG_0_
- end
- function getServerTimestampDifference()
- return serverTimestampDifference
- end
- addEvent("receiveServerTimestampDifference", true)
- addEventHandler("receiveServerTimestampDifference", localPlayer, setServerTimestampDifference)
- triggerServerEvent("getServerTimestampDifference", localPlayer, getRealTime().timestamp)
- function openSidebar()
- if not getElementData(localPlayer, "isLobbyOpened") then
- unbindKey(theBoundSidebarKey, "down")
- showCursor(true)
- addEventHandler("onClientRender", root, drawSidebar, true, "low-9")
- sidebar.pos = 0
- sidebar.state = 1
- addEventHandler("onClientClick", root, sidebarClick)
- end
- end
- function closeSidebar()
- for _FORV_3_, _FORV_4_ in ipairs(getElementsByType("dxWindow")) do
- if getElementData(_FORV_4_, "text") ~= title then
- closeFFSWindow(_FORV_4_)
- end
- end
- sidebar.state = 0
- showCursor(false)
- removeEventHandler("onClientClick", root, sidebarClick)
- end
- function main()
- bindKey(theBoundSidebarKey, "down", openSidebar)
- end
- function checkStates()
- if sidebar.state == 1 then
- sidebar.pos = math.min(sidebar.pos + 10, sidebar.width)
- if sidebar.pos == sidebar.width then
- sidebar.state = 2
- bindKey(theBoundSidebarKey, "down", closeSidebar)
- end
- elseif sidebar.state == 0 then
- sidebar.pos = math.max(sidebar.pos - 10, 0)
- if sidebar.pos == 0 then
- bindKey(theBoundSidebarKey, "down", openSidebar)
- removeEventHandler("onClientRender", root, drawSidebar)
- end
- end
- end
- function cursorChecks()
- if isCursorShowing() then
- for _FORV_5_ = 1, 4 do
- sidebar.iconSize[_FORV_5_] = math.max(sidebar.iconSize[_FORV_5_] - 0.2, 0)
- end
- if getCursorPosition() * sx >= sx - 0.95 * sidebar.pos then
- if getCursorPosition() * sy <= sidebar.pos then
- sidebar.iconSize[1] = math.min(sidebar.iconSize[1] + 0.3, 1)
- elseif getCursorPosition() * sy <= 2 * sidebar.pos then
- sidebar.iconSize[2] = math.min(sidebar.iconSize[2] + 0.3, 1)
- elseif getCursorPosition() * sy <= 3 * sidebar.pos then
- sidebar.iconSize[3] = math.min(sidebar.iconSize[3] + 0.3, 1)
- elseif getCursorPosition() * sy >= sy - sidebar.pos then
- sidebar.iconSize[4] = math.min(sidebar.iconSize[4] + 0.3, 1)
- end
- end
- end
- end
- function apps()
- sidebar.appmenu = 0
- drawAppMenu = true
- end
- function sidebarClick(_ARG_0_, _ARG_1_)
- if _ARG_0_ ~= "left" or _ARG_1_ ~= "up" then
- return
- end
- if getCursorPosition() and getCursorPosition() * sx and (getCursorPosition() and getCursorPosition() * sx) >= sx - sidebar.pos then
- for _FORV_8_, _FORV_9_ in ipairs(sidebar.app) do
- if getCursorPosition() * sy >= _UPVALUE0_ + (_FORV_8_ - 1) * _UPVALUE1_ and getCursorPosition() * sy < _UPVALUE0_ + _FORV_8_ * _UPVALUE1_ then
- return executeCommandHandler(sidebar.commands[_FORV_8_])
- end
- end
- end
- end
- addEvent("receiveData", true)
- addEventHandler("receiveData", getLocalPlayer(), function(_ARG_0_, _ARG_1_)
- if _ARG_0_ == "News" then
- News_cache = _ARG_1_
- elseif _ARG_0_ == "Maps" then
- cacheMaps(_ARG_1_)
- elseif _ARG_0_ == "mInfo" then
- getMapInfo(_ARG_1_)
- elseif _ARG_0_ == "Music" then
- receiveMusicList(_ARG_1_)
- elseif _ARG_0_ == "Toptimes" then
- getTopHunterReachers(_ARG_1_)
- elseif _ARG_0_ == "Stats" then
- leaderBoards = _ARG_1_
- elseif _ARG_0_ == "likedMaps" then
- likedMaps = _ARG_1_
- elseif _ARG_0_ == "Cathegories" then
- mapCat = _ARG_1_
- elseif _ARG_0_ == "gagsList" then
- images = _ARG_1_
- elseif _ARG_0_ == "gag" then
- if fileExists("cache/" .. _ARG_1_[1]) then
- return
- end
- if fileCreate("cache/" .. _ARG_1_[1]) then
- for _FORV_6_, _FORV_7_ in ipairs(_ARG_1_[2]) do
- fileWrite(fileCreate("cache/" .. _ARG_1_[1]), _FORV_7_)
- end
- fileClose((fileCreate("cache/" .. _ARG_1_[1])))
- end
- elseif _ARG_0_ == "Tuning" then
- Tuning = _ARG_1_
- onTuningDataReceived()
- end
- end)
- function drawSidebarNote()
- timeDif = getTickCount() - _UPVALUE0_
- if timeDif <= 500 then
- elseif timeDif >= 500 and timeDif <= 5000 then
- elseif timeDif <= 5500 then
- else
- removeEventHandler("onClientRender", root, drawSidebarNote)
- return
- end
- dxDrawRectangle(sx / 2 - 200, sy - (5500 - timeDif) / 500 * 100, 400, 100, _UPVALUE1_[3])
- dxDrawLine(sx / 2 - 200, sy - (5500 - timeDif) / 500 * 100, sx / 2 + 200, sy - (5500 - timeDif) / 500 * 100, tocolor(255, 255, 255, 100))
- dxDrawLine(sx / 2 - 200, sy - (5500 - timeDif) / 500 * 100, sx / 2 - 200, sy, tocolor(255, 255, 255, 100))
- dxDrawLine(sx / 2 + 200, sy - (5500 - timeDif) / 500 * 100, sx / 2 + 200, sy, tocolor(255, 255, 255, 100))
- dxDrawText(_UPVALUE1_[1], sx / 2 - 195, sy - (5500 - timeDif) / 500 * 100 + 20, sx / 2 + 195, sy, tocolor(255, 255, 255, 255), 1.6, "default-bold", "center", "top", true, false)
- dxDrawText(_UPVALUE1_[2], sx / 2 - 195, sy - (5500 - timeDif) / 500 * 100 + 60, sx / 2 + 195, sy, tocolor(255, 255, 255, 255), 1.6, "default", "center", "top", true, false)
- end
- addEvent("notifyPlayer", true)
- addEventHandler("notifyPlayer", localPlayer, function(...)
- exports.ffs:addNotification(...)
- end)
- addEvent("alertPlayer", true)
- addEventHandler("alertPlayer", localPlayer, function(_ARG_0_, _ARG_1_, _ARG_2_, _ARG_3_)
- alert(_ARG_0_, _ARG_1_, _ARG_2_, _ARG_3_)
- end)
- function postData(_ARG_0_, _ARG_1_, _ARG_2_, _ARG_3_)
- triggerServerEvent("postData", localPlayer, _ARG_0_, _ARG_1_, _ARG_2_, _ARG_3_)
- end
- addEvent("onClientArenaLeave", true)
- addEvent("onClientArenaJoin", true)
- function onClientArenaJoin(_ARG_0_)
- if _ARG_0_ ~= true and not Settings.serverAlreadyVisitted then
- setSidebarSetting("serverAlreadyVisitted", "yes")
- openHelp(true)
- end
- if not sidebarAlreadyStarted then
- sidebarAlreadyStarted = true
- main()
- end
- end
- addEventHandler("onClientResourceStart", resourceRoot, function()
- onClientArenaJoin(true)
- end)
- addEventHandler("onClientArenaJoin", root, onClientArenaJoin)
- bindKey("F1", "down", function()
- closeSidebar()
- end)
- addEventHandler("onClientArenaLeave", root, closeSidebar)
Advertisement
Add Comment
Please, Sign In to add comment