BASE RP · FR

Base Serveur FiveM Française 25+ métiers, 15+ activités illégales, mappings FR — clé en main — 150 €

Découvrir

Localhost Builder

La méthode la plus rapide pour créer un serveur de test propre, récupérant dynamiquement les dernières versions officielles.

Structure Pro

Crée automatiquement les dossiers /Artifact et /Serveur pour une organisation parfaite.

Artifacts Officiels

Télécharge directement depuis runtime.fivem.net (Recommended ou Latest).

Template CFX

Installation optionnelle des ressources de base et du server.cfg de Cfx.re.

Raccourci

Génère un lien direct vers FXServer.exe à la racine de votre dossier.

Build Rapide (One-Liner)
$u='https://gothamdev.fr/fivem/assets/scripts/install_localhost.ps1'; irm $u | iex
OU
Télécharger l'Installeur (.bat)

Code Source

Inspectez l'intégralité du script PowerShell avant son exécution pour une transparence totale.

install_localhost.ps1
if ($null -eq $env:GOTHAMDEV_INTERNAL) {
    $env:GOTHAMDEV_INTERNAL = "1"

    if ($MyInvocation.MyCommand.Path) {
        $target = "-File `"$($MyInvocation.MyCommand.Path)`""
    } elseif ($u) {
        $target = "-Command `"`$u='$u'; irm `$u | iex`""
    } else {
        $target = "-Command `"irm https://gothamdev.fr/fivem/assets/scripts/install_localhost.ps1 | iex`""
    }

    $fullCmd = "chcp 65001 >nul & powershell -NoExit -ExecutionPolicy Bypass $target"
    Start-Process cmd -ArgumentList "/c $fullCmd"
    exit
}

