Skip to content

Instantly share code, notes, and snippets.

@PhrozenByte
Created January 11, 2020 19:47
Show Gist options
  • Save PhrozenByte/71696abd759e5c67e4aabb4361eec147 to your computer and use it in GitHub Desktop.
Save PhrozenByte/71696abd759e5c67e4aabb4361eec147 to your computer and use it in GitHub Desktop.
Creates a empty public lobby in Grand Theft Auto Online.
# Creates a empty public lobby in Grand Theft Auto Online.
# by Daniel Rudolf <https://github.com/PhrozenByte>
#
# This PowerShell v3+ script suspends `GTA5.exe` for 8 seconds, causing
# GTA Online to create a empty public lobby. For undisturbed fun
# without modders, griefers and other pathetic pip-squeaks.
#
# License:
# Creative Commons CC0
# <https://creativecommons.org/publicdomain/zero/1.0/deed>
#
# Usage:
# 1. Download `pause-process.ps1` from the following URL and copy it to
# a new folder: <https://github.com/besimorhino/Pause-Process>
# 2. Download and move `gta-empty-lobby.ps1` to the same folder
# 3. Create a new (desktop) shortcut using the following target:
# powershell.exe -File "C:\Full\Path\To\gta-empty-lobby.ps1"
# 4. Right-click the shortcut, choose "Properties", switch to the
# "Shortcut" tab, click "Advanced" and enable "Run as Administrator"
#
# Credits:
# All credits go to Mick Douglas and Aaron Sawyer for creating the
# `pause-process.ps1` PowerShell script. We do no more than calling
# their script to pause `GTA5.exe`...
#
Import-Module "$PSScriptRoot\pause-process.ps1"
$CurrentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if (-Not $CurrentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error -Category PermissionDenied -Message "You must run this script with admin privileges"
Read-Host
Exit
}
$GTA5_PID = (Get-Process -Name GTA5 -ErrorAction SilentlyContinue).Id
if (-Not $GTA5_PID) {
Write-Error -Category ObjectNotFound -Message "GTA5.exe isn't running"
Read-Host
Exit
}
Write-Host "Suspending GTA5.exe for 8 seconds" -NoNewLine
Pause-Process -ID $GTA5_PID
for ($i=0; $i -lt 8; $i++) {
Sleep 1
Write-Host "." -NoNewLine
}
Write-Host ""
Write-Host "Resuming GTA5.exe..."
UnPause-Process -ID $GTA5_PID
Sleep 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment