Skip to content

Commit b7ef20b

Browse files
authored
Merge pull request #12 from ShadowsAdi/bugfixes-improvements
- MixSettings.ini additions: - Implemented `KNIFE_ROUND_START_DELAY ` to control voting time after knife round end. - Implemented `DEFAULT_START_POINTS` setting to control new players start points. - Implemented `regex` to replace unwanted text in player's name. Fixes #11 - Fixed player's score swap at halftime. Fixes #11 #7 - Fixed stats restore after reconnect ( now stored by `AuthID` instead of `Name` ) - Optimized `Knife Round` weapons event handle logic. - Fixed `Rank` logic when showcasing in player's name. - Implemented `SetGameDesc` method to set game description based on what is happening on server. - Fixed problems with `client_print_color` 2nd parameter being incorrect. - mix_system.txt: - Added more entries related to `mix_system.sma`
2 parents 3931081 + 8311ac4 commit b7ef20b

4 files changed

Lines changed: 325 additions & 259 deletions

File tree

configs/MixSettings.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ PAUSE_DURATION = 60
4343
# 0 - No | 1 - Yes
4444
START_TEN_REQUIRED = 1
4545

46+
# Knife round finish delay.
47+
# Also the time players have to vote the start side.
48+
# Time must be in seconds.
49+
KNIFE_ROUND_START_DELAY = 10
50+
51+
# Start points for new players.
52+
DEFAULT_START_POINTS = 700
53+
4654
[Commands Section]
4755

4856
# Note:

data/lang/mix_system.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ KNIFE_STARTED = ^1The Knife Round has started.
1818
KNIFE_STARTED_BY_YOU = ^1The Knife Round was started by ^4You^1.
1919
KNIFE_STARTED_BY_X = ^1The Knife Round was started by ^4%s^1.
2020
KNIFE_ROUND_WON_BY_X_TEAM = ^1The Knife Round was won by team ^4%s^1.
21+
KNIFE_ROUND_MATCH_START_IN = ^1The Match will start in ^4%d ^1seconds.
2122

2223
CT_TEAM = CT
2324
TERO_TEAM = TERRORIST
@@ -141,6 +142,11 @@ RECEIVED = received
141142

142143
MIX_NEED_STOP_TO_CHANGEMAP = Mix needs to be ^3stopped^1 to change the map.
143144

145+
MATCHSTATE_WARM = [Warmup]
146+
MATCHSTATE_IN_MATCH = [CT %d - TERO %d]
147+
MATCHSTATE_KNIFE_ROUND = [Knife Round]
148+
MATCHSTATE_OVERTIME = Overtime [CT %d - TERO %d]
149+
144150
[ro]
145151
YOU_DONT_HAVE_ACCESS = ^1Nu ai acces la aceasta comanda!
146152

@@ -161,6 +167,7 @@ KNIFE_STARTED = ^1Runda de cutite a pornit.
161167
KNIFE_STARTED_BY_YOU = ^1Runda de Cutite a fost pornita de catre ^4Tine^1.
162168
KNIFE_STARTED_BY_X = ^1Runda de Cutite a fost pornita de catre ^4%s^1.
163169
KNIFE_ROUND_WON_BY_X_TEAM = ^1Runda de Cutite a fost castigata de echipa ^4%s^1.
170+
KNIFE_ROUND_MATCH_START_IN = ^1Meciul va incepe in ^4%d ^1secunde.
164171

165172
CT_TEAM = CT
166173
TERO_TEAM = TERRORIST
@@ -284,6 +291,11 @@ RECEIVED = primit
284291

285292
MIX_NEED_STOP_TO_CHANGEMAP = Mix-ul trebuie sa fie ^3oprit^1 pentru a putea schimba harta.
286293

294+
MATCHSTATE_WARM = [Incalzire]
295+
MATCHSTATE_IN_MATCH = [CT %d - TERO %d]
296+
MATCHSTATE_KNIFE_ROUND = [Runda de cutite]
297+
MATCHSTATE_OVERTIME = Overtime [CT %d - TERO %d]
298+
287299
[ru]
288300
YOU_DONT_HAVE_ACCESS = ^1Вы не имеете доступа к этой команде!
289301

@@ -304,6 +316,7 @@ KNIFE_STARTED = ^1Ножевой раунд начался.
304316
KNIFE_STARTED_BY_YOU = ^1Ножевой раунд был начат ^4вами^1.
305317
KNIFE_STARTED_BY_X = ^1Ножевой раунд был начат игроком ^4%s^1.
306318
KNIFE_ROUND_WON_BY_X_TEAM = ^1Ножевой раунд выиграла команда ^4%s^1.
319+
KNIFE_ROUND_MATCH_START_IN = ^1Матч начнется через ^4%d ^1секунд.
307320

308321
CT_TEAM = КТ
309322
TERO_TEAM = ТЕРРОРИСТЫ
@@ -426,3 +439,8 @@ DAMAGE = урон
426439
RECEIVED = принятый
427440

428441
MIX_NEED_STOP_TO_CHANGEMAP = Чтобы иметь возможность сменить карту, игра должна быть ^3остановлена^1.
442+
443+
MATCHSTATE_WARM = [Разминка]
444+
MATCHSTATE_IN_MATCH = [CT %d - TERO %d]
445+
MATCHSTATE_KNIFE_ROUND = [Раунд с ножом]
446+
MATCHSTATE_OVERTIME = Дополнительное время [CT %d - TERO %d]

