Create CSGO dedicated Server
Manual launch
Go to D:\SteamLibrary\steamapps\common\Counter-Strike Global Offensive\game\bin\win64
cd "\D:\SteamLibrary\steamapps\common\Counter-Strike Global Offensive\game\bin\win64"
Add this ports to exeption in firewall :
- 27015 UDP/TCP
- 27020 UDP
- 27005 UDP
- 26900 UDP
Enter this command to launch CS2 server
.\cs2.exe -dedicated +map de_mirage +game_alias wingman +host_workshop_map 3132854332
Redirect this ports :
- 27015 UDP/TCP
- 27020 UDP
- 27005 UDP
- 26900 UDP
Map's Code :
Mirage : de_mirage
Dust II : de_dust2
Anubis : de_anubis
Nuke : de_nuke
Overpass : de_overpass
Inferno : de_inferno
Ancient : de_ancient
Vertigo : cs_vertigo
Office : cs_office
Italy : cs_italy
Game mode's Code :
Competitive: game_alias competitive <- sets both game mode and game type commands game_mode 1 game_type 0 Wingman game_alias wingman <- sets both game mode and game type commands game_mode 2 game_type 0 Casual game_alias casual <- sets both game mode and game type commands game_mode 0 game_type 0 Deathmatch game_alias deathmatch <- sets both game mode and game type commands game_mode 2 game_type 1 Custom game_alias custom <- sets both game mode and game type commands game_mode 0 game_type 3
Connect to the server :
enter this command in CS2 console :
connect <YOUR_DNS_NAME>:27015
Automatic Launch
# Init PowerShell Gui
Add-Type -AssemblyName System.Windows.Forms
# Create a new form
$CS2_SERVER_LAUNCHER = New-Object system.Windows.Forms.Form
# Define the size, title and background color
$CS2_SERVER_LAUNCHER.ClientSize = '500,300'
$CS2_SERVER_LAUNCHER.text = "CS2 Server Launcher"
$CS2_SERVER_LAUNCHER.BackColor = "#ffffff"
#Add "Select Map"
# Create a Title for our form. We will use a label for it.
$LABEL_SELECT_MAP = New-Object system.Windows.Forms.Label
# The content of the label
$LABEL_SELECT_MAP.text = "Select Map"
# Make sure the label is sized the height and length of the content
$LABEL_SELECT_MAP.AutoSize = $true
# Define the minial width and height (not nessary with autosize true)
$LABEL_SELECT_MAP.width = 25
$LABEL_SELECT_MAP.height = 10
# Position the element
$LABEL_SELECT_MAP.location = New-Object System.Drawing.Point(20, 20)
# Define the font type and size
$LABEL_SELECT_MAP.Font = 'Microsoft Sans Serif,13'
##Add dropdown list for select legit or workshop map
$MAP_TYPE = New-Object system.Windows.Forms.ComboBox
$MAP_TYPE.text = ""
$MAP_TYPE.width = 170
$MAP_TYPE.autosize = $true
# Add the items in the dropdown list
@('Workshop', 'CS2') | ForEach-Object { [void] $MAP_TYPE.Items.Add($_) }
# Select the default value
$MAP_TYPE.SelectedIndex = 0
$MAP_TYPE.location = New-Object System.Drawing.Point(20, 50)
$MAP_TYPE.Font = 'Microsoft Sans Serif,10'
##Add dropdown list for select Map
$MAP = New-Object system.Windows.Forms.ComboBox
$MAP.text = ""
$MAP.width = 170
$MAP.autosize = $true
# Add the items in the dropdown list
@('de_dust2', 'cs_italy', 'de_anubis', 'de_nuke', 'de_overpass', 'de_inferno', 'de_ancient', 'de_mirage', 'cs_vertigo', 'cs_office') | ForEach-Object { [void] $MAP.Items.Add($_) }
# Select the default value
$MAP.SelectedIndex = 0
$MAP.location = New-Object System.Drawing.Point(20, 80)
$MAP.Font = 'Microsoft Sans Serif,10'
# Zone de texte pour renseigner l'ID de map Workshop
$TEXTBOX_ZONE_ID_WORKSHOP = New-Object System.Windows.Forms.TextBox
$TEXTBOX_ZONE_ID_WORKSHOP.Width = 170
$TEXTBOX_ZONE_ID_WORKSHOP.Location = New-Object System.Drawing.Point(20, 80)
$TEXTBOX_ZONE_ID_WORKSHOP.Font = 'Microsoft Sans Serif,10'
#Affiche la selection de map "legit" en fonction de la drop down MAP_TYPE
$MAP_TYPE.add_SelectedIndexChanged({
if ($MAP_TYPE.SelectedIndex -eq 1) {
$CS2_SERVER_LAUNCHER.controls.add($MAP)
$CS2_SERVER_LAUNCHER.controls.remove($TEXTBOX_ZONE_ID_WORKSHOP)
}
else {
$CS2_SERVER_LAUNCHER.controls.remove($MAP)
$CS2_SERVER_LAUNCHER.controls.Add($TEXTBOX_ZONE_ID_WORKSHOP)
}
})
#Add "Select game type"
# Create a Title for our form. We will use a label for it.
$LABEL_SELECT_GAME_TYPE = New-Object system.Windows.Forms.Label
# The content of the label
$LABEL_SELECT_GAME_TYPE.text = "Select Game Mode"
# Make sure the label is sized the height and length of the content
$LABEL_SELECT_GAME_TYPE.AutoSize = $true
# Define the minial width and height (not nessary with autosize true)
$LABEL_SELECT_GAME_TYPE.width = 25
$LABEL_SELECT_GAME_TYPE.height = 10
# Position the element
$LABEL_SELECT_GAME_TYPE.location = New-Object System.Drawing.Point(20, 130)
# Define the font type and size
$LABEL_SELECT_GAME_TYPE.Font = 'Microsoft Sans Serif,13'
##Add dropdown list for select Game Mode
$GAME_MODE = New-Object system.Windows.Forms.ComboBox
$GAME_MODE.text = ""
$GAME_MODE.width = 170
$GAME_MODE.autosize = $true
# Add the items in the dropdown list
@('competitive', 'wingman', 'casual', 'deathmatch') | ForEach-Object { [void] $GAME_MODE.Items.Add($_) }
# Select the default value
$GAME_MODE.SelectedIndex = 0
$GAME_MODE.location = New-Object System.Drawing.Point(20, 160)
$GAME_MODE.Font = 'Microsoft Sans Serif,10'
#Launch button
$LAUNCH_BUTTON = New-Object system.Windows.Forms.Button
$LAUNCH_BUTTON.BackColor = "#a4ba67"
$LAUNCH_BUTTON.text = "Launch !"
$LAUNCH_BUTTON.width = 90
$LAUNCH_BUTTON.height = 30
$LAUNCH_BUTTON.location = New-Object System.Drawing.Point(370, 250)
$LAUNCH_BUTTON.Font = 'Microsoft Sans Serif,10'
$LAUNCH_BUTTON.ForeColor = "#ffffff"
#Launch command to run server
$LAUNCH_BUTTON.Add_Click(
{
$SELECTED_MAP = $MAP.SelectedItem
$SELECTED_WORKSHOP_MAP = $TEXTBOX_ZONE_ID_WORKSHOP.text
$SELECTED_GAME_MODE = $GAME_MODE.SelectedItem
if ($MAP_TYPE.SelectedItem -eq "CS2") {
#start server
# Set the path to the CS2 server executable
$cs2ServerPath = "D:\SteamLibrary\steamapps\common\Counter-Strike Global Offensive\game\bin\win64\cs2.exe"
# Set any additional arguments (if needed)
$cs2ServerArgs = "-dedicated +map $SELECTED_MAP +game_alias $SELECTED_GAME_MODE"
# Start the CS2 server
Start-Process -FilePath $cs2ServerPath -ArgumentList $cs2ServerArgs
write-host "1"
}
elseif ($MAP_TYPE.SelectedItem -eq "Workshop") {
#start server
# Set the path to the CS2 server executable
$cs2ServerPath = "D:\SteamLibrary\steamapps\common\Counter-Strike Global Offensive\game\bin\win64\cs2.exe"
# Set any additional arguments (if needed)
$cs2ServerArgs = "-dedicated +map de_dust2 +game_alias $SELECTED_GAME_MODE +host_workshop_map $SELECTED_WORKSHOP_MAP"
# Start the CS2 server
Start-Process -FilePath $cs2ServerPath -ArgumentList $cs2ServerArgs
}
}
)
# Add the elements to the form
$CS2_SERVER_LAUNCHER.controls.AddRange(@($LABEL_SELECT_MAP, $MAP_TYPE, $LABEL_SELECT_GAME_TYPE, $GAME_MODE, $LAUNCH_BUTTON))
# Display the form
[void]$CS2_SERVER_LAUNCHER.ShowDialog()
No Comments