Add FiveM resources and templates for documentation and code snippets
- Introduced a new code snippets resource for common FiveM patterns in Lua and JavaScript. - Added a framework comparison document outlining Standalone, ESX, and QBCore features. - Created search results view for FiveM documentation queries. - Developed client and server template scripts for ESX and QBCore frameworks. - Implemented NUI templates including HTML, CSS, and JavaScript for user interfaces. - Established routes for documentation and console commands. - Added tests for various features including documentation routes and tool functionalities. - Configured Vite for asset management with Laravel. - Updated .gitignore files for storage and framework directories.
This commit is contained in:
112 files changed
+51106
No files matched your search
@@ -0,0 +1,31 @@
|
||||
// Client-side script
|
||||
|
||||
@if($framework === 'esx')
|
||||
let ESX = null;
|
||||
|
||||
on('esx:getSharedObject', (obj) => { ESX = obj; });
|
||||
|
||||
@elseif($framework === 'qbcore')
|
||||
const QBCore = exports['qb-core'].GetCoreObject();
|
||||
|
||||
@endif
|
||||
// Resource started
|
||||
on('onClientResourceStart', (resourceName) => {
|
||||
if (GetCurrentResourceName() !== resourceName) return;
|
||||
|
||||
console.log('Resource started on client');
|
||||
|
||||
// Your initialization code here
|
||||
});
|
||||
|
||||
// Example command
|
||||
RegisterCommand('test', () => {
|
||||
emit('chat:addMessage', {
|
||||
args: ['Script', 'Test command executed!']
|
||||
});
|
||||
}, false);
|
||||
|
||||
// Example thread
|
||||
setInterval(() => {
|
||||
// Your periodic code here
|
||||
}, 1000);
|
||||
@@ -0,0 +1,33 @@
|
||||
-- Client-side script
|
||||
|
||||
@if($framework === 'esx')
|
||||
ESX = exports['es_extended']:getSharedObject()
|
||||
|
||||
@elseif($framework === 'qbcore')
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
@endif
|
||||
-- Resource started
|
||||
AddEventHandler('onClientResourceStart', function(resourceName)
|
||||
if GetCurrentResourceName() ~= resourceName then return end
|
||||
|
||||
print('Resource started on client')
|
||||
|
||||
-- Your initialization code here
|
||||
end)
|
||||
|
||||
-- Example command
|
||||
RegisterCommand('test', function()
|
||||
TriggerEvent('chat:addMessage', {
|
||||
args = { 'Script', 'Test command executed!' }
|
||||
})
|
||||
end, false)
|
||||
|
||||
-- Example thread
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(1000)
|
||||
|
||||
-- Your periodic code here
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,14 @@
|
||||
// Configuration
|
||||
const Config = {
|
||||
Debug: false,
|
||||
|
||||
// Add your config options here
|
||||
Options: {
|
||||
example: true
|
||||
}
|
||||
};
|
||||
|
||||
// Export for use in other files
|
||||
if (typeof exports !== 'undefined') {
|
||||
exports('GetConfig', () => Config);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
Config = {}
|
||||
|
||||
Config.Debug = false
|
||||
|
||||
-- Add your config options here
|
||||
Config.Options = {
|
||||
example = true
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
|
||||
author '{{ $author }}'
|
||||
description '{{ $description }}'
|
||||
version '{{ $version }}'
|
||||
|
||||
@if($framework === 'esx')
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
@elseif($framework === 'qbcore')
|
||||
shared_script '@qb-core/shared/locale.lua'
|
||||
|
||||
@endif
|
||||
shared_scripts {
|
||||
@if($framework === 'esx')
|
||||
'@es_extended/locale.lua',
|
||||
'locales/*.lua',
|
||||
@endif
|
||||
'config.{{ $scriptExt }}'
|
||||
}
|
||||
|
||||
@if($includeClient)
|
||||
client_scripts {
|
||||
'client/main.{{ $scriptExt }}'
|
||||
}
|
||||
|
||||
@endif
|
||||
@if($includeServer)
|
||||
server_scripts {
|
||||
@if($framework === 'esx')
|
||||
'@mysql-async/lib/MySQL.lua',
|
||||
@elseif($framework === 'qbcore')
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
@endif
|
||||
'server/main.{{ $scriptExt }}'
|
||||
}
|
||||
|
||||
@endif
|
||||
-- Uncomment if using NUI
|
||||
-- ui_page 'html/index.html'
|
||||
--
|
||||
-- files {
|
||||
-- 'html/index.html',
|
||||
-- 'html/style.css',
|
||||
-- 'html/script.js'
|
||||
-- }
|
||||
|
||||
-- dependencies {
|
||||
@if($framework === 'esx')
|
||||
-- 'es_extended'
|
||||
@elseif($framework === 'qbcore')
|
||||
-- 'qb-core'
|
||||
@endif
|
||||
-- }
|
||||
|
||||
lua54 'yes'
|
||||
@@ -0,0 +1,40 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#app {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
background: rgba(0, 0, 0, 0.9);
|
||||
padding: 2rem;
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
button {
|
||||
background: #3b82f6;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #2563eb;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>FiveM NUI</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" style="display: none;">
|
||||
<div class="container">
|
||||
<h1>FiveM NUI Interface</h1>
|
||||
<p>Your UI content here</p>
|
||||
<button id="closeBtn">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
window.addEventListener('message', (event) => {
|
||||
const data = event.data;
|
||||
|
||||
if (data.action === 'show') {
|
||||
$('#app').fadeIn();
|
||||
} else if (data.action === 'hide') {
|
||||
$('#app').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
$('#closeBtn').click(() => {
|
||||
$.post(`https://${{ '{GetParentResourceName()}' }}/close`, JSON.stringify({}));
|
||||
$('#app').fadeOut();
|
||||
});
|
||||
|
||||
$(document).keyup((e) => {
|
||||
if (e.key === 'Escape') {
|
||||
$.post(`https://${{ '{GetParentResourceName()}' }}/close`, JSON.stringify({}));
|
||||
$('#app').fadeOut();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
window.addEventListener('message', function(event) {
|
||||
local data = event.data
|
||||
|
||||
if data.action == 'show' then
|
||||
$('#app').fadeIn()
|
||||
elseif data.action == 'hide' then
|
||||
$('#app').fadeOut()
|
||||
end
|
||||
end)
|
||||
|
||||
$('#closeBtn').click(function()
|
||||
$.post('https://' .. GetParentResourceName() .. '/close', JSON.stringify({}))
|
||||
$('#app').fadeOut()
|
||||
end)
|
||||
|
||||
$(document).keyup(function(e)
|
||||
if e.key == 'Escape' then
|
||||
$.post('https://' .. GetParentResourceName() .. '/close', JSON.stringify({}))
|
||||
$('#app').fadeOut()
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,37 @@
|
||||
// Server-side script
|
||||
|
||||
@if($framework === 'esx')
|
||||
const ESX = exports['es_extended'].getSharedObject();
|
||||
|
||||
@elseif($framework === 'qbcore')
|
||||
const QBCore = exports['qb-core'].GetCoreObject();
|
||||
|
||||
@endif
|
||||
// Resource started
|
||||
on('onServerResourceStart', (resourceName) => {
|
||||
if (GetCurrentResourceName() !== resourceName) return;
|
||||
|
||||
console.log('Resource started on server');
|
||||
|
||||
// Your initialization code here
|
||||
});
|
||||
|
||||
// Player connecting
|
||||
on('playerConnecting', (name, setKickReason, deferrals) => {
|
||||
const player = global.source;
|
||||
deferrals.defer();
|
||||
|
||||
// Check player here
|
||||
|
||||
deferrals.done();
|
||||
});
|
||||
|
||||
// Example server event
|
||||
onNet('resourceName:serverEvent', (data) => {
|
||||
const player = global.source;
|
||||
|
||||
console.log(`Received event from player ${{ '{player}' }}`);
|
||||
|
||||
// Trigger back to client
|
||||
emitNet('resourceName:clientEvent', player, { success: true });
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
-- Server-side script
|
||||
|
||||
@if($framework === 'esx')
|
||||
ESX = exports['es_extended']:getSharedObject()
|
||||
|
||||
@elseif($framework === 'qbcore')
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
@endif
|
||||
-- Resource started
|
||||
AddEventHandler('onServerResourceStart', function(resourceName)
|
||||
if GetCurrentResourceName() ~= resourceName then return end
|
||||
|
||||
print('Resource started on server')
|
||||
|
||||
-- Your initialization code here
|
||||
end)
|
||||
|
||||
-- Player connecting
|
||||
AddEventHandler('playerConnecting', function(name, setKickReason, deferrals)
|
||||
local player = source
|
||||
deferrals.defer()
|
||||
|
||||
-- Check player here
|
||||
|
||||
deferrals.done()
|
||||
end)
|
||||
|
||||
-- Example server event
|
||||
RegisterNetEvent('resourceName:serverEvent', function(data)
|
||||
local player = source
|
||||
|
||||
print('Received event from player ' .. player)
|
||||
|
||||
-- Trigger back to client
|
||||
TriggerClientEvent('resourceName:clientEvent', player, { success = true })
|
||||
end)
|
||||
Reference in new issue
Block a user