scripting/mix_database_stats.sma

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ public mix_database_connected(Handle:hTuple, Handle:iSqlConn)
102102

103103
if(g_iSqlConnection == Empty_Handle)
104104
{
105-
log_to_file("mix_system.log", "{%s} Failed to connect to database. Make sure databse settings are right!", PLUGIN)
105+
log_to_file("mix_system_stats.log", "{%s} Failed to connect to database. Make sure databse settings are right!", PLUGIN)
106106
return
107107
}
108108

109-
new szQueryData[612];
109+
new szQueryData[800];
110110
formatex(szQueryData, charsmax(szQueryData), "CREATE TABLE IF NOT EXISTS `%s` \
111111
(`MatchID` int(11) NOT NULL,\
112112
`SteamID` varchar(32) NOT NULL,\
@@ -122,6 +122,7 @@ public mix_database_connected(Handle:hTuple, Handle:iSqlConn)
122122
`PointsEnd` int(11) NOT NULL DEFAULT 0,\
123123
`MVPS` int(11) NOT NULL DEFAULT 0,\
124124
`Winner` int(1) NOT NULL DEFAULT 0,\
125+
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), \
125126
PRIMARY KEY(MatchID, SteamID));", PLAYERS_TABLE)
126127

127128
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQueryData)
@@ -134,10 +135,11 @@ public mix_database_connected(Handle:hTuple, Handle:iSqlConn)
134135
`Winner` varchar(12) DEFAULT 'In Progress',\
135136
`CTScore` int(11) NOT NULL,\
136137
`TSCORE` int(11) NOT NULL,\
137-
`Timestamp` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\
138+
`Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\
138139
`CT` VARCHAR(32) NOT NULL DEFAULT 'CT',\
139140
`TE` VARCHAR(32) NOT NULL DEFAULT 'T',\
140141
`Status` VARCHAR(32) NOT NULL DEFAULT 'In Progress',\
142+
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), \
141143
PRIMARY KEY(MatchID));", MATCH_TABLE)
142144

143145
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQueryData)
@@ -155,8 +157,8 @@ public mix_database_connected(Handle:hTuple, Handle:iSqlConn)
155157

156158
if(containi(g_szSqlError, "Unknown column") != -1)
157159
{
158-
formatex(szQueryData, charsmax(szQueryData), "ALTER TABLE `%s` ADD `JoinDate` DATE NOT NULL DEFAULT current_timestamp(), \
159-
ADD `LastSeenDate` DATETIME NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()", szTemp)
160+
formatex(szQueryData, charsmax(szQueryData), "ALTER TABLE `%s` ADD `JoinDate` DATE, \
161+
ADD `LastSeenDate` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()", szTemp)
160162

161163
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQueryData)
162164
}
@@ -260,6 +262,8 @@ public mix_match_winner(iPlayer)
260262
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQuery, szQuery, sizeof(szQuery))
261263

262264
g_ePlayerData[iPlayer][iWins] += 1
265+
266+
mix_user_save(iPlayer)
263267
}
264268

265269
SetDropped(id)
@@ -460,12 +464,12 @@ public QueryHandlerLoad(iFailState, Handle:iQuery, szError[], iErrorCode, sTemp[
460464
{
461465
case TQUERY_CONNECT_FAILED:
462466
{
463-
log_to_file("mix_system.log", "[SQL Error] Connection failed (%i): %s", iErrorCode, szError);
467+
log_to_file("mix_system_stats.log", "[SQL Error] Connection failed (%i): %s", iErrorCode, szError);
464468
return
465469
}
466470
case TQUERY_QUERY_FAILED:
467471
{
468-
log_to_file("mix_system.log", "[SQL Error] Query failed (%i): %s", iErrorCode, szError);
472+
log_to_file("mix_system_stats.log", "[SQL Error] Query failed (%i): %s", iErrorCode, szError);
469473
return
470474
}
471475
}
@@ -517,12 +521,12 @@ public HandleLoad(iFailState, Handle:iQuery, szError[], iErrorCode, sTemp[])
517521
{
518522
case TQUERY_CONNECT_FAILED:
519523
{
520-
log_to_file("mix_system.log", "[SQL Error] Connection failed (%i): %s", iErrorCode, szError);
524+
log_to_file("mix_system_stats.log", "[SQL Error] Connection failed (%i): %s", iErrorCode, szError);
521525
return
522526
}
523527
case TQUERY_QUERY_FAILED:
524528
{
525-
log_to_file("mix_system.log", "[SQL Error] Query failed (%i): %s", iErrorCode, szError);
529+
log_to_file("mix_system_stats.log", "[SQL Error] Query failed (%i): %s", iErrorCode, szError);
526530
return
527531
}
528532
}
@@ -549,10 +553,10 @@ public QueryHandler(iFailState, Handle:iQuery, szError[], iErrorCode)
549553
{
550554
case TQUERY_CONNECT_FAILED:
551555
{
552-
log_to_file("mix_system.log", "[SQL Error] Connection failed (%i): %s", iErrorCode, szError); }
556+
log_to_file("mix_system_stats.log", "[SQL Error] Connection failed (%i): %s", iErrorCode, szError); }
553557
case TQUERY_QUERY_FAILED:
554558
{
555-
log_to_file("mix_system.log", "[SQL Error] Query failed (%i): %s", iErrorCode, szError);
559+
log_to_file("mix_system_stats.log", "[SQL Error] Query failed (%i): %s", iErrorCode, szError);
556560
}
557561
}
558562
}

0 commit comments

Comments
 (0)