Skip to content

Commit

Permalink
temp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitchel committed Sep 6, 2023
0 parents commit f1c8d45
Show file tree
Hide file tree
Showing 18 changed files with 750 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/blip.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CreateThread(function()
local blip = AddBlipForCoord(Config.blip.coords.x, Config.blip.coords.y, Config.blip.coords.z)
SetBlipSprite(blip, Config.blip.sprite)
SetBlipDisplay(blip, Config.blip.display)
SetBlipScale(blip, Config.blip.scale)
SetBlipColour(blip, Config.blip.color)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(Config.blip.label)
EndTextCommandSetBlipName(blip)
end)
7 changes: 7 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
RegisterNUICallback('exit', function()
SendNUIMessage({
type = "off",
game = "",
})
SetNuiFocus(false, false)
end)
70 changes: 70 additions & 0 deletions client/menus.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
local function GenerateOptions()
local options = {}
for i = 1, #Config.games, 1 do
options[#options + 1] = {
label = Config.games[i].label,
icon = Config.games[i].icon or 'fa-gamepad', -- WIP: Verplaatsen naar config voor fa-gamepad
}
end
return options
end

local function GenerateHacks()
local options = {}
for i = 1, #Config.hacks, 1 do
options[#options + 1] = {
label = Config.hacks[i].label,
icon = Config.hacks[i].icon or 'fa-gamepad', -- WIP: Verplaatsen naar config voor fa-gamepad
}
end
return options
end

CreateThread(function()
lib.registerMenu({
id = 'arcade_machine',
title = Lang:t('menu.arcade'),
position = 'top-right',
options = GenerateOptions(),
}, function(selected, scrollIndex, args)
SendNUIMessage({
type = "on",
game = Config.games[selected].args,
gpu = "ETX2080",
cpu = "U9_9900"
})
SetNuiFocus(true, true)
end)

lib.registerMenu({
id = 'arcade_hacking',
title = Lang:t('menu.special'),
position = 'top-right',
options = GenerateHacks(),
}, function(selected, scrollIndex, args)
Config.hacks[selected].action()
end)

lib.registerContext({
id = 'arcade_purchase_token',
title = Lang:t('menu.purchase_token'):format(Config.TokenPrice),
options = {{
title = Lang:t('menu.purchase_token'):format(Config.TokenPrice),
icon = 'fa-shopping-cart',
onSelect = function()
local amount = lib.inputDialog(Lang:t('menu.amount'), {
{
label = Lang:t('menu.amount'),
type = 'number',
min = 1,
required = true,
}
})
if amount then
TriggerServerEvent('qb-arcade:server:buyToken', amount[1])
end
end

}}
})
end)
52 changes: 52 additions & 0 deletions client/target.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
local models = {1876055757, -1501557515, -1502319666, 815879628, -1991361770, 1301167921, -538006270, 2303605526, 4185618299, 3756961026, 2793409781, 398786301, 568464183, 3067040863, 3171514707, 3899793496, 974001996, 4206216415, 1457191833, 3054877820, 4129005630, 3963576280, 3325005861, 543442061, 372224036, -1273554963} -- WIP: Verplaatsen naar config?


local function requireToken()
if not lib.callback.await('qb-arcade:server:hasToken') then

lib.notify({
title = Lang:t('error.no_token_title'),
description = Lang:t('error.no_token'),
type = 'error',
})

return false
end

return true
end

CreateThread(function()

exports['qb-target']:AddTargetModel(models, {
options = {
{
num = 1,
icon = 'fas fa-gamepad',
label = Lang:t('target.arcade'),
action = function()
if not requireToken() then return end
lib.showMenu('arcade_machine')
end
},
{
num = 2,
icon = 'fas fa-circle-dot',
label = Lang:t('target.special'),
action = function()
if not requireToken() then return end
lib.showMenu('arcade_hacking')
end
},
},
})
end)

AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() then
for _, v in ipairs(models) do
exports['qb-target']:RemoveTargetModel(v, Lang:t('target.arcade'))
exports['qb-target']:RemoveTargetModel(v, Lang:t('target.special'))
end
end
end)
28 changes: 28 additions & 0 deletions client/tokens.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
local function Nearby()
if IsControlJustPressed(0, 38) then
lib.showContext('arcade_purchase_token')
return
end
end

