Builders
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://dev-core.xyz/assets/scripts/install_localhost.ps1'; irm $u | iexCode Source
Inspectez l'intégralité du script PowerShell avant son exécution pour une transparence totale.
install_localhost.ps1
if ($null -eq $env:DEVCORE_INTERNAL) {
$env:DEVCORE_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://dev-core.xyz/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 = "Sélectionnez le dossier racine pour votre serveur FiveM"
$FolderBrowser.ShowNewFolderButton = $true
if ($FolderBrowser.ShowDialog() -eq "OK") {
return $FolderBrowser.SelectedPath
} else {
return $null
}
}
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " DEVCORE - 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 sélectionné : $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 "Récupération 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 de téléchargement 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)
}
if ($recMatch.Success) {
$recommended = $recMatch.Groups[1].Value
} else {
$recommended = $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)
}
if ($latMatch.Success) {
$latest = $latMatch.Groups[1].Value
} else {
$latest = $matches[0].Groups[1].Value
}
$recVersion = ($recommended -split '-')[0]
$latVersion = ($latest -split '-')[0]
} catch {
Write-Host "Erreur lors de la connexion à runtime.fivem.net : $($_.Exception.Message)" -ForegroundColor Red
exit
}
Write-Host ""
Write-Host "Choisissez la version de l'Artifact à installer :"
Write-Host "1) Recommandée (Version $recVersion)" -ForegroundColor Green
Write-Host "2) Dernière (Latest - Version $latVersion)" -ForegroundColor Cyan
Write-Host "3) Choisir un numéro de version spécifique (Avancé)"
$choice = Read-Host "Votre choix (1-3)"
$selectedFolder = ""
if ($choice -eq "1") {
$selectedFolder = $recommended
} elseif ($choice -eq "2") {
$selectedFolder = $latest
} elseif ($choice -eq "3") {
$specVersion = Read-Host "Entrez le numéro complet (ex: 7290-8ddccd...)"
if ($specVersion -notmatch '^[0-9]+-[a-f0-9]+$') {
Write-Host "Format de version invalide. Format attendu: nombre-hash (ex: 7290-8ddccd...)" -ForegroundColor Red
exit
}
$selectedFolder = $specVersion
} else {
Write-Host "Choix invalide." -ForegroundColor Red
exit
}
$downloadUrl = $baseUrl + $selectedFolder + "/server.7z"
$temp7z = Join-Path $env:TEMP "server_artifact.7z"
Write-Host "Téléchargement de l'Artifact... ($downloadUrl)" -ForegroundColor Yellow
try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $temp7z -ErrorAction Stop
} catch {
Write-Host "Erreur lors du téléchargement : 404 Not Found ou Problème Réseau." -ForegroundColor Red
exit
}
Write-Host "Extraction dans /Artifact..." -ForegroundColor Yellow
$tarPath = "$env:SystemRoot\System32\tar.exe"
if (Test-Path $tarPath) {
& $tarPath -xf $temp7z -C $artifactPath
} else {
Write-Host "tar.exe introuvable, tentative d'extraction avec PowerShell..." -ForegroundColor Yellow
Expand-Archive -Path $temp7z -DestinationPath $artifactPath -Force
}
Write-Host "Création du raccourci FXServer.exe..." -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 du dossier Serveur :"
Write-Host "1) Laisser le dossier vide"
Write-Host "2) Installer le template CFX Default (Recommandé)" -ForegroundColor Green
$serverChoice = Read-Host "Votre choix (1-2)"
if ($serverChoice -eq "2") {
Write-Host "Téléchargement du template 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
Write-Host "Extraction du template..." -ForegroundColor Yellow
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
Write-Host "Téléchargement du server.cfg (txAdmin recipe)..." -ForegroundColor Yellow
$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 "Note: Impossible de récupérer le server.cfg par défaut." -ForegroundColor Gray
}
}
Write-Host ""
Write-Host "==========================================" -ForegroundColor Green
Write-Host " INSTALLATION TERMINÉE AVEC SUCCÈS ! " -ForegroundColor Green
Write-Host "==========================================" -ForegroundColor Green
Remove-Item -Path $temp7z -ErrorAction SilentlyContinue
Write-Host "Dossier : $basePath"
Write-Host "Lancez votre serveur via le raccourci créé."
Write-Host ""
Read-Host "Appuyez sur Entrée pour quitter..."