- 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.
38 lines
880 B
PHP
38 lines
880 B
PHP
// 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 });
|
|
});
|