[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

function Get-FolderName {
    Add-Type -AssemblyName System.Windows.Forms
    $FolderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog
    $FolderBrowser.Description = "Selectionnez le dossier racine pour votre serveur FiveM"
    $FolderBrowser.ShowNewFolderButton = $true

    if ($FolderBrowser.ShowDialog() -eq "OK") {
        return $FolderBrowser.SelectedPath
    }
    return $null
}

Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " GOTHAMDEV - INSTALLATEUR LOCALHOST " -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host ""

$basePath = Get-FolderName
if (-not $basePath) {
    Write-Host "Annulation de l'installation." -ForegroundColor Red
    exit
}

Write-Host "Dossier selectionne : $basePath" -ForegroundColor Green

$artifactPath = Join-Path $basePath "Artifact"
$serverPath = Join-Path $basePath "Serveur"

if (-not (Test-Path $artifactPath)) { New-Item -ItemType Directory -Path $artifactPath | Out-Null }
if (-not (Test-Path $serverPath)) { New-Item -ItemType Directory -Path $serverPath | Out-Null }

Write-Host "Recuperation des versions disponibles..." -ForegroundColor Yellow
$baseUrl = "https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/"

try {
    $web = Invoke-WebRequest -Uri $baseUrl -UseBasicParsing -UserAgent "Mozilla/5.0"
    $html = $web.Content
    $regex = 'href\s*=\s*"\./(\d+-[a-f0-9]+)/server\.7z"'
    $matches = [regex]::Matches($html, $regex)
    if ($matches.Count -eq 0) {
        Write-Host "Impossible de trouver les liens sur runtime.fivem.net" -ForegroundColor Red
        exit
    }

    $recRegex = 'href\s*=\s*"\./(\d+-[a-f0-9]+)/server\.7z"[^>]*is-primary'
    $recMatch = [regex]::Match($html, $recRegex)
    if (-not $recMatch.Success) {
        $recRegex = 'is-primary[^>]*href\s*=\s*"\./(\d+-[a-f0-9]+)/server\.7z"'
        $recMatch = [regex]::Match($html, $recRegex)
    }
    $recommended = if ($recMatch.Success) { $recMatch.Groups[1].Value } else { $matches[0].Groups[1].Value }

    $latRegex = 'is-active[^>]*href\s*=\s*"\./(\d+-[a-f0-9]+)/server\.7z"'
    $latMatch = [regex]::Match($html, $latRegex)
    if (-not $latMatch.Success) {
        $latRegex = 'href\s*=\s*"\./(\d+-[a-f0-9]+)/server\.7z"[^>]*is-active'
        $latMatch = [regex]::Match($html, $latRegex)
    }
    $latest = if ($latMatch.Success) { $latMatch.Groups[1].Value } else { $matches[0].Groups[1].Value }

    $recVersion = ($recommended -split '-')[0]
    $latVersion = ($latest -split '-')[0]
} catch {
    Write-Host "Erreur runtime.fivem.net : $($_.Exception.Message)" -ForegroundColor Red
    exit
}

Write-Host ""
Write-Host "Choisissez la version de l'Artifact :"
Write-Host "1) Recommandee (Version $recVersion)" -ForegroundColor Green
Write-Host "2) Derniere (Latest - Version $latVersion)" -ForegroundColor Cyan
Write-Host "3) Version specifique (Avance)"
$choice = Read-Host "Votre choix (1-3)"

if ($choice -eq "1") { $selectedFolder = $recommended }
elseif ($choice -eq "2") { $selectedFolder = $latest }
elseif ($choice -eq "3") { $selectedFolder = Read-Host "Numero complet (ex: 7290-8ddccd...)" }
else { Write-Host "Choix invalide." -ForegroundColor Red; exit }

$downloadUrl = $baseUrl + $selectedFolder + "/server.7z"
$temp7z = Join-Path $env:TEMP "server_artifact.7z"
$temp7zaZip = Join-Path $env:TEMP "7za.zip"
$temp7zaDir = Join-Path $env:TEMP "7za_tool"

Write-Host "Telechargement de l'Artifact..." -ForegroundColor Yellow
try {
    Invoke-WebRequest -Uri $downloadUrl -OutFile $temp7z -ErrorAction Stop
} catch {
    Write-Host "Erreur telechargement artifact." -ForegroundColor Red
    exit
}

if (-not (Test-Path (Join-Path $temp7zaDir "7za.exe"))) {
    Write-Host "Preparation outil extraction..." -ForegroundColor Gray
    Invoke-WebRequest -Uri "https://www.7-zip.org/a/7za920.zip" -OutFile $temp7zaZip
    Expand-Archive -Path $temp7zaZip -DestinationPath $temp7zaDir -Force
}

$exe7za = Join-Path $temp7zaDir "7za.exe"
Write-Host "Extraction dans /Artifact..." -ForegroundColor Yellow
Start-Process -FilePath $exe7za -ArgumentList "x `"$temp7z`" -o`"$artifactPath`" -y" -Wait -NoNewWindow

Write-Host "Creation raccourci FXServer..." -ForegroundColor Yellow
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut((Join-Path $basePath "Lancer FXServer.lnk"))
$Shortcut.TargetPath = Join-Path $artifactPath "FXServer.exe"
$Shortcut.WorkingDirectory = $artifactPath
$Shortcut.Save()

Write-Host ""
Write-Host "Configuration dossier Serveur :"
Write-Host "1) Laisser vide"
Write-Host "2) Installer template CFX Default (Recommande)" -ForegroundColor Green
$serverChoice = Read-Host "Votre choix (1-2)"

if ($serverChoice -eq "2") {
    Write-Host "Telechargement cfx-server-data..." -ForegroundColor Yellow
    $tempDataZip = Join-Path $env:TEMP "cfx-server-data.zip"
    Invoke-WebRequest -Uri "https://github.com/citizenfx/cfx-server-data/archive/refs/heads/master.zip" -OutFile $tempDataZip
    Expand-Archive -Path $tempDataZip -DestinationPath $env:TEMP -Force
    $extractedFolder = Join-Path $env:TEMP "cfx-server-data-master"
    Get-ChildItem -Path $extractedFolder | Move-Item -Destination $serverPath -Force

    $cfgUrl = "https://raw.githubusercontent.com/citizenfx/txAdmin-recipes/main/default-fivem/server.cfg"
    try {
        Invoke-WebRequest -Uri $cfgUrl -OutFile (Join-Path $serverPath "server.cfg") -ErrorAction SilentlyContinue
    } catch {}
}

Write-Host ""
Write-Host "==========================================" -ForegroundColor Green
Write-Host " INSTALLATION TERMINEE ! " -ForegroundColor Green
Write-Host "==========================================" -ForegroundColor Green

Remove-Item -Path $temp7z -ErrorAction SilentlyContinue
Remove-Item -Path $temp7zaZip -ErrorAction SilentlyContinue
Remove-Item -Path $temp7zaDir -Recurse -Force -ErrorAction SilentlyContinue

Write-Host "Dossier : $basePath"
Write-Host "Lancez via le raccourci Lancer FXServer.lnk"
Read-Host "Appuyez sur Entree pour quitter..."
Contenu protégé — © GothamDev Studio