This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
execut1ve
committed
Oct 17, 2023
1 parent
5bc91bc
commit a8c1dc5
Showing
2 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
# lo3-match-plugin-for-cs2 | ||
5vs5 competitive match plugin written in Lua VScript for Counter-Strike 2. | ||
|
||
## How to Install | ||
- Install [Metamod](https://www.sourcemm.net/downloads.php?branch=dev) | ||
- Install [LuaUnlocker](https://github.com/Source2ZE/LuaUnlocker) | ||
- Extract the package contents into `game/csgo`` on your server | ||
- Add `exec lo3_matchplugin` to your servers gamemode cfg (e.g. `gamemode_competitive.cfg`) | ||
|
||
## How it works | ||
### Warmup | ||
- `.lo3` Start a match | ||
- `.scramble` Player scramble 3 times | ||
- `.help` Show command help | ||
|
||
### in-game | ||
- `.pause` Pause match | ||
- `.unpause` Unpause match | ||
- `.forceend` Cancel a match | ||
|
||
## Credit | ||
[@execut1ve](https://twitter.com/execut1ve) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
require "libs.timers" | ||
chatPrefix = "{darkgreen} [LO3] " | ||
|
||
WARMUP_TIME = true | ||
warmupDelay = 0 | ||
scrambleDelay = 0 | ||
scrambleTime = 0 | ||
|
||
function HC_ReplaceColorCodes_pug(text) | ||
text = string.gsub(text, "{white}", "\x01") | ||
text = string.gsub(text, "{darkred}", "\x02") | ||
text = string.gsub(text, "{purple}", "\x03") | ||
text = string.gsub(text, "{darkgreen}", "\x04") | ||
text = string.gsub(text, "{lightgreen}", "\x05") | ||
text = string.gsub(text, "{green}", "\x06") | ||
text = string.gsub(text, "{red}", "\x07") | ||
text = string.gsub(text, "{lightgray}", "\x08") | ||
text = string.gsub(text, "{yellow}", "\x09") | ||
text = string.gsub(text, "{orange}", "\x10") | ||
text = string.gsub(text, "{darkgray}", "\x0A") | ||
text = string.gsub(text, "{blue}", "\x0B") | ||
text = string.gsub(text, "{darkblue}", "\x0C") | ||
text = string.gsub(text, "{gray}", "\x0D") | ||
text = string.gsub(text, "{darkpurple}", "\x0E") | ||
text = string.gsub(text, "{lightred}", "\x0F") | ||
return text | ||
end | ||
|
||
function HC_PrintChatAll_pug(text) | ||
ScriptPrintMessageChatAll(" " .. HC_ReplaceColorCodes_pug(chatPrefix .. text)) | ||
end | ||
|
||
function PrintHelp() | ||
HC_PrintChatAll_pug("{white}------------------------------------------------") | ||
HC_PrintChatAll_pug("{white}【ウォームアップ中】") | ||
HC_PrintChatAll_pug("{red}.lo3{white} : 試合を開始します。") | ||
HC_PrintChatAll_pug("{red}.restart{white} : ウォームアップをリスタートします。") | ||
HC_PrintChatAll_pug("{red}.scramble{white} : チームメンバーを3回シャッフルします。") | ||
HC_PrintChatAll_pug("{white}【試合中】") | ||
HC_PrintChatAll_pug("{red}.pause{white} : 試合をポーズ状態にします。") | ||
HC_PrintChatAll_pug("{red}.unpause{white} : 試合のポーズ状態を解除します。") | ||
HC_PrintChatAll_pug("{red}.forceend{white} : 試合を強制終了します。") | ||
HC_PrintChatAll_pug("{white}------------------------------------------------") | ||
end | ||
|
||
function PrintWaitingforPlayers(event) | ||
Timers:CreateTimer("warmup_timer", { | ||
callback = function() | ||
if (WARMUP_TIME == true) then | ||
if warmupDelay == 20 then | ||
SendToServerConsole("bot_kick") | ||
HC_PrintChatAll_pug("{white} ウォームアップ中、sv_cheatsは有効です。") | ||
HC_PrintChatAll_pug("{white} 全員の準備が確認できたあと、") | ||
HC_PrintChatAll_pug("{white} コンソールに {red}.lo3{white} とタイプして試合を開始します。") | ||
HC_PrintChatAll_pug("{white} コンソールに {red}.help{white} とタイプしてヘルプを表示します。") | ||
warmupDelay = 0 | ||
else | ||
warmupDelay = warmupDelay + 1 | ||
end | ||
end | ||
return 1 | ||
end, | ||
}) | ||
end | ||
|
||
function StartWarmup() | ||
SendToServerConsole("mp_unpause_match") | ||
SendToServerConsole("bot_kick") | ||
SendToServerConsole("sv_cheats 1") | ||
SendToServerConsole("sv_grenade_trajectory_prac_pipreview 1") | ||
SendToServerConsole("sv_grenade_trajectory_prac_trailtime 4") | ||
SendToServerConsole("sv_infinite_ammo 2") | ||
SendToServerConsole("mp_buy_anywhere 1") | ||
SendToServerConsole("mp_warmuptime 234124235") | ||
SendToServerConsole("mp_warmuptime_all_players_connected 234124235") | ||
SendToServerConsole("mp_warmup_pausetimer 1") | ||
SendToServerConsole("mp_warmup_start") | ||
HC_PrintChatAll_pug("{white} ウォームアップ中、sv_cheatsは有効です。") | ||
HC_PrintChatAll_pug("{white} 全員の準備が確認できたあと、") | ||
HC_PrintChatAll_pug("{white} コンソールに {red}.lo3{white} とタイプして試合を開始します。") | ||
HC_PrintChatAll_pug("{white} コンソールに {red}.help{white} とタイプしてヘルプを表示します。") | ||
WARMUP_TIME = true | ||
end | ||
|
||
function StartPug() | ||
SendToServerConsole("bot_kick") | ||
SendToServerConsole("mp_warmup_start") | ||
SendToServerConsole("sv_grenade_trajectory_prac_pipreview 0") | ||
SendToServerConsole("sv_grenade_trajectory_prac_trailtime 0") | ||
SendToServerConsole("sv_infinite_ammo 0") | ||
SendToServerConsole("mp_buy_anywhere 0") | ||
SendToServerConsole("sv_cheats 0") | ||
SendToServerConsole("mp_warmuptime 10") | ||
SendToServerConsole("mp_warmuptime_all_players_connected 10") | ||
SendToServerConsole("mp_warmup_pausetimer 0") | ||
HC_PrintChatAll_pug("{white} 10秒後に試合が開始されます。") | ||
HC_PrintChatAll_pug("{white} 10秒後に試合が開始されます。") | ||
HC_PrintChatAll_pug("{white} 10秒後に試合が開始されます。") | ||
WARMUP_TIME = false | ||
end | ||
|
||
function ScrambleTeams() | ||
scrambleTime = 2 | ||
HC_PrintChatAll_pug("{white} チームメンバーがあと3回シャッフルされます。") | ||
SendToServerConsole("mp_scrambleteams") | ||
Timers:CreateTimer("scramble_timer", { | ||
callback = function() | ||
if scrambleDelay == 1 then | ||
HC_PrintChatAll_pug("{white} チームメンバーがあと"..scrambleTime.."回シャッフルされます。") | ||
SendToServerConsole("mp_scrambleteams") | ||
scrambleTime = scrambleTime - 1 | ||
scrambleDelay = 0 | ||
else | ||
scrambleDelay = scrambleDelay + 1 | ||
end | ||
if scrambleTime == 0 then | ||
Timers:RemoveTimer(scramble_timer) | ||
end | ||
return 1 | ||
end, | ||
}) | ||
end | ||
|
||
Convars:RegisterCommand(".lo3", function() | ||
local user = Convars:GetCommandClient() | ||
|
||
if (WARMUP_TIME == true) then | ||
StartPug() | ||
end | ||
end, nil, 0) | ||
|
||
Convars:RegisterCommand(".help", function() | ||
local user = Convars:GetCommandClient() | ||
PrintHelp() | ||
end, nil, 0) | ||
|
||
Convars:RegisterCommand(".forceend", function() | ||
local user = Convars:GetCommandClient() | ||
if (WARMUP_TIME == false) then | ||
HC_PrintChatAll_pug("{red} 試合が中止されました。") | ||
StartWarmup() | ||
end | ||
end, nil, 0) | ||
|
||
Convars:RegisterCommand(".scramble", function() | ||
local user = Convars:GetCommandClient() | ||
|
||
if (WARMUP_TIME == true) then | ||
ScrambleTeams() | ||
end | ||
end, nil, 0) | ||
|
||
Convars:RegisterCommand(".pause", function() | ||
local user = Convars:GetCommandClient() | ||
|
||
SendToServerConsole("mp_pause_match") | ||
HC_PrintChatAll_pug("{white} 試合がポーズ状態になります。") | ||
end, nil, 0) | ||
|
||
Convars:RegisterCommand(".unpause", function() | ||
local user = Convars:GetCommandClient() | ||
HC_PrintChatAll_pug("{white} 試合のポーズ状態が解除されます。") | ||
SendToServerConsole("mp_unpause_match") | ||
end, nil, 0) | ||
|
||
function OnPlayerSpawned(event) | ||
PrintWaitingforPlayers(event) | ||
end | ||
|
||
StartWarmup() | ||
|
||
ListenToGameEvent("player_spawn", OnPlayerSpawned, nil) | ||
|
||
print("[LO3] Plugin loaded!") |