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:
Adrian Mejias committed 2026-02-28 21:53:04 -06:00
1 parent 41e89d9023
commit d3d1f5fdb3
112 files changed
+51106

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';
@theme {
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}
+1
View File
@@ -0,0 +1 @@
import './bootstrap';
+4
View File
@@ -0,0 +1,4 @@
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
@@ -0,0 +1,478 @@
@extends('docs.layout')
@section('title', 'Full Documentation - FiveM MCP Server')
@section('content')
<style>
.tab-button {
transition: all 0.2s ease-in-out;
}
.tab-content {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
<div class="max-w-5xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-8">
<h1 class="text-3xl font-extrabold text-gray-900 mb-6">FiveM Development MCP Server</h1>
<p class="text-lg text-gray-700 mb-8">
A comprehensive Model Context Protocol (MCP) server for FiveM (GTA5) development, built with Laravel MCP.
This server provides AI assistants with powerful tools to help you develop FiveM resources more efficiently.
</p>
<!-- Installation -->
<section class="mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Installation & Connection</h2>
<p class="text-gray-700 mb-6">Choose how you want to connect to the FiveM MCP server:</p>
<!-- Tab Buttons -->
<div class="border-b border-gray-200 mb-6">
<nav class="-mb-px flex space-x-8">
<button
data-tab="remote"
class="tab-button active border-b-2 border-indigo-500 py-4 px-1 text-center text-sm font-medium text-indigo-600"
>
<span class="flex items-center">
<span class="mr-2">🌐</span>
Remote Server
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-800">
Recommended
</span>
</span>
</button>
<button
data-tab="local"
class="tab-button border-b-2 border-transparent py-4 px-1 text-center text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300"
>
<span class="flex items-center">
<span class="mr-2">💻</span>
Local Installation
</span>
</button>
</nav>
</div>
<!-- Tab Content Container -->
<div class="tab-content-container">
<!-- Remote Server Option -->
<div data-tab-content="remote" class="tab-content active">
<div class="bg-indigo-50 border-l-4 border-indigo-500 p-6">
<p class="text-gray-700 mb-4">
<strong>Easy setup!</strong> Connect to a hosted MCP server. This is the easiest option and works from anywhere without any local setup.
</p>
<h4 class="font-semibold text-gray-900 mb-2">Claude Desktop Configuration:</h4>
<p class="text-gray-700 mb-3">Edit your configuration file:</p>
<ul class="list-disc list-inside text-gray-700 mb-3 ml-4">
<li><strong>macOS:</strong> <code class="bg-gray-100 px-2 py-1 rounded text-sm">~/Library/Application Support/Claude/claude_desktop_config.json</code></li>
<li><strong>Windows:</strong> <code class="bg-gray-100 px-2 py-1 rounded text-sm">%APPDATA%\Claude\claude_desktop_config.json</code></li>
</ul>
<p class="text-gray-700 mb-3">Add this configuration (replace with your actual server URL):</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>{
"mcpServers": {
"fivem": {
"url": "https://your-domain.com/mcp"
}
}
}</code></pre>
</div>
<div class="mt-6">
<h4 class="font-semibold text-gray-900 mb-2">VSCode Configuration (Cline Extension):</h4>
<p class="text-gray-700 mb-3">If using VSCode with the Cline extension, edit your settings:</p>
<ul class="list-disc list-inside text-gray-700 mb-3 ml-4">
<li>Open VSCode Settings (JSON)</li>
<li>Add to your global or workspace <code class="bg-gray-100 px-2 py-1 rounded text-sm">settings.json</code></li>
</ul>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>{
"mcp": {
"servers": {
"fivem": {
"url": "https://your-domain.com/mcp"
}
}
}
}</code></pre>
</div>
</div>
<!-- Local Installation Option -->
<div data-tab-content="local" class="tab-content hidden">
<div class="bg-gray-50 border-l-4 border-gray-400 p-6">
<p class="text-gray-700 mb-4">
<strong>Advanced setup.</strong> Run the MCP server on your own machine. Requires PHP and Laravel setup.
</p>
<h4 class="font-semibold text-gray-900 mb-2">Claude Desktop Configuration:</h4>
<p class="text-gray-700 mb-3">Edit your configuration file and add:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto mb-4"><code>{
"mcpServers": {
"fivem": {
"command": "/path/to/php",
"args": [
"/path/to/fivem-mcp/artisan",
"mcp:start",
"fivem"
]
}
}
}</code></pre>
<h4 class="font-semibold text-gray-900 mb-2">Command Line Usage:</h4>
<p class="text-gray-700 mb-3">For any MCP-compatible client:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>php artisan mcp:start fivem</code></pre>
<h4 class="font-semibold text-gray-900 mb-2 mt-6">VSCode Configuration (Cline Extension):</h4>
<p class="text-gray-700 mb-3">If using VSCode with the Cline extension, add to <code class="bg-gray-100 px-2 py-1 rounded text-sm">settings.json</code>:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>{
"mcp": {
"servers": {
"fivem": {
"command": "php",
"args": ["artisan", "mcp:start", "fivem"],
"cwd": "/path/to/fivem-mcp"
}
}
}
}</code></pre>
<p class="text-gray-700 mb-3 mt-4"><strong>Or use the full PHP path:</strong></p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>{
"mcp": {
"servers": {
"fivem": {
"command": "/path/to/php",
"args": ["/path/to/fivem-mcp/artisan", "mcp:start", "fivem"]
}
}
}
}</code></pre>
</div>
</div>
</div>
<div class="bg-blue-50 border-l-4 border-blue-500 p-4 mt-6">
<p class="text-sm text-blue-800">
<strong>💡 Tip:</strong> After configuring Claude Desktop, completely quit and restart the application for changes to take effect.
</p>
</div>
</section>
<!-- Available Tools -->
<section class="mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-6">Available Tools</h2>
<!-- Tool 1: SearchFiveMDocs -->
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">1. SearchFiveMDocs</h3>
<p class="text-gray-700 mb-4">Search FiveM documentation for specific topics.</p>
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">query</code> (required): Search query (e.g., "events", "natives", "manifest")</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">category</code> (optional): Filter by category (all, scripting, natives, networking, resources)</li>
</ul>
<h4 class="font-semibold text-gray-900 mb-2">Example:</h4>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>Search FiveM docs for "network events"</code></pre>
</div>
<!-- Tool 2: GetNativeFunction -->
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">2. GetNativeFunction</h3>
<p class="text-gray-700 mb-4">Look up GTA5/FiveM native functions.</p>
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">function_name</code> (required): Native function name (e.g., "GetPlayerPed", "SetEntityCoords")</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">language</code> (optional): Code example language (lua or js)</li>
</ul>
<h4 class="font-semibold text-gray-900 mb-2">Common Native Examples:</h4>
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
<li>Common natives: <code class="bg-gray-100 px-2 py-1 rounded text-sm">GetPlayerPed</code>, <code class="bg-gray-100 px-2 py-1 rounded text-sm">SetEntityCoords</code>, <code class="bg-gray-100 px-2 py-1 rounded text-sm">GetEntityCoords</code></li>
<li>CFX natives: <code class="bg-gray-100 px-2 py-1 rounded text-sm">RegisterNetEvent</code>, <code class="bg-gray-100 px-2 py-1 rounded text-sm">TriggerServerEvent</code>, <code class="bg-gray-100 px-2 py-1 rounded text-sm">TriggerClientEvent</code></li>
<li>ESX: <code class="bg-gray-100 px-2 py-1 rounded text-sm">ESX.GetPlayerFromId</code></li>
<li>QBCore: <code class="bg-gray-100 px-2 py-1 rounded text-sm">QBCore.Functions.GetPlayer</code></li>
</ul>
</div>
<!-- Tool 3: GenerateManifest -->
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">3. GenerateManifest</h3>
<p class="text-gray-700 mb-4">Generate a fxmanifest.lua file.</p>
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">resource_name</code> (required): Resource name</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">author</code> (optional): Author name</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">description</code> (optional): Resource description</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">version</code> (optional): Version number (default: "1.0.0")</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">script_type</code> (optional): lua or js (default: lua)</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">include_client</code> (optional): Include client scripts (default: true)</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">include_server</code> (optional): Include server scripts (default: true)</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">framework</code> (optional): standalone, esx, or qbcore (default: standalone)</li>
</ul>
<h4 class="font-semibold text-gray-900 mb-2">Example:</h4>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>Generate a manifest for an ESX resource called "my-shop"</code></pre>
</div>
<!-- Tool 4: GetEventReference -->
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">4. GetEventReference</h3>
<p class="text-gray-700 mb-4">Get information about FiveM events.</p>
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">event_name</code> (optional): Specific event name to look up</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">event_type</code> (optional): Filter by type (all, core, esx, qbcore)</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">language</code> (optional): Code example language (lua or js)</li>
</ul>
<h4 class="font-semibold text-gray-900 mb-2">Examples:</h4>
<pre class="bg-gray-100 rounded p-3 text-sm mb-2"><code>Show me all core FiveM events</code></pre>
<pre class="bg-gray-100 rounded p-3 text-sm mb-2"><code>Look up the playerConnecting event</code></pre>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>List all ESX events</code></pre>
</div>
<!-- Tool 5: GenerateResourceBoilerplate -->
<div class="mb-8 border-l-4 border-indigo-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">5. GenerateResourceBoilerplate</h3>
<p class="text-gray-700 mb-4">Generate complete resource boilerplate code.</p>
<h4 class="font-semibold text-gray-900 mb-2">Parameters:</h4>
<ul class="list-disc list-inside text-gray-700 mb-4 ml-4">
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">resource_name</code> (required): Resource name</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">framework</code> (optional): standalone, esx, or qbcore (default: standalone)</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">script_type</code> (optional): lua or js (default: lua)</li>
<li><code class="bg-gray-100 px-2 py-1 rounded text-sm">include_nui</code> (optional): Include NUI files (default: false)</li>
</ul>
<h4 class="font-semibold text-gray-900 mb-2">Example:</h4>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>Generate boilerplate for a QBCore resource with NUI called "admin-panel"</code></pre>
</div>
</section>
<!-- Available Resources -->
<section class="mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-6">Available Resources</h2>
<p class="text-gray-700 mb-6">MCP Resources provide read-only reference documentation that AI assistants can access:</p>
<!-- Resource 1: Code Snippets -->
<div class="mb-8 border-l-4 border-green-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">1. Code Snippets</h3>
<p class="text-gray-700 mb-4">Common FiveM code patterns and snippets for quick reference.</p>
<p class="text-gray-600 text-sm">URI: <code class="bg-gray-100 px-2 py-1 rounded text-sm">fivem://snippets/common</code></p>
<p class="text-gray-700 mt-2">Includes patterns for distance checks, event handlers, threads with cleanup, database queries, and NUI callbacks in both Lua and JavaScript.</p>
</div>
<!-- Resource 2: Best Practices -->
<div class="mb-8 border-l-4 border-green-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">2. Best Practices</h3>
<p class="text-gray-700 mb-4">FiveM development best practices and optimization tips.</p>
<p class="text-gray-600 text-sm">URI: <code class="bg-gray-100 px-2 py-1 rounded text-sm">fivem://guides/best-practices</code></p>
<p class="text-gray-700 mt-2">Covers performance optimization, security best practices, code organization, resource management, testing, and common pitfalls.</p>
</div>
<!-- Resource 3: Framework Comparison -->
<div class="mb-8 border-l-4 border-green-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">3. Framework Comparison</h3>
<p class="text-gray-700 mb-4">Comparison of FiveM frameworks: Standalone, ESX, and QBCore.</p>
<p class="text-gray-600 text-sm">URI: <code class="bg-gray-100 px-2 py-1 rounded text-sm">fivem://guides/framework-comparison</code></p>
<p class="text-gray-700 mt-2">Complete comparison with pros/cons, code examples, common functions, and migration guides.</p>
</div>
</section>
<!-- Available Prompts -->
<section class="mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-6">Available Prompts</h2>
<p class="text-gray-700 mb-6">MCP Prompts are pre-built prompt templates for common tasks:</p>
<!-- Prompt 1: Create New Resource -->
<div class="mb-8 border-l-4 border-purple-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">1. Create New Resource</h3>
<p class="text-gray-700 mb-4">Create a new FiveM resource with framework and language selection.</p>
<p class="text-gray-600 text-sm">Parameters: resource_name, framework (standalone/esx/qbcore), language (lua/js)</p>
</div>
<!-- Prompt 2: Debug Issues -->
<div class="mb-8 border-l-4 border-purple-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">2. Debug Issues</h3>
<p class="text-gray-700 mb-4">Debug common FiveM issues and errors with detailed analysis.</p>
<p class="text-gray-600 text-sm">Parameters: issue (description), error_message (from console)</p>
</div>
<!-- Prompt 3: Optimize Performance -->
<div class="mb-8 border-l-4 border-purple-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">3. Optimize Performance</h3>
<p class="text-gray-700 mb-4">Optimize FiveM script performance with detailed suggestions.</p>
<p class="text-gray-600 text-sm">Parameters: code (script to optimize), script_type (client/server/shared)</p>
</div>
<!-- Prompt 4: Convert Language -->
<div class="mb-8 border-l-4 border-purple-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">4. Convert Language</h3>
<p class="text-gray-700 mb-4">Convert code between Lua and JavaScript with proper syntax.</p>
<p class="text-gray-600 text-sm">Parameters: code, from (lua/js), to (lua/js)</p>
</div>
<!-- Prompt 5: Add Framework Integration -->
<div class="mb-8 border-l-4 border-purple-500 pl-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">5. Add Framework Integration</h3>
<p class="text-gray-700 mb-4">Add ESX or QBCore framework integration to existing resource.</p>
<p class="text-gray-600 text-sm">Parameters: code (current resource), current_framework, target_framework (esx/qbcore)</p>
</div>
</section>
<!-- Testing -->
<section class="mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Testing the Server</h2>
<p class="text-gray-700 mb-4">You can test the MCP server locally using the inspector:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>php artisan mcp:inspector fivem</code></pre>
<p class="text-gray-600 text-sm mt-2">This will open the MCP Inspector in your browser where you can test all the tools interactively.</p>
</section>
<!-- Development -->
<section class="mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Development</h2>
<h3 class="text-xl font-semibold text-gray-900 mb-3">Adding New Tools</h3>
<p class="text-gray-700 mb-4">1. Create a new tool class in <code class="bg-gray-100 px-2 py-1 rounded text-sm">app/Mcp/Tools/</code>:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto mb-4"><code>&lt;?php
namespace App\Mcp\Tools;
use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Mcp\Request;
use Laravel\Mcp\Response;
use Laravel\Mcp\Server\Attributes\Description;
use Laravel\Mcp\Server\Tool;
#[Description('Your tool description')]
class YourTool extends Tool
{
public function handle(Request $request): Response
{
// Tool logic here
return Response::text('Result');
}
public function schema(JsonSchema $schema): array
{
return [
'param' => $schema->string()->required(),
];
}
}</code></pre>
<p class="text-gray-700 mb-4">2. Register the tool in <code class="bg-gray-100 px-2 py-1 rounded text-sm">app/Mcp/Servers/FiveMServer.php</code>:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto mb-4"><code>protected array $tools = [
// ... existing tools
\App\Mcp\Tools\YourTool::class,
];</code></pre>
<h3 class="text-xl font-semibold text-gray-900 mb-3 mt-6">Code Formatting</h3>
<p class="text-gray-700 mb-4">Format code with Laravel Pint:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>vendor/bin/pint</code></pre>
</section>
<!-- Frameworks & Languages -->
<section class="mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Supported Frameworks</h2>
<ul class="list-disc list-inside text-gray-700 space-y-2 ml-4">
<li><strong>Standalone:</strong> Basic FiveM resources without framework dependencies</li>
<li><strong>ESX:</strong> ESX Framework (es_extended)</li>
<li><strong>QBCore:</strong> QBCore Framework (qb-core)</li>
</ul>
<h2 class="text-2xl font-bold text-gray-900 mb-4 mt-6">Scripting Languages</h2>
<p class="text-gray-700">Both Lua and JavaScript are fully supported across all tools and generators.</p>
</section>
<!-- Resources -->
<section class="mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Resources</h2>
<ul class="list-disc list-inside text-gray-700 space-y-2 ml-4">
<li><a href="https://docs.fivem.net/docs/" class="text-indigo-600 hover:text-indigo-500">FiveM Documentation</a></li>
<li><a href="https://docs.fivem.net/natives/" class="text-indigo-600 hover:text-indigo-500">FiveM Natives Reference</a></li>
<li><a href="https://laravel.com/docs/mcp" class="text-indigo-600 hover:text-indigo-500">Laravel MCP Documentation</a></li>
<li><a href="https://modelcontextprotocol.io/" class="text-indigo-600 hover:text-indigo-500">Model Context Protocol</a></li>
</ul>
</section>
<!-- Contributing -->
<section class="mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Contributing</h2>
<p class="text-gray-700 mb-4">Contributions are welcome! Areas for expansion:</p>
<ul class="list-disc list-inside text-gray-700 space-y-2 ml-4">
<li>More native functions in the database</li>
<li>Additional framework support (vRP, etc.)</li>
<li>More event types</li>
<li>Advanced code generators</li>
<li>Database query builders</li>
</ul>
</section>
<!-- License -->
<section>
<h2 class="text-2xl font-bold text-gray-900 mb-4">License</h2>
<p class="text-gray-700">MIT License</p>
</section>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const tabButtons = document.querySelectorAll('.tab-button');
const tabContents = document.querySelectorAll('.tab-content');
tabButtons.forEach(button => {
button.addEventListener('click', function() {
const targetTab = this.dataset.tab;
// Remove active class from all buttons
tabButtons.forEach(btn => {
btn.classList.remove('active', 'border-indigo-500', 'text-indigo-600');
btn.classList.add('border-transparent', 'text-gray-500');
});
// Add active class to clicked button
this.classList.remove('border-transparent', 'text-gray-500');
this.classList.add('active', 'border-indigo-500', 'text-indigo-600');
// Hide all tab contents
tabContents.forEach(content => {
content.classList.add('hidden');
content.classList.remove('active');
});
// Show target tab content
const targetContent = document.querySelector(`[data-tab-content="${targetTab}"]`);
if (targetContent) {
targetContent.classList.remove('hidden');
targetContent.classList.add('active');
}
});
});
});
</script>
@endsection
+200
View File
@@ -0,0 +1,200 @@
@extends('docs.layout')
@section('title', 'FiveM MCP Server')
@section('content')
<div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
<!-- Hero Section -->
<div class="text-center mb-12">
<h1 class="text-4xl font-extrabold text-gray-900 sm:text-5xl sm:tracking-tight lg:text-6xl">
FiveM Development MCP Server
</h1>
<p class="mt-5 max-w-xl mx-auto text-xl text-gray-500">
A comprehensive Model Context Protocol server for FiveM development with 5 tools, 3 resources, and 5 prompts.
</p>
</div>
<!-- Features Grid -->
<div class="mt-12">
<h2 class="text-3xl font-extrabold text-gray-900 mb-8">Features</h2>
<div class="grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3">
<!-- Documentation Search -->
<div class="bg-white overflow-hidden shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-indigo-500 rounded-md p-3">
<svg class="h-6 w-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg>
</div>
<div class="ml-5">
<h3 class="text-lg font-medium text-gray-900">Documentation Search</h3>
</div>
</div>
<div class="mt-4">
<p class="text-sm text-gray-500">
Search FiveM documentation by topic and category. Get direct links to relevant documentation.
</p>
</div>
</div>
</div>
<!-- Native Functions -->
<div class="bg-white overflow-hidden shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-indigo-500 rounded-md p-3">
<svg class="h-6 w-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"></path>
</svg>
</div>
<div class="ml-5">
<h3 class="text-lg font-medium text-gray-900">Native Functions</h3>
</div>
</div>
<div class="mt-4">
<p class="text-sm text-gray-500">
Look up GTA5/FiveM native functions with signatures, parameters, and code examples.
</p>
</div>
</div>
</div>
<!-- Manifest Generator -->
<div class="bg-white overflow-hidden shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-indigo-500 rounded-md p-3">
<svg class="h-6 w-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
</svg>
</div>
<div class="ml-5">
<h3 class="text-lg font-medium text-gray-900">Manifest Generator</h3>
</div>
</div>
<div class="mt-4">
<p class="text-sm text-gray-500">
Generate fxmanifest.lua files automatically for any framework and scripting language.
</p>
</div>
</div>
</div>
<!-- Event Reference -->
<div class="bg-white overflow-hidden shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-indigo-500 rounded-md p-3">
<svg class="h-6 w-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
</svg>
</div>
<div class="ml-5">
<h3 class="text-lg font-medium text-gray-900">Event Reference</h3>
</div>
</div>
<div class="mt-4">
<p class="text-sm text-gray-500">
Complete database of FiveM events including core, ESX, and QBCore events with examples.
</p>
</div>
</div>
</div>
<!-- Boilerplate Generator -->
<div class="bg-white overflow-hidden shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-indigo-500 rounded-md p-3">
<svg class="h-6 w-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"></path>
</svg>
</div>
<div class="ml-5">
<h3 class="text-lg font-medium text-gray-900">Boilerplate Generator</h3>
</div>
</div>
<div class="mt-4">
<p class="text-sm text-gray-500">
Generate complete resource structures with client, server, config, and optional NUI files.
</p>
</div>
</div>
</div>
<!-- Framework Support -->
<div class="bg-white overflow-hidden shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-indigo-500 rounded-md p-3">
<svg class="h-6 w-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path>
</svg>
</div>
<div class="ml-5">
<h3 class="text-lg font-medium text-gray-900">Framework Support</h3>
</div>
</div>
<div class="mt-4">
<p class="text-sm text-gray-500">
Full support for Standalone, ESX, and QBCore frameworks in both Lua and JavaScript.
</p>
</div>
</div>
</div>
</div>
</div>
<!-- Quick Actions -->
<div class="mt-16 bg-indigo-700 rounded-lg shadow-xl overflow-hidden">
<div class="px-6 py-12 sm:px-12">
<div class="text-center">
<h2 class="text-3xl font-extrabold text-white">Ready to get started?</h2>
<p class="mt-4 text-lg text-indigo-100">
Set up the MCP server in just 5 minutes with our quick start guide.
</p>
<div class="mt-8 flex justify-center space-x-4">
<a href="{{ route('docs.quickstart') }}" class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-indigo-700 bg-white hover:bg-indigo-50">
Quick Start Guide
</a>
<a href="{{ route('docs.documentation') }}" class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-indigo-500 hover:bg-indigo-600">
Full Documentation
</a>
</div>
</div>
</div>
</div>
<!-- Resources -->
<div class="mt-16">
<h2 class="text-3xl font-extrabold text-gray-900 mb-8">Resources</h2>
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
<div class="bg-white shadow rounded-lg p-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">Testing</h3>
<p class="text-sm text-gray-500 mb-4">
Test the MCP server locally using the inspector:
</p>
<pre class="bg-gray-50 rounded p-4 text-sm overflow-x-auto"><code>php artisan mcp:inspector fivem</code></pre>
</div>
<div class="bg-white shadow rounded-lg p-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">External Links</h3>
<ul class="space-y-2 text-sm">
<li>
<a href="https://docs.fivem.net/docs/" class="text-indigo-600 hover:text-indigo-500">FiveM Documentation</a>
</li>
<li>
<a href="https://docs.fivem.net/natives/" class="text-indigo-600 hover:text-indigo-500">FiveM Natives Reference</a>
</li>
<li>
<a href="https://laravel.com/docs/mcp" class="text-indigo-600 hover:text-indigo-500">Laravel MCP Documentation</a>
</li>
<li>
<a href="https://modelcontextprotocol.io/" class="text-indigo-600 hover:text-indigo-500">Model Context Protocol</a>
</li>
</ul>
</div>
</div>
</div>
</div>
@endsection
+147
View File
@@ -0,0 +1,147 @@
<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', 'FiveM MCP Server Documentation')</title>
@vite(['resources/css/app.css', 'resources/js/app.js'])
<style>
.code-block-wrapper {
position: relative;
}
.copy-button {
position: absolute;
top: 0.5rem;
right: 0.5rem;
padding: 0.375rem 0.75rem;
background-color: rgba(55, 65, 81, 0.8);
color: white;
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 0.375rem;
font-size: 0.75rem;
font-weight: 500;
cursor: pointer;
opacity: 0;
transition: all 0.2s ease-in-out;
display: flex;
align-items: center;
gap: 0.25rem;
}
.code-block-wrapper:hover .copy-button {
opacity: 1;
}
.copy-button:hover {
background-color: rgba(55, 65, 81, 1);
}
.copy-button.copied {
background-color: rgba(16, 185, 129, 0.9);
border-color: rgba(16, 185, 129, 1);
}
.copy-button svg {
width: 1rem;
height: 1rem;
}
</style>
</head>
<body class="h-full bg-gray-50">
<div class="min-h-full">
<!-- Navigation -->
<nav class="bg-white shadow-sm">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<div class="flex-shrink-0 flex items-center">
<h1 class="text-xl font-bold text-gray-900">FiveM MCP Server</h1>
</div>
<div class="hidden sm:ml-6 sm:flex sm:space-x-8">
<a href="{{ route('docs.index') }}" class="@if(request()->routeIs('docs.index')) border-indigo-500 text-gray-900 @else border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 @endif inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
Home
</a>
<a href="{{ route('docs.quickstart') }}" class="@if(request()->routeIs('docs.quickstart')) border-indigo-500 text-gray-900 @else border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 @endif inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
Quick Start
</a>
<a href="{{ route('docs.documentation') }}" class="@if(request()->routeIs('docs.documentation')) border-indigo-500 text-gray-900 @else border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 @endif inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
Documentation
</a>
</div>
</div>
</div>
</div>
</nav>
<!-- Main Content -->
<main>
@yield('content')
</main>
<!-- Footer -->
<footer class="bg-white border-t border-gray-200 mt-12">
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
<p class="text-center text-sm text-gray-500">
Built with <a href="https://laravel.com/docs/mcp" class="text-indigo-600 hover:text-indigo-500">Laravel MCP</a> for <a href="https://docs.fivem.net" class="text-indigo-600 hover:text-indigo-500">FiveM</a> development
</p>
</div>
</footer>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Add copy buttons to all code blocks
const codeBlocks = document.querySelectorAll('pre');
codeBlocks.forEach(function(pre) {
// Wrap the pre in a div if not already wrapped
if (!pre.parentElement.classList.contains('code-block-wrapper')) {
const wrapper = document.createElement('div');
wrapper.className = 'code-block-wrapper';
pre.parentNode.insertBefore(wrapper, pre);
wrapper.appendChild(pre);
}
const wrapper = pre.parentElement;
// Create copy button
const copyButton = document.createElement('button');
copyButton.className = 'copy-button';
copyButton.innerHTML = `
<svg class="copy-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
</svg>
<span class="copy-text">Copy</span>
`;
copyButton.addEventListener('click', function() {
const code = pre.querySelector('code');
const text = code ? code.textContent : pre.textContent;
navigator.clipboard.writeText(text).then(function() {
// Show success state
copyButton.classList.add('copied');
copyButton.innerHTML = `
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
<span>Copied!</span>
`;
// Reset after 2 seconds
setTimeout(function() {
copyButton.classList.remove('copied');
copyButton.innerHTML = `
<svg class="copy-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
</svg>
<span class="copy-text">Copy</span>
`;
}, 2000);
}).catch(function(err) {
console.error('Failed to copy:', err);
});
});
wrapper.appendChild(copyButton);
});
});
</script>
</body>
</html>
+397
View File
@@ -0,0 +1,397 @@
@extends('docs.layout')
@section('title', 'Quick Start Guide - FiveM MCP Server')
@section('content')
<style>
.tab-button {
transition: all 0.2s ease-in-out;
}
.tab-content {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
<div class="max-w-4xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
<div class="bg-white shadow rounded-lg p-8">
<h1 class="text-3xl font-extrabold text-gray-900 mb-6">FiveM MCP Quick Start Guide</h1>
<!-- What is this -->
<section class="mb-8">
<h2 class="text-2xl font-bold text-gray-900 mb-4">What is this?</h2>
<p class="text-gray-700 mb-4">
This MCP server gives AI assistants (like Claude) access to FiveM development tools including:
</p>
<ul class="list-disc list-inside text-gray-700 space-y-2 ml-4">
<li>Documentation search</li>
<li>Native function lookups</li>
<li>Manifest generation</li>
<li>Event references</li>
<li>Resource boilerplate generation</li>
</ul>
</section>
<!-- Choose Setup Type -->
<section class="mb-8">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Choose Your Setup</h2>
<!-- Tab Buttons -->
<div class="border-b border-gray-200 mb-6">
<nav class="-mb-px flex space-x-8">
<button
data-tab="remote"
class="tab-button active border-b-2 border-indigo-500 py-4 px-1 text-center text-sm font-medium text-indigo-600"
>
<span class="flex items-center">
<span class="mr-2">🌐</span>
Remote Server
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-800">
Recommended
</span>
</span>
</button>
<button
data-tab="local"
class="tab-button border-b-2 border-transparent py-4 px-1 text-center text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300"
>
<span class="flex items-center">
<span class="mr-2">💻</span>
Local Installation
</span>
</button>
</nav>
</div>
<!-- Tab Content Container -->
<div class="tab-content-container">
<!-- Remote Setup Tab -->
<div data-tab-content="remote" class="tab-content active">
<div class="bg-indigo-50 border-l-4 border-indigo-500 p-4 mb-6">
<p class="text-sm text-indigo-800">
<strong>Easy setup!</strong> Connect to a hosted MCP server. Works from anywhere without any local installation.
</p>
</div>
<p class="text-gray-700 mb-6">
If someone is hosting the FiveM MCP server for you, follow these steps to connect:
</p>
<!-- Step 1 -->
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">1. Get the Server URL</h3>
<p class="text-gray-700 mb-3">
Ask your server administrator for the MCP server URL. It will look like:
</p>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>https://your-domain.com/mcp</code></pre>
</div>
<!-- Step 2 -->
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">2. Configure Claude Desktop</h3>
<p class="text-gray-700 mb-3">Edit your Claude Desktop configuration file:</p>
<ul class="list-disc list-inside text-gray-700 mb-3 ml-4">
<li><strong>macOS:</strong> <code class="bg-gray-100 px-2 py-1 rounded text-sm">~/Library/Application Support/Claude/claude_desktop_config.json</code></li>
<li><strong>Windows:</strong> <code class="bg-gray-100 px-2 py-1 rounded text-sm">%APPDATA%\Claude\claude_desktop_config.json</code></li>
</ul>
<p class="text-gray-700 mb-3">Add this configuration (replace the URL with your actual server URL):</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>{
"mcpServers": {
"fivem": {
"url": "https://your-domain.com/mcp"
}
}
}</code></pre>
<p class="text-gray-700 mb-3 mt-6"><strong>For VSCode (Cline Extension):</strong></p>
<p class="text-gray-700 mb-3">Edit your VSCode <code class="bg-gray-100 px-2 py-1 rounded text-sm">settings.json</code>:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>{
"mcp": {
"servers": {
"fivem": {
"url": "https://your-domain.com/mcp"
}
}
}
}</code></pre>
</div>
<!-- Step 3 -->
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">3. Restart Claude Desktop</h3>
<p class="text-gray-700">
Completely quit and restart Claude Desktop for changes to take effect.
</p>
</div>
<!-- Step 4 -->
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">4. Verify Connection</h3>
<p class="text-gray-700">
In Claude Desktop, you should see a small 🔌 icon or indication that the FiveM MCP server is connected.
</p>
</div>
<div class="bg-green-50 border-l-4 border-green-500 p-4">
<p class="text-sm text-green-800">
<strong>That's it!</strong> You're now connected to the remote MCP server and can start using FiveM development tools with Claude.
</p>
</div>
</div>
<!-- Local Setup Tab -->
<div data-tab-content="local" class="tab-content hidden">
<div class="bg-gray-50 border-l-4 border-gray-400 p-4 mb-6">
<p class="text-sm text-gray-700">
<strong>Advanced setup.</strong> Run the MCP server on your own machine. Requires PHP and Laravel installation.
</p>
</div>
<p class="text-gray-700 mb-6">
If you want to run the MCP server on your own machine:
</p>
<!-- Step 1 -->
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">1. Test the Server</h3>
<p class="text-gray-700 mb-3">First, verify the server works:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>cd /path/to/fivem-mcp
php artisan mcp:inspector fivem</code></pre>
<p class="text-gray-600 text-sm mt-2">This opens a web inspector where you can test all tools.</p>
</div>
<!-- Step 2 -->
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">2. Configure Claude Desktop</h3>
<p class="text-gray-700 mb-3">Edit your Claude Desktop configuration file:</p>
<ul class="list-disc list-inside text-gray-700 mb-3 ml-4">
<li><strong>macOS:</strong> <code class="bg-gray-100 px-2 py-1 rounded text-sm">~/Library/Application Support/Claude/claude_desktop_config.json</code></li>
<li><strong>Windows:</strong> <code class="bg-gray-100 px-2 py-1 rounded text-sm">%APPDATA%\Claude\claude_desktop_config.json</code></li>
</ul>
<p class="text-gray-700 mb-3">Add this configuration:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto mb-4"><code>{
"mcpServers": {
"fivem": {
"command": "php",
"args": [
"artisan",
"mcp:start",
"fivem"
],
"cwd": "/path/to/fivem-mcp"
}
}
}</code></pre>
<p class="text-gray-700 mb-3"><strong>Or use the full PHP path (e.g., for Herd):</strong></p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>{
"mcpServers": {
"fivem": {
"command": "/path/to/php",
"args": [
"/path/to/fivem-mcp/artisan",
"mcp:start",
"fivem"
]
}
}
}</code></pre>
<p class="text-gray-700 mb-3 mt-6"><strong>For VSCode (Cline Extension):</strong></p>
<p class="text-gray-700 mb-3">Edit your VSCode <code class="bg-gray-100 px-2 py-1 rounded text-sm">settings.json</code>:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto mb-4"><code>{
"mcp": {
"servers": {
"fivem": {
"command": "php",
"args": ["artisan", "mcp:start", "fivem"],
"cwd": "/path/to/fivem-mcp"
}
}
}
}</code></pre>
<p class="text-gray-700 mb-3"><strong>Or with full paths:</strong></p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>{
"mcp": {
"servers": {
"fivem": {
"command": "/path/to/php",
"args": ["/path/to/fivem-mcp/artisan", "mcp:start", "fivem"]
}
}
}
}</code></pre>
</div>
<!-- Step 3 -->
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">3. Restart Claude Desktop</h3>
<p class="text-gray-700">
Completely quit and restart Claude Desktop for changes to take effect.
</p>
</div>
<!-- Step 4 -->
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">4. Verify Connection</h3>
<p class="text-gray-700">
In Claude Desktop, you should see a small 🔌 icon or indication that the FiveM MCP server is connected.
</p>
</div>
</div>
</div>
</section>
<!-- Quick Examples -->
<section class="mb-8">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Quick Examples</h2>
<p class="text-gray-700 mb-4">Once connected, try these prompts in Claude:</p>
<div class="space-y-4">
<div class="border-l-4 border-indigo-500 pl-4">
<h4 class="font-semibold text-gray-900 mb-2">Example 1: Search Documentation</h4>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>Search FiveM docs for "state bags"</code></pre>
</div>
<div class="border-l-4 border-indigo-500 pl-4">
<h4 class="font-semibold text-gray-900 mb-2">Example 2: Look Up a Native</h4>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>What does the GetPlayerPed native function do? Show me an example.</code></pre>
</div>
<div class="border-l-4 border-indigo-500 pl-4">
<h4 class="font-semibold text-gray-900 mb-2">Example 3: Generate a Manifest</h4>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>Generate a fxmanifest.lua for my resource called "vehicle-shop" using ESX framework</code></pre>
</div>
<div class="border-l-4 border-indigo-500 pl-4">
<h4 class="font-semibold text-gray-900 mb-2">Example 4: List Events</h4>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>Show me all FiveM core server events</code></pre>
</div>
<div class="border-l-4 border-indigo-500 pl-4">
<h4 class="font-semibold text-gray-900 mb-2">Example 5: Create Boilerplate</h4>
<pre class="bg-gray-100 rounded p-3 text-sm"><code>Create a complete resource structure for a QBCore script called "bank-heist" with NUI</code></pre>
</div>
</div>
</section>
<!-- Troubleshooting -->
<section class="mb-8">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Troubleshooting</h2>
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">Server Not Connecting</h3>
<ol class="list-decimal list-inside text-gray-700 space-y-3 ml-4">
<li>
<strong>Check PHP Path:</strong> Make sure the PHP path in your config is correct
<pre class="bg-gray-900 text-gray-100 rounded p-3 mt-2 overflow-x-auto"><code>which php
# or for Herd:
ls -la "~/Library/Application Support/Herd/bin/"</code></pre>
</li>
<li>
<strong>Test Manually:</strong> Run the server command directly
<pre class="bg-gray-900 text-gray-100 rounded p-3 mt-2 overflow-x-auto"><code>cd /path/to/fivem-mcp
php artisan mcp:start fivem</code></pre>
</li>
<li>
<strong>Check Logs:</strong> Look at Claude Desktop logs
<ul class="list-disc list-inside ml-6 mt-2">
<li>macOS: <code class="bg-gray-100 px-2 py-1 rounded text-sm">~/Library/Logs/Claude/</code></li>
<li>Windows: Check Event Viewer or app logs</li>
</ul>
</li>
</ol>
</div>
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">Permission Issues</h3>
<p class="text-gray-700 mb-3">If you get permission errors:</p>
<pre class="bg-gray-900 text-gray-100 rounded p-4 overflow-x-auto"><code>cd /path/to/fivem-mcp
chmod +x artisan</code></pre>
</div>
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-3">Path Issues</h3>
<p class="text-gray-700">
Make sure to use <strong>absolute paths</strong> in your config, not relative paths.
</p>
</div>
</section>
<!-- Next Steps -->
<section class="mb-8">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Next Steps</h2>
<ul class="list-disc list-inside text-gray-700 space-y-2 ml-4">
<li><a href="{{ route('docs.documentation') }}" class="text-indigo-600 hover:text-indigo-500">Read the full documentation</a></li>
<li>Explore all 5 tools in the MCP Inspector</li>
<li>Try creating a complete FiveM resource with AI assistance</li>
<li>Contribute new tools or improve existing ones</li>
</ul>
</section>
<!-- Support -->
<section>
<h2 class="text-2xl font-bold text-gray-900 mb-4">Support</h2>
<p class="text-gray-700 mb-3">For issues:</p>
<ol class="list-decimal list-inside text-gray-700 space-y-2 ml-4">
<li>Check <a href="https://laravel.com/docs/mcp" class="text-indigo-600 hover:text-indigo-500">Laravel MCP Documentation</a></li>
<li>Check <a href="https://docs.fivem.net/" class="text-indigo-600 hover:text-indigo-500">FiveM Documentation</a></li>
<li>Review server logs</li>
<li>Open a GitHub issue</li>
</ol>
<p class="text-gray-700 mt-6 text-lg font-semibold">Happy coding! 🎮</p>
</section>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const tabButtons = document.querySelectorAll('.tab-button');
const tabContents = document.querySelectorAll('.tab-content');
tabButtons.forEach(button => {
button.addEventListener('click', function() {
const targetTab = this.dataset.tab;
// Remove active class from all buttons
tabButtons.forEach(btn => {
btn.classList.remove('active', 'border-indigo-500', 'text-indigo-600');
btn.classList.add('border-transparent', 'text-gray-500');
});
// Add active class to clicked button
this.classList.remove('border-transparent', 'text-gray-500');
this.classList.add('active', 'border-indigo-500', 'text-indigo-600');
// Hide all tab contents
tabContents.forEach(content => {
content.classList.add('hidden');
content.classList.remove('active');
});
// Show target tab content
const targetContent = document.querySelector(`[data-tab-content="${targetTab}"]`);
if (targetContent) {
targetContent.classList.remove('hidden');
targetContent.classList.add('active');
}
});
});
});
</script>
@endsection
+10
View File
@@ -0,0 +1,10 @@
FiveM Events Reference
==================================================
@foreach($eventsByType as $type => $events)
{{ strtoupper($type) }} EVENTS:
@foreach($events as $event)
• {{ $event['name'] }} - {{ $event['description'] }}
@endforeach
@endforeach
@@ -0,0 +1,30 @@
Event: {{ $event['name'] }}
==================================================
Type: {{ $event['type'] }}
Side: {{ $event['side'] }}
Description:
{{ $event['description'] }}
@if(!empty($event['parameters']))
Parameters:
@foreach($event['parameters'] as $param)
• {{ $param['name'] }} ({{ $param['type'] }}): {{ $param['description'] }}
@endforeach
@endif
@php
$exampleKey = $language === 'js' ? 'js_example' : 'lua_example';
$langName = $language === 'js' ? 'JavaScript' : 'Lua';
@endphp
@if(isset($event[$exampleKey]))
{{ $langName }} Example:
```{{ $language }}
{{ $event[$exampleKey] }}
```
@endif
@if(isset($event['documentation']))
Documentation: {{ $event['documentation'] }}
@endif
@@ -0,0 +1,32 @@
Native Function: {{ $native['name'] }}
==================================================
Namespace: {{ $native['namespace'] }}
Description:
{{ $native['description'] }}
@if(!empty($native['parameters']))
Parameters:
@foreach($native['parameters'] as $param)
• {{ $param['name'] }} ({{ $param['type'] }}): {{ $param['description'] }}
@endforeach
@endif
Returns: {{ $native['returns']['type'] }}
@if($native['returns']['description'] !== 'No return value')
{{ $native['returns']['description'] }}
@endif
@php
$exampleKey = $language === 'js' ? 'js_example' : 'lua_example';
$langName = $language === 'js' ? 'JavaScript' : 'Lua';
@endphp
@if(isset($native[$exampleKey]))
{{ $langName }} Example:
```{{ $language }}
{{ $native[$exampleKey] }}
```
@endif
Documentation: https://docs.fivem.net/natives/?_{{ $native['name'] }}
@@ -0,0 +1,11 @@
FiveM Resource Boilerplate: {{ $resourceName }}
==================================================
Generated files:
@foreach($files as $filename => $content)
📄 {{ $filename }}
--------------------------------------------------
{{ $content }}
@endforeach
@@ -0,0 +1,258 @@
# FiveM Development Best Practices
## Performance Optimization
### 1. Use Citizen.Wait() Efficiently
**Bad:**
```lua
Citizen.CreateThread(function()
while true do
Citizen.Wait(0) -- Runs every frame!
-- Code that doesn't need to run every frame
end
end)
```
**Good:**
```lua
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000) -- Runs once per second
-- Code here
end
end)
```
### 2. Avoid GetPlayerPed(-1) in Loops
**Bad:**
```lua
while true do
local ped = GetPlayerPed(-1) -- Called every iteration
local coords = GetEntityCoords(ped)
Citizen.Wait(0)
end
```
**Good:**
```lua
local ped = PlayerPedId() -- Cache outside loop
while true do
local coords = GetEntityCoords(ped)
Citizen.Wait(0)
end
```
### 3. Use Distance Checks Before Expensive Operations
```lua
local myCoords = GetEntityCoords(PlayerPedId())
local distance = #(myCoords - targetCoords)
if distance < 100.0 then
-- Only do expensive operations when close
DrawMarker(...)
end
```
### 4. Batch Database Queries
**Bad:**
```lua
for _, player in pairs(players) do
MySQL.Async.fetchAll('SELECT * FROM users WHERE id = @id', {
['@id'] = player.id
})
end
```
**Good:**
```lua
local ids = {}
for _, player in pairs(players) do
table.insert(ids, player.id)
end
MySQL.Async.fetchAll('SELECT * FROM users WHERE id IN (@ids)', {
['@ids'] = table.concat(ids, ',')
})
```
## Security Best Practices
### 1. Always Validate Server Events
```lua
RegisterNetEvent('myresource:giveMoney', function(amount)
local _source = source
-- Validate source
if not _source or _source < 1 then return end
-- Validate amount
if type(amount) ~= 'number' or amount <= 0 or amount > 10000 then
print(('Invalid amount from player %s'):format(_source))
return
end
-- Process only after validation
Player(_source).addMoney(amount)
end)
```
### 2. Never Trust Client Data
- All game-changing logic should be on the server
- Validate all client requests
- Use server-side checks for important operations
### 3. Don't Expose Admin Events
**Bad:**
```lua
RegisterNetEvent('admin:giveWeapon') -- Client can trigger!
```
**Good:**
```lua
-- Use server commands instead
RegisterCommand('giveweapon', function(source, args)
if IsPlayerAceAllowed(source, 'admin.weapons') then
-- Safe to execute
end
end, true)
```
## Code Organization
### 1. Use Config Files
```lua
-- config.lua
Config = {}
Config.MaxDistance = 100.0
Config.CheckInterval = 1000
Config.EnableDebug = false
-- client.lua
if distance < Config.MaxDistance then
-- Easy to tweak without touching logic
end
```
### 2. Modularize Your Code
```lua
-- utils.lua
function GetPlayerDistance(player1, player2)
local coords1 = GetEntityCoords(GetPlayerPed(player1))
local coords2 = GetEntityCoords(GetPlayerPed(player2))
return #(coords1 - coords2)
end
-- main.lua
local distance = GetPlayerDistance(source, target)
```
### 3. Use Proper Event Naming
```lua
-- Good naming convention
RegisterNetEvent('resourcename:category:action')
RegisterNetEvent('cardealer:purchase:vehicle')
RegisterNetEvent('banking:account:withdraw')
-- Avoid generic names
RegisterNetEvent('action') -- Too generic!
RegisterNetEvent('event1') -- Not descriptive!
```
## Resource Management
### 1. Clean Up After Yourself
```lua
AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() then
-- Clean up threads, blips, entities, etc.
isRunning = false
RemoveBlip(myBlip)
DeleteEntity(myVehicle)
end
end)
```
### 2. Don't Create Unnecessary Entities
```lua
-- Delete vehicles when no longer needed
if DoesEntityExist(vehicle) then
DeleteEntity(vehicle)
end
-- Clean up peds
if DoesEntityExist(ped) then
DeletePed(ped)
end
```
### 3. Manage Network Ownership
```lua
-- Set network IDs for entities you want to sync
NetworkRegisterEntityAsNetworked(entity)
local netId = NetworkGetNetworkIdFromEntity(entity)
```
## Testing & Debugging
### 1. Use Conditional Debug Prints
```lua
if Config.Debug then
print(('[DEBUG] Player %s at coords: %s'):format(source, coords))
end
```
### 2. Error Handling
```lua
local success, error = pcall(function()
-- Code that might error
MySQL.Async.fetchAll(query)
end)
if not success then
print(('Error: %s'):format(error))
end
```
### 3. Use Convars for Configuration
```lua
-- Set in server.cfg
setr myresource:maxdistance "100"
-- Read in script
local maxDistance = GetConvarInt('myresource:maxdistance', 50)
```
## Framework-Specific Tips
### ESX
```lua
-- Always check if ESX is loaded
ESX = exports['es_extended']:getSharedObject()
-- Use ESX callbacks for server communication
ESX.TriggerServerCallback('myresource:getData', function(data)
print(data)
end)
```
### QBCore
```lua
-- Get QBCore object properly
local QBCore = exports['qb-core']:GetCoreObject()
-- Use QBCore functions
local Player = QBCore.Functions.GetPlayer(source)
if Player then
Player.Functions.AddMoney('cash', amount)
end
```
## Common Pitfalls
1. **Using GetPlayerPed(-1) instead of PlayerPedId()** - Less efficient
2. **Not cleaning up on resource restart** - Memory leaks
3. **Trusting client-side coordinates** - Security risk
4. **Running expensive operations every frame** - Performance issues
5. **Not validating server events** - Exploits waiting to happen
6. **Hardcoding values** - Use config files instead
7. **Not using exports properly** - Creates tight coupling
@@ -0,0 +1,178 @@
# Common FiveM Code Snippets
Quick reference for frequently used code patterns.
## Player Distance Check
### Lua
```lua
-- Check distance between two players
local ped1 = GetPlayerPed(source)
local ped2 = GetPlayerPed(targetPlayer)
local coords1 = GetEntityCoords(ped1)
local coords2 = GetEntityCoords(ped2)
local distance = #(coords1 - coords2)
if distance < 5.0 then
-- Players are close enough
end
```
### JavaScript
```javascript
// Check distance between two players
const ped1 = GetPlayerPed(source);
const ped2 = GetPlayerPed(targetPlayer);
const coords1 = GetEntityCoords(ped1, false);
const coords2 = GetEntityCoords(ped2, false);
const distance = Math.sqrt(
Math.pow(coords1[0] - coords2[0], 2) +
Math.pow(coords1[1] - coords2[1], 2) +
Math.pow(coords1[2] - coords2[2], 2)
);
if (distance < 5.0) {
// Players are close enough
}
```
## Safe Event Handler
### Lua
```lua
-- Server-side event with validation
RegisterNetEvent('myresource:doSomething', function(data)
local _source = source
-- Validate source
if not _source or _source < 1 then return end
-- Validate data
if type(data) ~= 'table' or not data.id then return end
-- Process event safely
print(('Player %s triggered event with ID: %s'):format(_source, data.id))
end)
```
### JavaScript
```javascript
// Server-side event with validation
onNet('myresource:doSomething', (data) => {
const _source = source;
// Validate source
if (!_source || _source < 1) return;
// Validate data
if (typeof data !== 'object' || !data.id) return;
// Process event safely
console.log(`Player ${_source} triggered event with ID: ${data.id}`);
});
```
## Thread with Cleanup
### Lua
```lua
-- Citizen thread with proper cleanup
local isRunning = true
Citizen.CreateThread(function()
while isRunning do
Citizen.Wait(0)
-- Your code here
if IsControlJustPressed(0, 38) then -- E key
print('E pressed!')
end
end
end)
-- Cleanup function
AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() then
isRunning = false
end
end)
```
### JavaScript
```javascript
// SetInterval with cleanup
let isRunning = true;
const intervalId = setInterval(() => {
if (!isRunning) {
clearInterval(intervalId);
return;
}
// Your code here
if (IsControlJustPressed(0, 38)) { // E key
console.log('E pressed!');
}
}, 0);
// Cleanup
on('onResourceStop', (resource) => {
if (resource === GetCurrentResourceName()) {
isRunning = false;
}
});
```
## Database Query with Callback
### Lua
```lua
-- MySQL async query pattern
MySQL.Async.fetchAll('SELECT * FROM users WHERE identifier = @identifier', {
['@identifier'] = identifier
}, function(result)
if result[1] then
print(('Found user: %s'):format(result[1].name))
else
print('User not found')
end
end)
```
### JavaScript
```javascript
// oxmysql query pattern
const result = await exports.oxmysql.query('SELECT * FROM users WHERE identifier = ?', [identifier]);
if (result.length > 0) {
console.log(`Found user: ${result[0].name}`);
} else {
console.log('User not found');
}
```
## NUI Callback
### Lua
```lua
-- Client-side NUI callback handler
RegisterNUICallback('buttonClick', function(data, cb)
-- Process the callback
print(('Button clicked: %s'):format(data.button))
-- Send response back to NUI
cb({ success = true, message = 'Action completed' })
end)
```
### JavaScript
```javascript
// Client-side NUI callback handler
RegisterNUICallback('buttonClick', (data, cb) => {
// Process the callback
console.log(`Button clicked: ${data.button}`);
// Send response back to NUI
cb({ success: true, message: 'Action completed' });
});
```
@@ -0,0 +1,260 @@
# FiveM Framework Comparison
## Overview
| Feature | Standalone | ESX | QBCore |
|---------|-----------|-----|--------|
| **Complexity** | Low | Medium | Medium-High |
| **Player System** | None | Built-in | Built-in |
| **Inventory** | None | Basic | Advanced |
| **Database** | Optional | MySQL | MySQL/oxmysql |
| **Jobs** | Manual | Built-in | Built-in |
| **Community** | N/A | Large | Growing |
| **Learning Curve** | Easy | Moderate | Moderate-Hard |
## Standalone
### When to Use
- Simple resources (maps, MLOs, vehicles)
- Custom systems from scratch
- Learning FiveM basics
- No framework dependencies needed
### Pros
- Complete control
- No framework overhead
- Lightweight
- No version conflicts
### Cons
- Must build everything yourself
- No standardized player system
- Harder to integrate with other resources
- More initial work
### Example Code
```lua
-- No framework, direct natives
RegisterNetEvent('myresource:doSomething', function(data)
local ped = GetPlayerPed(source)
local coords = GetEntityCoords(ped)
TriggerClientEvent('myresource:response', source, {
success = true,
coords = coords
})
end)
```
## ESX (es_extended)
### When to Use
- Building roleplay servers
- Need player accounts/jobs/inventory
- Want established ecosystem
- Prefer simpler structure
### Pros
- Huge community and resources
- Lots of free scripts available
- Well-documented
- Mature and stable
- Simpler than QBCore
### Cons
- Older codebase
- Some performance issues
- Less modern features
- Can feel outdated
### Core Features
- Player accounts and identifiers
- Job system
- Basic inventory
- Money (cash, bank, black money)
- Vehicle ownership
- Society system (businesses)
### Example Code
```lua
-- Server-side ESX
ESX = exports['es_extended']:getSharedObject()
RegisterNetEvent('myresource:buyItem', function(itemName, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer.getMoney() >= price then
xPlayer.removeMoney(price)
xPlayer.addInventoryItem(itemName, amount)
end
end)
-- Client-side ESX
ESX = exports['es_extended']:getSharedObject()
RegisterNetEvent('esx:playerLoaded', function(playerData)
PlayerData = playerData
end)
```
### Common ESX Functions
```lua
-- Server-side
xPlayer.getMoney()
xPlayer.addMoney(amount)
xPlayer.removeMoney(amount)
xPlayer.getAccount(account).money
xPlayer.addAccountMoney(account, amount)
xPlayer.removeAccountMoney(account, amount)
xPlayer.getInventoryItem(item)
xPlayer.addInventoryItem(item, count)
xPlayer.removeInventoryItem(item, count)
xPlayer.getJob()
xPlayer.setJob(job, grade)
-- Client-side
ESX.ShowNotification(msg)
ESX.UI.Menu.Open(type, namespace, name, data, submit, cancel)
ESX.Game.SpawnVehicle(model, coords, heading, cb)
ESX.Game.DeleteVehicle(vehicle)
```
## QBCore (qb-core)
### When to Use
- Modern roleplay servers
- Need advanced features
- Want active development
- Prefer modular design
### Pros
- Modern codebase
- Active development
- Advanced inventory
- Better performance optimization
- More features out of box
- Flexible metadata system
### Cons
- Steeper learning curve
- Smaller community than ESX
- Fewer free resources
- More complex structure
- Breaking changes in updates
### Core Features
- Advanced player management
- Comprehensive inventory system
- Metadata system
- Gang system
- Crafting system
- Housing system
- Vehicle keys
- Stash system
### Example Code
```lua
-- Server-side QBCore
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('myresource:buyItem', function(itemName, amount)
local Player = QBCore.Functions.GetPlayer(source)
if Player.Functions.RemoveMoney('cash', price) then
Player.Functions.AddItem(itemName, amount)
end
end)
-- Client-side QBCore
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
PlayerData = QBCore.Functions.GetPlayerData()
end)
```
### Common QBCore Functions
```lua
-- Server-side
Player.Functions.AddMoney(type, amount)
Player.Functions.RemoveMoney(type, amount)
Player.Functions.GetMoney(type)
Player.Functions.AddItem(item, amount, slot, info)
Player.Functions.RemoveItem(item, amount, slot)
Player.Functions.GetItemByName(item)
Player.Functions.SetJob(job, grade)
Player.Functions.SetGang(gang, grade)
Player.Functions.SetMetaData(key, val)
Player.Functions.GetMetaData(key)
-- Client-side
QBCore.Functions.Notify(text, type, length)
QBCore.Functions.DrawText(text, position)
QBCore.Functions.SpawnVehicle(model, cb, coords, isnetworked)
QBCore.Functions.DeleteVehicle(vehicle)
QBCore.Functions.GetPlayerData()
```
## Migration Guide
### Standalone to ESX
1. Add `@es_extended/locale.lua` to fxmanifest
2. Add ESX dependency
3. Replace custom player system with ESX.GetPlayerFromId()
4. Convert money/inventory to ESX functions
### Standalone to QBCore
1. Add QB dependency to fxmanifest
2. Replace player system with QBCore.Functions.GetPlayer()
3. Convert all money/inventory operations
4. Update notifications to QBCore.Functions.Notify()
### ESX to QBCore
Common conversions:
| ESX | QBCore |
|-----|--------|
| `ESX.GetPlayerFromId(source)` | `QBCore.Functions.GetPlayer(source)` |
| `xPlayer.getMoney()` | `Player.Functions.GetMoney('cash')` |
| `xPlayer.addMoney(amount)` | `Player.Functions.AddMoney('cash', amount)` |
| `xPlayer.getInventoryItem(item)` | `Player.Functions.GetItemByName(item)` |
| `ESX.ShowNotification(msg)` | `QBCore.Functions.Notify(msg)` |
| `xPlayer.getJob()` | `Player.PlayerData.job` |
| `xPlayer.identifier` | `Player.PlayerData.citizenid` |
## Which Should You Choose?
### Choose Standalone If:
- Building simple resources
- Learning FiveM development
- Don't need player/economy system
- Want maximum flexibility
### Choose ESX If:
- Building traditional RP server
- Want lots of compatible resources
- Need stable, proven system
- Prefer simpler structure
- Large community support is priority
### Choose QBCore If:
- Want modern features
- Building advanced RP server
- Need better performance
- Want active development
- Flexible enough to customize deeply
## Performance Comparison
**Standalone**: Best (no framework overhead)
**ESX**: Good (some overhead from player system)
**QBCore**: Good-Very Good (optimized but more features)
## Conclusion
All three options are valid depending on your needs:
- **Standalone** for simple/custom projects
- **ESX** for traditional RP with maximum compatibility
- **QBCore** for modern RP with advanced features
The "best" framework depends on your specific requirements, technical skill, and server goals.
@@ -0,0 +1,8 @@
FiveM Documentation Results for: {{ $query }}
@foreach($results as $result)
📚 {{ $result['title'] }}
URL: {{ $result['url'] }}
{{ $result['description'] }}
@endforeach
@@ -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)