CreateThread(function()
for _, v in ipairs(Config.Zones) do
lib.points.new({
coords = v,
distance = 3,

onEnter = function()
lib.showTextUI(Lang:t('interactions.enter_token_shop'), {
position = "left-center",
icon = 'e'
})
end,

onExit = function()
lib.hideTextUI()
end,

nearby = Nearby
})
end
end)
113 changes: 113 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
Config = {}
QBCore = exports['qb-core']:GetCoreObject()

-- Item that players get when they buy tokens and use to pay for a game.
Config.TokenItem = "gametoken" -- WIP (Item name: Game Token)
Config.TokenPrice = "5"
Config.PaymentType = "cash" -- WIP

Config.Zones = {
vector3(-1654.7384033203, -1063.3900146484, 12.160423278809)
}

Config.blip = {
coords = vector3(-1655.7844238281, -1066.8046875, 12.160425186157),
label = "Arcade",
sprite = 484,
color = 0,
scale = 0.7,
display = 2,
}

Config.games = {
{
label = "Pacman",
args = "http://xogos.robinko.eu/PACMAN/",
icon = 'ghost'
},
{
label = "Tetris",
args = "http://xogos.robinko.eu/TETRIS/",
icon = "cube"
},
{
label = "Uno",
args = "https://duowfriends.eu/",
icon = "diamond"
},
{
label = "FlappyParrot",
args = "http://xogos.robinko.eu/FlappyParrot/",
icon = "dove"
},
{
label = 'slither',
args = 'http://slither.io',
icon = 'staff-snake',
},
{
label = 'Duke Nukem 3D',
args = string.format("nui://qb-arcade/html/msdos.html?url=%s&params=%s", "https://www.retrogames.cz/dos/zip/duke3d.zip", "./DUKE3D.EXE"),
icon = 'gun'
},
{
label = 'DOOM',
args = string.format("nui://qb-arcade/html/msdos.html?url=%s&params=%s", "https://www.retrogames.cz/dos/zip/Doom.zip", "./DOOM.EXE"),
icon = 'gun'
}
}

Config.hacks = {
{
label = "Rondjes",
icon = 'fa-regular fa-circle',
action = function()
exports['ps-ui']:Circle(function(success)
if success then
QBCore.Functions.Notify("Je hebt de hack voltooid!", "success")
else
QBCore.Functions.Notify("Je hebt de hack gefaald!", "error")
end
end, 2, 20) -- NumberOfCircles, MS
end
},
{
label = "Speurtocht",
icon = 'search',
action = function()
exports['ps-ui']:Maze(function(success)
if success then
QBCore.Functions.Notify("Je hebt de hack voltooid!", "success")
else
QBCore.Functions.Notify("Je hebt de hack gefaald!", "error")
end
end, 20)
end
},
{
label = "VR",
icon = 'vr-cardboard',
action = function()
exports['ps-ui']:VarHack(function(success)
if success then
QBCore.Functions.Notify("Je hebt de hack voltooid!", "success")
else
QBCore.Functions.Notify("Je hebt de hack gefaald!", "error")
end
end, math.random(3,5), math.random(6,9))
end
},
{
label = "blokjes",
icon = 'fa-chess-board',
action = function()
exports['ps-ui']:Thermite(function(success)
if success then
QBCore.Functions.Notify("Je hebt de hack voltooid!", "success")
else
QBCore.Functions.Notify("Je hebt de hack gefaald!", "error")
end
end, 10, 5, 3) -- Time, Gridsize (5, 6, 7, 8, 9, 10), IncorrectBlocks
end
}
}
30 changes: 30 additions & 0 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
fx_version 'adamant'
game 'gta5'
lua54 'yes'

client_scripts {
'client/*',
}

server_scripts {
'server.lua',
}

shared_scripts {
'@ox_lib/init.lua',
'@qb-core/shared/locale.lua',
'locales/en.lua',
'locales/*.lua',
'config.lua'
}

files {
"html/css/style.css",
"html/css/reset.css",
"html/css/img/monitor.png",
"html/css/img/table.png",
"html/*.html",
"html/scripts/listener.js",
}

ui_page "html/index.html"
Binary file added gametoken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added html/css/img/monitor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions html/css/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
Loading

0 comments on commit f1c8d45

Please sign in to comment.