From d13d6196ffac36bad906eb30c473577bb6bf5430 Mon Sep 17 00:00:00 2001 From: Musiker15 Date: Tue, 5 Mar 2024 19:02:07 +0100 Subject: [PATCH] Update v1.9.7 * Finally fixed new Callbacks * New Design for MSK.Input * Bugfixes for MSK.Input --- VERSION | 2 +- client/cl_callback.lua | 16 ++- fxmanifest.lua | 2 +- html/index.html | 10 +- html/script.js | 19 ++-- html/style.css | 240 ++++++++++++++++++++++++++++++----------- server/sv_callback.lua | 19 +++- 7 files changed, 227 insertions(+), 81 deletions(-) diff --git a/VERSION b/VERSION index b4cac6f..0b9006e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.9.6 \ No newline at end of file +1.9.7 \ No newline at end of file diff --git a/client/cl_callback.lua b/client/cl_callback.lua index 248ded4..64d3379 100644 --- a/client/cl_callback.lua +++ b/client/cl_callback.lua @@ -3,7 +3,9 @@ local CallbackHandler = {} AddEventHandler('onResourceStop', function(resource) if CallbackHandler[resource] then - RemoveEventHandler(CallbackHandler[resource]) + for k, handler in pairs(CallbackHandler[resource]) do + RemoveEventHandler(handler) + end end end) @@ -14,14 +16,22 @@ MSK.RegisterClientCallback = function(eventName, cb) end) local script = GetInvokingResource() - if script then CallbackHandler[script] = handler end + if script then + if CallbackHandler[script] then + table.insert(CallbackHandler[script], handler) + else + CallbackHandler[script] = {} + table.insert(CallbackHandler[script], handler) + end + end end +MSK.Register = MSK.RegisterClientCallback exports('RegisterClientCallback', MSK.RegisterClientCallback) -- NEW Method for Server Callbacks MSK.Trigger = function(eventName, ...) local p = promise.new() - local ticket = GetGameTimer() .. GetPlayerServerId(PlayerId()) + local ticket = tostring(GetGameTimer() .. GetPlayerServerId(PlayerId())) SetTimeout(5000, function() p:reject("Request Timed Out (408)") diff --git a/fxmanifest.lua b/fxmanifest.lua index 1c3504c..eb0ce5b 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ games { 'gta5' } author 'Musiker15 - MSK Scripts' name 'msk_core' description 'Core functions for MSK Scripts' -version '1.9.6' +version '1.9.7' lua54 'yes' diff --git a/html/index.html b/html/index.html index f34ec9c..bd82a71 100644 --- a/html/index.html +++ b/html/index.html @@ -16,11 +16,15 @@ -
Das ist eine Überschrift - +
+
+
+ This is a title +
+
- +
diff --git a/html/script.js b/html/script.js index ccb6447..5663e64 100644 --- a/html/script.js +++ b/html/script.js @@ -24,6 +24,15 @@ window.addEventListener('message', (event) => { document.getElementById(input).placeholder = data.placeholder; $(".msk-input-container").fadeIn() $("#msk-input-title").text(data.header) + + document.getElementById('small-input').addEventListener("keydown", function(e) { + if (e.key === "Enter") { + if (e.shiftKey) { + return; + } + e.preventDefault(); + } + }) } else if (event.data.action == 'progressBarStart') { event.data.id = currID progressBarStart(event.data); @@ -119,16 +128,14 @@ closeInputUI = (send) => { document.onkeyup = (data) => { if (data.which == 27) { + var textfield = '#small-input' + if (field) {textfield = '#big-input'} + $(textfield).val(''); + closeInputUI() } } -$("#small-input").keydown((event) => { - if (event.keyCode == 13) { - event.preventDefault(); - } -}) - input = () => { var textfield = '#small-input' if (field) {textfield = '#big-input'} diff --git a/html/style.css b/html/style.css index ce464ff..04160b0 100644 --- a/html/style.css +++ b/html/style.css @@ -6,6 +6,27 @@ MSK Notification */ +*::-webkit-scrollbar { + display:none; +} + +textarea { + resize: none; +} + +body { + margin: 0; + padding: 0; + overflow:hidden; + user-select: none; + background-size: cover; + font-family: 'Rajdhani'; + background-repeat: no-repeat; + font-size:0vh; + letter-spacing:0.06vh; + /* background-image: url('https://cdn.discordapp.com/attachments/703398827448729670/1210609400889217084/Screenshot_56.png?ex=65f4695d&is=65e1f45d&hm=198bcaa93062981ebc315b1484947f2faa1d8dba39f6d23494b2fe2e0bba4dd3&'); */ +} + .notify-wrapper { position: absolute; left: 2vh; /* Change this to left or right */ @@ -56,79 +77,149 @@ MSK Input */ -body { - overflow: hidden; - user-select: none; +.msk-input-title-box { + position: absolute; + top:3.2vh; + left:50%; + font-weight:bold; + background:linear-gradient(to right, #ffffff00, #ffffff13, #ffffff00); + transform:translateX(-50%) } -textarea { - resize: none; +.msk-input-title { + position: relative; + white-space:nowrap; + height:3.2vh; + color:white; + font-size:1.4vh; + letter-spacing:0.2vh; + text-transform:uppercase; + border-width: 0.1vh; + border-style: solid; + border-right:none; + border-left:none; + border-image: linear-gradient(to right, #00000000, #1eff008a, #00000000) 1; } -::placeholder { - color: white; - opacity: 0.8 +.msk-input:focus { + border-image: linear-gradient(to right, #00000000, #1eff008a, #00000000) 1; } -* { - --Main: radial-gradient(180vh circle at 0 -60%,#086d04,#050505); - --Input: #1fb11f59; - --Input-Border: #24b11f79; - - user-select: none; - box-sizing: border-box; - font-family: poppins +.msk-input-title-text { + position: relative; + top:25%; + padding-right:2.4vh; + padding-left:2.4vh; + background:-webkit-linear-gradient(rgb(255, 255, 255), #4b4b4b); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; } -#close { +.arrow-right { position: absolute; - width: 2vh; - height: 2vh; - right: 1.04vh; - text-align: center; - line-height: 2vh; - border-radius: 0.4vh; - background: #1fb11f59; - transition: 400ms; + top:50%; + transform:translateY(-50%); + right:0.4vh; + background:-webkit-linear-gradient(#1cb900, #106800); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + animation: arrowRight 1.6s infinite linear; } -#close:hover { - background: #1fb11f; +.arrow-left { + position: absolute; + top:50%; + transform:translateY(-50%); + left:0.4vh; + background:-webkit-linear-gradient(#1cb900, #106800); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + animation: arrowLeft 1.6s infinite linear; +} + +@keyframes arrowRight { + 0% { + opacity:0; + right:0.4vh; + } + 50% { + opacity:0.6; + } + 80% { + opacity:0; + } + 100% { + opacity:0; + right:-0.4vh; + } +} + +@keyframes arrowLeft { + 0% { + opacity:0; + left:0.4vh; + } + 50% { + opacity:0.6; + } + 80% { + opacity:0; + } + 100% { + opacity:0; + left:-0.4vh; + } } .msk-input-container { display: none; position: absolute; - width: 40vh; + width: 46vh; height: auto; - background: radial-gradient(110vh circle at 0 -60%,#075705,#050505); + background:radial-gradient(rgba(19, 19, 19, 0.98), rgba(19, 19, 19, 0.98), rgb(12, 12, 12)); + margin:0.6vh; + border-radius:0.8vh; + border-width: 0.1vh; + border-style: solid; + border-image: radial-gradient(#00000000, #1eff008a, #00000000) 1; + box-shadow:0vh 0vh 4vh rgb(0, 0, 0); left: 50%; top: 50%; transform: translate(-50%, -50%); - border-radius: 1.4vh; color: white; text-align: center; - padding-top: 0.8vh; + padding-bottom:13.6vh; text-transform: uppercase; font-weight: bold; font-size: 1.4vh; - padding-bottom: 1.4vh; - border: 0.2vh #1fb11f solid; +} + +.msk-input::placeholder { + color:rgb(105, 105, 105); } .msk-input { - width: 36vh; - background: #1fb11f2c; - outline: none; - border: none; - overflow: hidden; - border: 0.1vh #1fb11f solid; - border-radius: 0.4vh; - color: white; - padding: 0.72vh; - padding-top: 0.4vh; - padding-bottom: 0.2vh; - transition: 400ms; + position: relative; + border:none; + outline:none; + width:92%; + letter-spacing:0.1vh; + padding-top:1.0vh; + padding-bottom:1.0vh; + padding-right:1.8vh; + padding-left:1.8vh; + top:9.2vh; + text-align: center; + font-size:1.12vh; + color:rgb(174, 174, 174); + /* text-transform: uppercase; */ + + background:linear-gradient(to right, #ffffff00, #ffffff13, #ffffff00); + border-width: 0.1vh; + border-style: solid; + border-right:none; + border-left:none; + border-image: linear-gradient(to right, #00000000, #ffffff8a, #00000000) 1; } .msk-input:hover { @@ -137,36 +228,61 @@ textarea { #big-input { display: none; - margin-top: 1.2vh; - height: 10vh; + height: 8vh; } #small-input { display: all; - margin-top: 1.4vh; + height: 1.2vh; + padding-left:2vh; white-space: nowrap; - } .msk-submit-button { position: relative; - width: 16vh; - height: 3.2vh; - right: -10vh; - top: 0.4vh; - background: #1fb11f2c; - border: 0.1vh #1fb11f solid; - border-radius: 0.4vh; - font-weight: bold; - font-size: 1.4vh; - text-transform: uppercase; - color: white; - transition: 400ms; + height:3.4vh; + top:10.4vh; + width:100%; + font-weight:bold; + border:none; + outline:none; + text-align: center; + background:linear-gradient(to right, #ffffff00, #ffffff13, #ffffff00); + text-transform: uppercase; + border-width: 0.1vh; + border-style: solid; + border-right:none; + border-left:none; + border-image: linear-gradient(to right, #00000000, #ffffff8a, #00000000) 1; + backface-visibility: hidden; +/* transform:translate(-50%) */ +} + +.msk-submit-button-text { + position: absolute; + top:0.86vh; + left:50%; + transform: translateX(-50%); + font-size:1.4vh; + letter-spacing:0.2vh; + transition: 200ms; + background:-webkit-linear-gradient(rgb(255, 255, 255), #4b4b4b); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + backface-visibility: hidden; } .msk-submit-button:hover { + cursor:pointer; + border-image: linear-gradient(to right, #00000000, #1eff008a, #00000000) 1; +} + +.msk-submit-button:hover .msk-submit-button-text { background: #1fb11f; - letter-spacing: 0.2vh; + letter-spacing:0.34vh; + background:-webkit-linear-gradient(#26ff00, #093a00); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; } /* diff --git a/server/sv_callback.lua b/server/sv_callback.lua index 97d0e10..bfca6fa 100644 --- a/server/sv_callback.lua +++ b/server/sv_callback.lua @@ -3,19 +3,27 @@ local CallbackHandler = {} AddEventHandler('onResourceStop', function(resource) if CallbackHandler[resource] then - RemoveEventHandler(CallbackHandler[resource]) + for k, handler in pairs(CallbackHandler[resource]) do + RemoveEventHandler(handler) + end end end) --- NEW Method for Server Callbacks MSK.Register = function(eventName, cb) - local handler = RegisterNetEvent(('events-request-%s'):format(eventName), function (ticket, ...) - print(('events-request-%s'):format(eventName), ticket, ...) + local handler = RegisterNetEvent(('events-request-%s'):format(eventName), function(ticket, ...) + logging('debug', ('events-request-%s'):format(eventName), ticket, source, cb, ...) TriggerClientEvent(('events-resolve-%s-%s'):format(eventName, ticket), source, cb(source, ...)) end) local script = GetInvokingResource() - if script then CallbackHandler[script] = handler end + if script then + if CallbackHandler[script] then + table.insert(CallbackHandler[script], handler) + else + CallbackHandler[script] = {} + table.insert(CallbackHandler[script], handler) + end + end end -- NEW Method for Client Callbacks @@ -37,6 +45,7 @@ MSK.TriggerClientCallback = function(eventName, playerId, ...) RemoveEventHandler(handler) return table.unpack(result) end +MSK.Trigger = MSK.TriggerClientCallback exports('TriggerClientCallback', MSK.TriggerClientCallback) -- OLD Method for Server Callbacks