From 408d21ccc37ab8b7848b9e0eecc48bd38d2ae89c Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 9 Feb 2020 02:45:27 +0300 Subject: [PATCH] added centerprint command --- src/game/g_console.pas | 1 + src/game/g_game.pas | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/game/g_console.pas b/src/game/g_console.pas index 3f285b4..27ef5ec 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -972,6 +972,7 @@ begin AddCommand('reconnect', GameCommands); AddCommand('say', GameCommands); AddCommand('tell', GameCommands); + AddCommand('centerprint', GameCommands); AddCommand('overtime', GameCommands); AddCommand('rcon_password', GameCommands); AddCommand('rcon', GameCommands); diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 504171d..23c0943 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -7246,6 +7246,30 @@ begin end else g_Console_Add(_lc[I_MSG_SERVERONLY]); end + else if cmd = 'centerprint' then + begin + if (Length(P) > 2) and (P[1] <> '') then + begin + chstr := ''; + for a := 2 to High(P) do + chstr := chstr + P[a] + ' '; + + if Length(chstr) > 200 then SetLength(chstr, 200); + + if Length(chstr) < 1 then + begin + g_Console_Add('centerprint '); + Exit; + end; + + a := StrToIntDef(P[1], 100); + chstr := b_Text_Format(chstr); + g_Game_Message(chstr, a); + if g_Game_IsNet and g_Game_IsServer then + MH_SEND_GameEvent(NET_EV_BIGTEXT, a, chstr); + end + else g_Console_Add('centerprint '); + end else if (cmd = 'overtime') and not g_Game_IsClient then begin if (Length(P) = 1) or (StrToIntDef(P[1], -1) <= 0) then -- 2.29.2