├── .gitignore ├── LICENSE ├── README.md └── cas-market ├── client ├── client_hook.lua └── main.lua ├── config.lua ├── fxmanifest.lua ├── html ├── Satoshi-Bold.otf ├── Satoshi-Regular.otf ├── app.css ├── app.js ├── home.png ├── images │ ├── weapon_flashlight.png │ ├── weapon_golfclub.png │ ├── weapon_gusenberg.png │ ├── weapon_hammer.png │ ├── weapon_hatchet.png │ ├── weapon_heavypistol.png │ ├── weapon_heavyshotgun.png │ ├── weapon_heavysniper.png │ ├── weapon_heavysniper_mk2.png │ ├── weapon_knife.png │ ├── weapon_knuckle.png │ ├── weapon_machete.png │ ├── weapon_machinepistol.png │ ├── weapon_microsmg.png │ └── weapon_smg_mk2.png ├── resim_2023-07-02_024117088-removebg-preview 1.png └── ui.html └── server ├── main.lua └── server_hook.lua /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Lua sources 2 | luac.out 3 | 4 | # luarocks build files 5 | *.src.rock 6 | *.zip 7 | *.tar.gz 8 | 9 | # Object files 10 | *.o 11 | *.os 12 | *.ko 13 | *.obj 14 | *.elf 15 | 16 | # Precompiled Headers 17 | *.gch 18 | *.pch 19 | 20 | # Libraries 21 | *.lib 22 | *.a 23 | *.la 24 | *.lo 25 | *.def 26 | *.exp 27 | 28 | # Shared objects (inc. Windows DLLs) 29 | *.dll 30 | *.so 31 | *.so.* 32 | *.dylib 33 | 34 | # Executables 35 | *.exe 36 | *.out 37 | *.app 38 | *.i*86 39 | *.x86_64 40 | *.hex 41 | 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Fatih 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CAS-Market 2 | https://discord.gg/X8bTK9Stwk 3 | Hey everyone! 4 | Welcome to Code After S*x’s post. 5 | 6 | We are releasing CAS-BLACKMARKET script in this post, i hope you like it. 7 | 8 | ![image (2)](https://github.com/mb-later/CAS-Market/assets/68826839/1fd2fde3-7522-4531-ba4d-f6baf9e78d03) 9 | 10 | Video: https://www.youtube.com/watch?v=-MheUh0hjFc 11 | 12 | #So what’s in this script? 13 | 14 | * This script working with ESX/QBCore 15 | * Detailed Config, what i can edit in config? Look at this photo; 16 | ![image](https://github.com/mb-later/CAS-Market/assets/68826839/90d6950d-6028-487d-b181-39753faf6b99) 17 | * Smooth and Nice UI design 18 | * Add item to cart 19 | * Increase the number of items in the basket 20 | * Decrease the number of items in the basket 21 | * Pay with bank 22 | * Pay with cash 23 | * Delete item in the basket 24 | * Using inventory patch for items 25 | * Using Sessionstore functions. 26 | * More optimized 27 | 28 | #How can i install this script? 29 | 30 | * Firstly, download file on my github. Click for github link 31 | * Move it to your resources file 32 | * Please change the filename to cas-market and keep it that way. 33 | * And start script, join server. 34 | 35 | #How can i change imagepatch? 36 | * Open app.js and look at first line 37 | 38 | ![image](https://github.com/mb-later/CAS-Market/assets/68826839/db91b117-8dbf-416b-9688-480d60a5f553) 39 | 40 | * and change it according to your inventory. 41 | 42 | #I show you how to change the function to add items to your own inventory 43 | 44 | * First open server/server_hook.lua and find this; 45 | 46 | ![image](https://github.com/mb-later/CAS-Market/assets/68826839/152e1f65-6e8a-48af-9367-edf91bf3f71e) 47 | 48 | * then edit functions according to your inventory exports/functions. 49 | 50 | 51 | #How can i change notify export? 52 | * First open client_hook.lua and find this; 53 | 54 | ![image](https://github.com/mb-later/CAS-Market/assets/68826839/d35852ea-ce2c-47ff-92e2-ee36c37803a3) 55 | 56 | * Change it according to your notify script’s export/function. 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /cas-market/client/client_hook.lua: -------------------------------------------------------------------------------- 1 | if CAS.Framework == "qb" then 2 | QBCore = exports["qb-core"]:GetCoreObject() 3 | else 4 | ESX = exports["es_extended"]:getSharedObject() 5 | end 6 | 7 | 8 | 9 | Notify = function(text) 10 | if CAS.Framework == "qb" then 11 | return QBCore.Functions.Notify(text) 12 | else 13 | return ESX.ShowNotification(text) 14 | end 15 | end -------------------------------------------------------------------------------- /cas-market/client/main.lua: -------------------------------------------------------------------------------- 1 | 2 | 3 | Citizen.CreateThread(function() 4 | local pedCoords = CAS.PedCoords 5 | if CAS.Ped == nil then 6 | 7 | local pedHash = GetHashKey(CAS.PedHash) 8 | RequestModel(pedHash) 9 | while not HasModelLoaded(pedHash) do 10 | Wait(1) 11 | end 12 | CAS.Ped = CreatePed(1, pedHash, pedCoords.x, pedCoords.y, pedCoords.z-0.98, pedCoords.a, false, false) 13 | 14 | SetPedDefaultComponentVariation(ped) 15 | SetPedRandomProps(ped) 16 | SetPedRandomComponentVariation(ped, true) 17 | TaskStartScenarioInPlace(ped, "WORLD_HUMAN_SMOKING", 0, true) 18 | FreezeEntityPosition(ped, true) 19 | SetEntityInvincible(ped, true) 20 | SetBlockingOfNonTemporaryEvents(ped, true) 21 | end 22 | while true do 23 | local sleep = 750 24 | local ped = PlayerPedId() 25 | local coords = GetEntityCoords(ped) 26 | local distance = #(coords - vector3(pedCoords.x, pedCoords.y, pedCoords.z)) 27 | if distance < CAS.DrawDistance then 28 | sleep = 0 29 | DrawText3D(pedCoords.x, pedCoords.y, pedCoords.z+0.90, "[E] "..CAS.DrawText) 30 | if IsControlJustPressed(0, 38) then 31 | CASFunctions.DisplayUI() 32 | end 33 | end 34 | Citizen.Wait(sleep) 35 | end 36 | end) 37 | 38 | CASFunctions = { 39 | DisplayUI = function() 40 | local Items = {} 41 | for i in pairs(CAS.Items) do 42 | Items[#Items+1] = { 43 | label = CAS.Items[i].label, 44 | price = CAS.Items[i].price, 45 | imageSrc = CAS.Items[i].imageSrc, 46 | key = i, 47 | type = CAS.Items[i].type 48 | } 49 | end 50 | SendNUIMessage({ 51 | action = "market", 52 | items = Items 53 | }) 54 | SetNuiFocus(true,true) 55 | end 56 | } 57 | 58 | 59 | 60 | 61 | RegisterNUICallback("EscapeFromJs", function() 62 | SetNuiFocus(false,false) 63 | end) 64 | 65 | 66 | RegisterNUICallback("CompleteOrder", function(data, cb) 67 | print("yes") 68 | if not data.item or not data.price then return end 69 | print("none") 70 | if CAS.Framework == "qb" then 71 | QBCore.Functions.TriggerCallback("cas-server:BuyProducts",function(_) 72 | if (_) then 73 | Notify(CAS.CompleteText) 74 | end 75 | cb(_) 76 | end, data) 77 | elseif CAS.Framework == "esx" then 78 | ESX.TriggerServerCallback("cas-server:BuyProducts",function(_) 79 | if (_) then 80 | Notify(CAS.CompleteText) 81 | end 82 | cb(_) 83 | end,data) 84 | end 85 | end) 86 | 87 | 88 | function DrawText3D(x, y, z, text) 89 | SetTextScale(0.35, 0.35) 90 | SetTextFont(4) 91 | SetTextProportional(1) 92 | SetTextColour(255, 255, 255, 215) 93 | SetTextEntry('STRING') 94 | SetTextCentre(true) 95 | AddTextComponentString(text) 96 | SetDrawOrigin(x, y, z, 0) 97 | DrawText(0.0, 0.0) 98 | local factor = (string.len(text)) / 370 99 | DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75) 100 | ClearDrawOrigin() 101 | end 102 | -------------------------------------------------------------------------------- /cas-market/config.lua: -------------------------------------------------------------------------------- 1 | 2 | CAS = {} 3 | CAS.Framework = "qb" 4 | CAS.PedCoords = vector4(467.51, -1189.23, 29.29, 269.08) 5 | CAS.CompleteText = "Your order is complete, please check your inventory." 6 | CAS.PedHash = "csb_grove_str_dlr" 7 | CAS.DrawText = "Open Market" 8 | CAS.Ped = nil 9 | CAS.DrawDistance = 3 10 | CAS.Items = { 11 | ["weapon_pistol"] = { 12 | label = "Weapon Pistol", 13 | price = 100, 14 | imageSrc = "weapon_pistol", 15 | type = "weapon" 16 | }, 17 | ["weapon_heavypistol"] = { 18 | label = "Heavy Pistol", 19 | price = 300, 20 | imageSrc = "weapon_heavypistol", 21 | type = "weapon" 22 | }, 23 | ["lockpick"] = { 24 | label = "Lockpick", 25 | price = 300, 26 | imageSrc = "lockpick", 27 | type = "other" 28 | }, 29 | ["armor"] = { 30 | label = "Armor", 31 | price = 100, 32 | imageSrc = "armor", 33 | type = "other" 34 | }, 35 | ["bandage"] = { 36 | label = "Bandage", 37 | price = 300, 38 | imageSrc = "bandage", 39 | type = "other" 40 | }, 41 | ["acetone"] = { 42 | label = "Acetone", 43 | price = 300, 44 | imageSrc = "acetone", 45 | type = "other" 46 | }, 47 | ["cocaineleaf"] = { 48 | label = "Cocaine Leaf", 49 | price = 300, 50 | imageSrc = "cocaineleaf", 51 | type = "other" 52 | }, 53 | ["binoculars"] = { 54 | label = "Binoculars", 55 | price = 300, 56 | imageSrc = "binoculars", 57 | type = "other" 58 | }, 59 | ["cryptostick"] = { 60 | label = "Crypto Stick", 61 | price = 300, 62 | imageSrc = "cryptostick", 63 | type = "other" 64 | }, 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /cas-market/fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'adamant' 2 | game 'gta5' 3 | 4 | author 'MBL & URSU' 5 | description 'https://discord.gg/cas' 6 | 7 | lua54 'yes' 8 | version '1.0.0' 9 | 10 | client_scripts { 11 | 'config.lua', 12 | 'client/main.lua', 13 | 'client/client_hook.lua', 14 | } 15 | 16 | server_scripts { 17 | 'config.lua', 18 | 'server/server_hook.lua', 19 | 'server/main.lua', 20 | 21 | } 22 | 23 | ui_page 'html/ui.html' 24 | 25 | files { 26 | 'html/ui.html', 27 | 'html/app.css', 28 | 'html/app.js', 29 | 'html/*.png', 30 | 'html/*.otf', 31 | 'html/images/*.png' 32 | } -------------------------------------------------------------------------------- /cas-market/html/Satoshi-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/Satoshi-Bold.otf -------------------------------------------------------------------------------- /cas-market/html/Satoshi-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/Satoshi-Regular.otf -------------------------------------------------------------------------------- /cas-market/html/app.css: -------------------------------------------------------------------------------- 1 | 2 | @font-face { 3 | font-family: "Satoshi"; 4 | src: url(Satoshi-Bold.otf) 5 | } 6 | * { 7 | padding: 0; 8 | margin: 0; 9 | } 10 | 11 | 12 | 13 | .casNotify { 14 | display: flex; 15 | justify-content: center; 16 | align-items: center; 17 | width: auto; 18 | height: auto; 19 | left: 50%; 20 | transform: translate(-50%); 21 | position: absolute; 22 | 23 | flex-shrink: 0; 24 | border-radius: 19.911px; 25 | background: transparent; 26 | color: #BBB; 27 | font-size: 28.493px; 28 | font-family: Satoshi; 29 | font-style: normal; 30 | font-weight: 500; 31 | } 32 | 33 | 34 | .back-container { 35 | overflow: hidden; 36 | width: 100vw; 37 | height: 100vh; 38 | background-image: url("home.png"); 39 | background-size: cover; 40 | background-repeat: no-repeat; 41 | background-position: center; 42 | } 43 | 44 | 45 | 46 | .main-container { 47 | display: flex; 48 | position: absolute; 49 | top: 50%; 50 | left: 50%; 51 | transform: translate(-50%, -50%); 52 | width: 75%; 53 | height: 75%; 54 | } 55 | 56 | 57 | .left-container { 58 | width: 100%; 59 | margin-right: 3vh; 60 | } 61 | 62 | 63 | 64 | 65 | .header-div { 66 | display: flex; 67 | align-items: center; 68 | justify-content: center; 69 | width: 100%; 70 | height: 5vh; 71 | margin-bottom: 2vh; 72 | 73 | } 74 | 75 | .search-bar { 76 | display: flex; 77 | align-items: center; 78 | justify-content: flex-start; 79 | width: 100%; 80 | height: 100%; 81 | border-radius: 5.391px; 82 | padding-left: 2vh; 83 | border: 1.078px solid #3E3C41; 84 | background: radial-gradient(70.12% 70.12% at 50.00% 50.00%, rgba(67, 67, 67, 0.00) 0%, rgba(11, 10, 14, 0.10) 100%); 85 | } 86 | 87 | 88 | 89 | .searchBar-input { 90 | height: 100%; 91 | background: none; 92 | display: flex; 93 | align-items: center; 94 | justify-content: flex-start; 95 | border: none; 96 | outline: none; 97 | color: #8C8C8C; 98 | text-align: center; 99 | font-size: 1.5vh; 100 | font-family: Satoshi; 101 | font-style: normal; 102 | font-weight: 700; 103 | line-height: normal; 104 | } 105 | 106 | #svg { 107 | position: relative; 108 | left: 1vh; 109 | } 110 | 111 | 112 | .action-bar { 113 | display: flex; 114 | align-items: center; 115 | justify-content: flex-end; 116 | width: 70%; 117 | height: 100%; 118 | } 119 | 120 | 121 | .action { 122 | margin-left: 1.1vh; 123 | width: 5.4vh; 124 | height: 5.3vh; 125 | border-radius: 2.695px; 126 | outline: none; 127 | border: none; 128 | background: linear-gradient(141deg, rgba(217, 217, 217, 0.07) 0%, rgba(217, 217, 217, 0.00) 100%); 129 | } 130 | 131 | 132 | .item-body { 133 | display: flex; 134 | align-items: flex-start; 135 | justify-content: center; 136 | flex-wrap: wrap; 137 | width: 100%; 138 | height: 100%; 139 | overflow-y: auto; 140 | } 141 | 142 | .itemBox { 143 | padding: 2vh; 144 | display: flex; 145 | align-items: center; 146 | justify-content: center; 147 | flex-direction: column; 148 | margin: 1.4vh; 149 | width: 17vh; 150 | height: 14.5vh; 151 | border-radius: 6.324px; 152 | border: 1.265px solid #242226; 153 | background: radial-gradient(70.12% 70.12% at 50.00% 50.00%, rgba(255, 255, 255, 0.055) 0%, rgba(11, 10, 14, 0.10) 100%); 154 | } 155 | 156 | .img-box { 157 | width: 100%; 158 | display: flex; 159 | align-items: flex-start; 160 | justify-content: center; 161 | 162 | } 163 | 164 | .img-box img { 165 | width: 7vh; 166 | height: 7vh; 167 | } 168 | 169 | .item-name { 170 | height: 100%; 171 | width: 100%; 172 | display: flex; 173 | align-items: center; 174 | justify-content: center; 175 | color: #A4A4A4; 176 | font-size: 1.2vh; 177 | font-family: Satoshi; 178 | font-style: normal; 179 | font-weight: 700; 180 | line-height: normal; 181 | text-transform: uppercase; 182 | position: relative; 183 | top: 1vh; 184 | } 185 | 186 | .button-container { 187 | display: flex; 188 | align-items: center; 189 | justify-content: center; 190 | width: 100%; 191 | height: 100%; 192 | } 193 | 194 | .addToCart { 195 | color: #FFF; 196 | font-size: 1.1vh; 197 | font-family: Satoshi; 198 | font-style: normal; 199 | font-weight: 700; 200 | line-height: normal; 201 | border: none; 202 | outline: none; 203 | border-radius: 1.48px; 204 | background: #6C4FF5; 205 | box-shadow: 0px 0px 19.99262237548828px 0px rgba(108, 79, 245, 0.22); 206 | width: 9vh; 207 | height: 3.2vh; 208 | flex-shrink: 0; 209 | margin-right: 1vh; 210 | 211 | } 212 | 213 | .priceOfItem { 214 | display: flex; 215 | align-items: center; 216 | justify-content: center; 217 | color: #7D62F9; 218 | font-size: 1.2vh; 219 | font-family: Satoshi; 220 | font-style: normal; 221 | font-weight: 700; 222 | line-height: normal; 223 | width: 5vh; 224 | height: 3.2vh; 225 | border-radius: 1.48px; 226 | border: 0.6px solid #6C4FF5; 227 | background: rgba(108, 79, 245, 0.15); 228 | box-shadow: 0px 0px 19.99262237548828px 0px rgba(108, 79, 245, 0.22); 229 | } 230 | 231 | .active { 232 | border: 1px solid rgb(10, 10, 10); 233 | background: rgba(89, 33, 219, 0.623); 234 | } 235 | 236 | ::-webkit-scrollbar { 237 | width: 0.4vw; 238 | background: rgba(255, 255, 255, 0.13); 239 | } 240 | 241 | ::-webkit-scrollbar-thumb { 242 | background: #8D75EC; 243 | box-shadow: 0px 0px 4.2vh #8D75EC; 244 | border-radius: 0.4vh; 245 | } 246 | 247 | ::-webkit-scrollbar-thumb:hover { 248 | background: #8D75EC; 249 | box-shadow: 0px 0px 4.2vh #8D75EC; 250 | } 251 | 252 | 253 | 254 | 255 | .right-container { 256 | display: flex; 257 | align-items: center; 258 | justify-content: center; 259 | flex-direction: column; 260 | width: 70%; 261 | height: 100%; 262 | } 263 | 264 | 265 | .header-right { 266 | display: flex; 267 | align-items: flex-start; 268 | justify-content: center; 269 | flex-direction: column; 270 | width: 100%; 271 | margin-bottom: 1vh; 272 | } 273 | 274 | .header-top { 275 | color: #828282; 276 | font-size: 33.926px; 277 | font-family: Satoshi; 278 | font-style: normal; 279 | font-weight: 900; 280 | line-height: 162%; 281 | letter-spacing: 1.866px; 282 | margin: 0; 283 | } 284 | 285 | .footer-top { 286 | color: #575757; 287 | font-size: 20.214px; 288 | font-family: Satoshi; 289 | font-style: normal; 290 | font-weight: 500; 291 | line-height: 162%; 292 | margin: 0; 293 | /* letter-spacing: 1.112px; */ 294 | } 295 | 296 | .right-body { 297 | display: flex; 298 | padding-top: 3.4vh; 299 | padding-bottom: 3.4vh; 300 | justify-content: center; 301 | align-items: center; 302 | flex-direction: column; 303 | width: 100%; 304 | height: 100%; 305 | border-radius: 6.324px; 306 | border: 1.265px solid #242226; 307 | background: radial-gradient(70.12% 70.12% at 50.00% 50.00%, rgba(99, 99, 99, 0.00) 0%, rgba(11, 10, 14, 0.10) 100%); 308 | } 309 | 310 | 311 | .shopcart { 312 | display: flex; 313 | align-items: flex-start; 314 | justify-content: center; 315 | width: 90%; 316 | height: 100%; 317 | flex-wrap: wrap; 318 | overflow-x: auto; 319 | } 320 | 321 | 322 | .shopItem { 323 | display: flex; 324 | width: 100%; 325 | height: 11vh; 326 | border-radius: 5.717px; 327 | border: 1.143px solid #242226; 328 | margin-bottom: 2.1vh; 329 | background: radial-gradient(70.12% 70.12% at 50.00% 50.00%, rgba(99, 99, 99, 0.00) 0%, rgba(11, 10, 14, 0.10) 100%); 330 | } 331 | 332 | 333 | .shopItem-left { 334 | display: flex; 335 | align-items: center; 336 | justify-tracks: center; 337 | width: 100%; 338 | height: 100%; 339 | } 340 | 341 | .shopItem-img { 342 | display: flex; 343 | align-items: center; 344 | justify-content: center; 345 | width: 10vh; 346 | height: 100%; 347 | margin-right: 2vh; 348 | padding: 2vh; 349 | } 350 | 351 | .shopItem-img img { 352 | width: 8.5vh; 353 | height: 8vh; 354 | } 355 | 356 | .shopItem-right { 357 | display: flex; 358 | align-items: center; 359 | justify-content: center; 360 | width: 45%; 361 | height: 100%; 362 | position: relative; 363 | } 364 | 365 | .shopItem-info { 366 | display: flex; 367 | align-items: flex-start; 368 | justify-content: center; 369 | flex-direction: column; 370 | } 371 | 372 | .shopItem-name { 373 | color: #FFF; 374 | font-size: 14.969px; 375 | font-family: Satoshi; 376 | font-style: normal; 377 | font-weight: 700; 378 | line-height: 162%; 379 | letter-spacing: 0.823px; 380 | } 381 | 382 | .shopItem-price { 383 | color: #35FF93; 384 | font-size: 18.619px; 385 | font-family: Satoshi; 386 | font-style: normal; 387 | font-weight: 700; 388 | line-height: 162%; 389 | letter-spacing: 1.024px; 390 | } 391 | 392 | .countDown { 393 | display: flex; 394 | align-items: center; 395 | justify-content: center; 396 | width: 21.337px; 397 | height: 21.337px; 398 | border: none; 399 | outline: none; 400 | flex-shrink: 0; 401 | border-radius: 3.369px; 402 | background: rgba(245, 79, 79, 0.20); 403 | color: #F54F4F; 404 | font-size: 12.617px; 405 | font-family: Satoshi; 406 | font-style: normal; 407 | font-weight: 700; 408 | line-height: 162%; 409 | letter-spacing: 0.694px; 410 | } 411 | 412 | .currentCount { 413 | display: flex; 414 | align-items: center; 415 | justify-content: center; 416 | width: 51.214px; 417 | height: 24.259px; 418 | flex-shrink: 0; 419 | border-radius: 3.594px; 420 | background: rgba(108, 79, 245, 0.20); 421 | color: #A693FF; 422 | font-size: 12.617px; 423 | font-family: Satoshi; 424 | font-style: normal; 425 | font-weight: 700; 426 | line-height: 162%; 427 | letter-spacing: 0.694px; 428 | } 429 | 430 | .countUp { 431 | display: flex; 432 | align-items: center; 433 | justify-content: center; 434 | width: 21.337px; 435 | height: 21.337px; 436 | border: none; 437 | outline: none; 438 | flex-shrink: 0; 439 | border-radius: 3.369px; 440 | background: rgba(79, 245, 116, 0.20); 441 | color: #4FF574; 442 | font-size: 12.617px; 443 | font-family: Satoshi; 444 | font-style: normal; 445 | font-weight: 700; 446 | line-height: 162%; 447 | letter-spacing: 0.694px; 448 | } 449 | 450 | .act-btn { 451 | margin-right: 0.77vh; 452 | } 453 | 454 | .right-altBody { 455 | display: flex; 456 | justify-content: center; 457 | align-items: center; 458 | flex-direction: column; 459 | width: 100%; 460 | height: 50%; 461 | } 462 | 463 | 464 | .total-div { 465 | height: 100%; 466 | width: 100%; 467 | } 468 | 469 | 470 | 471 | 472 | .total-div { 473 | display: flex; 474 | width: 85%; 475 | align-items: center; 476 | justify-content: center; 477 | } 478 | 479 | .total-text { 480 | display: flex; 481 | align-items: center; 482 | justify-content: flex-start; 483 | width: 50%; 484 | height: 100%; 485 | color: #676767; 486 | font-size: 24.593px; 487 | font-family: Satoshi; 488 | font-style: normal; 489 | font-weight: 700; 490 | } 491 | 492 | .total-price { 493 | width: 50%; 494 | display: flex; 495 | align-items: center; 496 | justify-content: flex-end; 497 | height: 100%; 498 | color: #9A85FF; 499 | font-size: 30.655px; 500 | font-family: Satoshi; 501 | font-style: normal; 502 | font-weight: 900; 503 | line-height: 162%; 504 | letter-spacing: 1.686px; 505 | } 506 | 507 | 508 | 509 | .shopping-act-div { 510 | display: flex; 511 | align-items: center; 512 | justify-content: center; 513 | height: 100%; 514 | width: 85%; 515 | } 516 | 517 | 518 | .left-btn-cont { 519 | display: flex; 520 | align-items: center; 521 | justify-content: flex-start; 522 | width: 100%; 523 | height: 100%; 524 | } 525 | .right-btn-cont { 526 | display: flex; 527 | align-items: center; 528 | justify-content: flex-end; 529 | width: 100%; 530 | height: 100%; 531 | } 532 | .paywithcard { 533 | display: flex; 534 | align-items: center; 535 | justify-content: center; 536 | width: 19vh; 537 | height: 5.1vh; 538 | color: #FAFAFA; 539 | font-size: 13.054px; 540 | font-family: Satoshi; 541 | font-style: normal; 542 | font-weight: 600; 543 | line-height: 162%; 544 | letter-spacing: 0.718px; 545 | outline: none; 546 | border: none; 547 | border-radius: 2.193px; 548 | background: #9A85FF; 549 | } 550 | 551 | .paywithcash { 552 | display: flex; 553 | align-items: center; 554 | justify-content: center; 555 | width: 19vh; 556 | height: 5.1vh; 557 | color: #1A1A1A; 558 | font-size: 13.054px; 559 | font-family: Satoshi; 560 | font-style: normal; 561 | font-weight: 600; 562 | line-height: 162%; 563 | letter-spacing: 0.718px; 564 | outline: none; 565 | border: none; 566 | border-radius: 2.193px; 567 | background: #FF85A2; 568 | } 569 | -------------------------------------------------------------------------------- /cas-market/html/app.js: -------------------------------------------------------------------------------- 1 | var inventoryPatch = "nui://qb-inventory/html/images" 2 | 3 | 4 | window.addEventListener("message",function(data){ 5 | let item = data.data 6 | if (item.action == "market") { 7 | ShowMarket(item.items) 8 | } 9 | }) 10 | 11 | 12 | const ShowMarket = function(data) { 13 | console.log(JSON.stringify(data)) 14 | $("div.back-container").fadeIn(300, function() { 15 | let values = "" 16 | $("div.main-container").fadeIn(500) 17 | if (data.length > 0) { 18 | for (let index = 0; index < data.length; index++) { 19 | const element = data[index]; 20 | values = ` 21 |
22 |
23 | 24 |
25 |
${element.label}
26 |
27 | 30 |
$${element.price}
31 |
32 |
33 | ` + values 34 | } 35 | $(".item-body").html(values) 36 | } 37 | }) 38 | } 39 | 40 | $(document).ready(function() { 41 | $('.action').on('click', function() { 42 | const target = $(this).data('target'); 43 | 44 | if (target === 'all') { 45 | $('.itemBox').show(); 46 | } else { 47 | $('.itemBox').each(function() { 48 | const value = $(this).attr('value'); 49 | if (value === target) { 50 | $(this).show(); 51 | } else { 52 | $(this).hide(); 53 | } 54 | }); 55 | } 56 | $(this).addClass('active').siblings().removeClass('active'); 57 | }); 58 | }); 59 | 60 | function displayCart() { 61 | var cartArray = shoppingCart.listCart(); 62 | var output = ""; 63 | for(var i in cartArray) { 64 | console.log(cartArray[i].img) 65 | output += `
66 |
67 |
68 | 69 |
70 |
71 |
${cartArray[i].name}
72 |
${cartArray[i].price}$
73 |
74 |
75 |
76 | 77 |
x${cartArray[i].count}
78 | 79 |
80 |
` 81 | } 82 | $('.shopcart').html(output); 83 | $('.total-price').html(shoppingCart.totalCart()+ "$"); 84 | } 85 | 86 | 87 | $(document).on("click", ".addToCart", function() { 88 | var name = $(this).data('name'); 89 | let itemCheck = shoppingCart.getItemByName(name) 90 | if (itemCheck) { 91 | return 92 | } 93 | var price = Number($(this).data('price')); 94 | shoppingCart.addItemToCart(name, price, 1, $(this).data("img")); 95 | displayCart(); 96 | }); 97 | 98 | $(document).on("click", ".pay", function() { 99 | console.log("paid"); 100 | var cartArray = shoppingCart.listCart(); 101 | var paymentMethod = $(this).hasClass("paywithcard") ? "bank" : "cash"; 102 | console.log(paymentMethod); 103 | $.post("https://cas-market/CompleteOrder", JSON.stringify({ 104 | item: cartArray, 105 | price: shoppingCart.totalCart(), 106 | method : paymentMethod 107 | }), function(result) { 108 | if (result) { 109 | shoppingCart.clearCart(); 110 | displayCart(); 111 | $(".back-container").hide(); 112 | $(".main-container").hide(); 113 | $.post("https://cas-market/EscapeFromJs"); 114 | } 115 | }); 116 | }); 117 | 118 | 119 | $(document).ready(function() { 120 | $('.searchBar-input').on('input', function() { 121 | const query = $(this).val().toLowerCase(); 122 | 123 | $('.itemBox').each(function() { 124 | const itemName = $(this).find('.item-name').text().toLowerCase(); 125 | 126 | if (itemName.includes(query)) { 127 | $(this).show(); 128 | } else { 129 | $(this).hide(); 130 | } 131 | }); 132 | }); 133 | }); 134 | 135 | 136 | 137 | // -1 138 | $(document).on("click", ".countDown", function(event) { 139 | var name = $(this).data('name') 140 | shoppingCart.removeItemFromCart(name); 141 | displayCart(); 142 | }) 143 | // +1 144 | $(document).on("click", ".countUp", function(event) { 145 | var name = $(this).data('name') 146 | shoppingCart.setCountForItem(name, shoppingCart.getCountByName(name) + 1); 147 | displayCart(); 148 | }) 149 | 150 | 151 | $(document).on("change", ".currentCount", function(event) { 152 | var name = $(this).data('name'); 153 | var count = Number($(this).val()); 154 | shoppingCart.setCountForItem(name, count); 155 | displayCart(); 156 | }); 157 | 158 | var shoppingCart = (function() { 159 | cart = []; 160 | 161 | function Item(name, price, count,img) { 162 | this.name = name; 163 | this.price = price; 164 | this.count = count; 165 | this.img = img 166 | } 167 | 168 | 169 | function saveCart() { 170 | sessionStorage.setItem('shoppingCart', JSON.stringify(cart)); 171 | } 172 | 173 | function loadCart() { 174 | cart = JSON.parse(sessionStorage.getItem('shoppingCart')); 175 | } 176 | if (sessionStorage.getItem("shoppingCart") != null) { 177 | loadCart(); 178 | } 179 | var obj = {}; 180 | 181 | 182 | obj.addItemToCart = function(name, price, count, img) { 183 | for(var item in cart) { 184 | if(cart[item].name === name) { 185 | cart[item].count ++; 186 | saveCart(); 187 | return; 188 | } 189 | } 190 | var item = new Item(name, price, count, img); 191 | cart.push(item); 192 | saveCart(); 193 | } 194 | obj.getImgByName = function(name) { 195 | for (var item in cart) { 196 | if (cart[item].name === name){ 197 | return cart[item].img 198 | } 199 | } 200 | return false 201 | } 202 | obj.setCountForItem = function(name, count) { 203 | for(var i in cart) { 204 | if (cart[i].name === name) { 205 | cart[i].count = count; 206 | break; 207 | } 208 | } 209 | }; 210 | obj.removeItemFromCart = function(name) { 211 | for(var item in cart) { 212 | if(cart[item].name === name) { 213 | cart[item].count --; 214 | if(cart[item].count === 0) { 215 | cart.splice(item, 1); 216 | } 217 | break; 218 | } 219 | } 220 | saveCart(); 221 | } 222 | obj.getItemByName = function(name) { 223 | for (var item in cart) { 224 | if (cart[item].name === name){ 225 | return true 226 | } 227 | } 228 | return false 229 | } 230 | obj.getCountByName = function(name) { 231 | for (var item in cart) { 232 | if (cart[item].name == name) { 233 | return cart[item].count 234 | } 235 | } 236 | return 0 237 | } 238 | 239 | obj.removeItemFromCartAll = function(name) { 240 | for(var item in cart) { 241 | if(cart[item].name === name) { 242 | cart.splice(item, 1); 243 | break; 244 | } 245 | } 246 | saveCart(); 247 | } 248 | 249 | 250 | obj.clearCart = function() { 251 | cart = []; 252 | saveCart(); 253 | } 254 | 255 | 256 | obj.totalCount = function() { 257 | var totalCount = 0; 258 | for(var item in cart) { 259 | totalCount += cart[item].count; 260 | } 261 | return totalCount; 262 | } 263 | 264 | 265 | obj.totalCart = function() { 266 | var totalCart = 0; 267 | for(var item in cart) { 268 | totalCart += cart[item].price * cart[item].count; 269 | } 270 | return Number(totalCart.toFixed(2)); 271 | } 272 | 273 | 274 | obj.listCart = function() { 275 | var cartCopy = []; 276 | for(i in cart) { 277 | item = cart[i]; 278 | itemCopy = {}; 279 | for(p in item) { 280 | itemCopy[p] = item[p]; 281 | 282 | } 283 | itemCopy.total = Number(item.price * item.count).toFixed(2); 284 | cartCopy.push(itemCopy) 285 | } 286 | return cartCopy; 287 | } 288 | return obj; 289 | })(); 290 | 291 | document.addEventListener("keydown",function(key) { 292 | if (key.isComposing || key.keyCode === 229) { 293 | return; 294 | } 295 | if (key.keyCode == 27) { 296 | $(".back-container").hide() 297 | $(".main-container").hide() 298 | $.post("https://cas-market/EscapeFromJs") 299 | } 300 | }) 301 | -------------------------------------------------------------------------------- /cas-market/html/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/home.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_flashlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_flashlight.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_golfclub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_golfclub.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_gusenberg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_gusenberg.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_hammer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_hammer.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_hatchet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_hatchet.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_heavypistol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_heavypistol.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_heavyshotgun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_heavyshotgun.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_heavysniper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_heavysniper.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_heavysniper_mk2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_heavysniper_mk2.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_knife.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_knife.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_knuckle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_knuckle.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_machete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_machete.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_machinepistol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_machinepistol.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_microsmg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_microsmg.png -------------------------------------------------------------------------------- /cas-market/html/images/weapon_smg_mk2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/images/weapon_smg_mk2.png -------------------------------------------------------------------------------- /cas-market/html/resim_2023-07-02_024117088-removebg-preview 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mb-later/CAS-Market/519ec34863df9893c4f0b07735a7f957dd5360cd/cas-market/html/resim_2023-07-02_024117088-removebg-preview 1.png -------------------------------------------------------------------------------- /cas-market/html/ui.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 188 | -------------------------------------------------------------------------------- /cas-market/server/main.lua: -------------------------------------------------------------------------------- 1 | local function Content(source,data) 2 | local retval = false 3 | local items = data.item 4 | local price = data.price 5 | local method = data.method 6 | local xPlayer = GetPlayer(source) 7 | if not xPlayer then print("Error Code 18, Open ticket") return end 8 | for i,j in pairs(items) do 9 | for k in pairs(CAS.Items) do 10 | if j.name == CAS.Items[k].label then 11 | local checkMoney = RemoveMoney(source, method, price) 12 | if checkMoney then AddItem(source, k, j.count) retval = true end 13 | end 14 | end 15 | end 16 | return retval 17 | end 18 | 19 | if CAS.Framework == "qb" then 20 | QBCore.Functions.CreateCallback("cas-server:BuyProducts",function(source,cb,data) 21 | local check = Content(source, data) 22 | cb(check) 23 | end) 24 | elseif CAS.Framework == "esx" then 25 | ESX.RegisterServerCallback("cas-server:BuyProducts",function(source,cb,data) 26 | local check = Content(source, data) 27 | cb(check) 28 | end) 29 | end 30 | 31 | -------------------------------------------------------------------------------- /cas-market/server/server_hook.lua: -------------------------------------------------------------------------------- 1 | if CAS.Framework == "qb" then 2 | QBCore = exports["qb-core"]:GetCoreObject() 3 | else 4 | ESX = exports["es_extended"]:getSharedObject() 5 | end 6 | 7 | 8 | GetPlayer = function(playerId) 9 | if CAS.Framework == "qb" then 10 | return QBCore.Functions.GetPlayer(playerId) 11 | else 12 | return ESX.GetPlayerFromId(playerId) 13 | end 14 | end 15 | 16 | 17 | AddItem = function(player,itemName, count) 18 | local xPlayer = GetPlayer(player) 19 | if CAS.Framework == "qb" then 20 | return xPlayer.Functions.AddItem(itemName, count) 21 | else 22 | return xPlayer.addInventoryItem(itemName, count) 23 | end 24 | end 25 | 26 | 27 | Notify = function(source, text) 28 | if CAS.Framework == "qb" then 29 | return TriggerClientEvent("QBCore:Notify",source, text) 30 | else 31 | local xPlayer = GetPlayer(source) 32 | return xPlayer.showNotification(text) 33 | end 34 | end 35 | 36 | RemoveMoney = function(source, method, price) 37 | local player = GetPlayer(source) 38 | if CAS.Framework == "qb" then 39 | if player.Functions.GetMoney(method) >= price then 40 | player.Functions.RemoveMoney(method, price) 41 | return true 42 | else 43 | Notify(source, "You don't have enough money.") 44 | end 45 | else 46 | if player.getAccount(method).money >= price then 47 | player.removeAccountMoney(method, price) 48 | return true 49 | else 50 | Notify(source, "You don't have enough money.") 51 | end 52 | end 53 | return false 54 | end 55 | 56 | 57 | --------------------------------------------------------------------------------