This commit is contained in:
Nordi98 2025-07-14 18:07:59 +02:00
parent ad226c88a2
commit 8254b4913c
12 changed files with 145 additions and 0 deletions

View file

@ -0,0 +1,67 @@
-- How to use
-- CircuitGame('x', 'y', 'scale', 'tamanho do jogo em vmin', '1.ogg', function()
-- run something
-- end)

-- parameters
-- x = position on screen
-- y = position on screen
-- scale = game size on screen in scale (Normally 1.0)
-- sound_name = audio name + format (example 1.ogg)

-- example
-- TriggerEvent("Mx::StartMinigameElectricCircuit", '50%', '92%', '1.0', '30vmin', '1.ogg', function()
-- print("Oops, I hit the code and ran something")
-- end)

-- /startgame 50% 50% 1.0 30vmin 1.ogg

CallBackFunction = nil

RegisterCommand('startgame', function(src, args, cmd)
TriggerEvent("Mx::StartMinigameElectricCircuit", args[1], args[2], args[3], args[4], args[5], function()
print(">>>>>> Success <<<<<<")
end)
end, false)

RegisterNetEvent('Mx::StartMinigameElectricCircuit')
AddEventHandler('Mx::StartMinigameElectricCircuit', function(x, y, scale, size_game, sound_name, Callback)
CircuitGame(x, y, scale, size_game, sound_name, Callback)
end)

function CircuitGame(x, y, scale, size_game, sound_name, Callback)
SetNuiFocus(true,true)
SendNUIMessage({
ui = 'ui',
NuiOpen = true,
x = x,
y = y,
scale = scale,
size_game = size_game,
sound_name = sound_name,
name_resource = GetCurrentResourceName()
})
CallBackFunction = Callback
end

RegisterNUICallback('electric_circuit_completed', function(data, cb)
CallBackFunction()
CloseNui()
cb('ok')
end)

RegisterNUICallback('CloseNui', function(data, cb)
CloseNui()
cb('ok')
end)

function CloseNui()
local ped = PlayerPedId()
ClearPedTasks(ped)

SetNuiFocus(false, false)
SendNUIMessage({
ui = 'ui',
NuiOpen = false,
})
end

View file

@ -0,0 +1,27 @@
fx_version 'cerulean'

game 'gta5'

description 'Mx Fix Wiring'

version '1.1'

ui_page 'html/index.html'


server_scripts {
'server/*'
}

client_scripts {
'client/*'
}

files {
'html/index.html',
'html/css/*.css',
'html/js/*.js',
'html/img/*.png',
'html/sound/*.ogg',
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.