Skip to content

Commit

Permalink
add set team time /ct /tt
Browse files Browse the repository at this point in the history
  • Loading branch information
WessTorn committed Aug 3, 2021
1 parent 601748f commit 80ae7c8
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 12 deletions.
6 changes: 5 additions & 1 deletion data/lang/mixsystem.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ STATUS_NOPLAY = %s ^3%s^1 is ^3not available^1 for pick [^3NOPLAY^1]
STATUS_PLAY = %s ^3%s^1 is now ^3available^1 for pick [^3PLAY^1]

SET_WINTIME = %s ^3%s^1 set ^3wintime^1 to ^3%d^1 minutes.
NOT_SET_TIME = %s Disable mr mode, before changing wintimer.
SET_ROUNDTIME = %s ^3%s ^1 set ^3roundtime^1 to ^3%.2f^1 minutes.
SET_MAXROUNDS = %s ^3%s ^1 set ^3maxrounds^1 to ^3%d^1 rounds.
SER_TIME_TT = %s ^3%n^1 set timer for team TT to ^3%s:%s^1.
SER_TIME_CT = %s ^3%n^1 set timer for team CT to ^3%s:%s^1.
NOT_SET_TT = %s Invalid syntax. Example: ^3/tt 15:43^1.
NOT_SET_СT = %s Invalid syntax. Example: ^3/ct 15:43^1.
NOT_SET_TIME = %s Disable mr mode, before changing wintimer.
NOT_SET_MR = %s Disable timer mode, before changing maxrounds.

KILL_HIMSELF = %s ^3%s ^1killed himself
Expand Down
2 changes: 1 addition & 1 deletion scripting/HnsMatchSystem.sma
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public plugin_precache() {
}

public plugin_init() {
register_plugin("Hide'n'Seek Match System", "1.2.2", "??"); // Спасибо: Cultura, Garey, Medusa, Ruffman, Conor
register_plugin("Hide'n'Seek Match System", "1.2.3", "??"); // Спасибо: Cultura, Garey, Medusa, Ruffman, Conor

get_mapname(g_eMatchInfo[e_mMapName], charsmax(g_eMatchInfo[e_mMapName]));

Expand Down
90 changes: 83 additions & 7 deletions scripting/include/hns-match/say.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ public sayHandle(id) {
szTarget, charsmax(szTarget));

if (equali(szArgs, "/wintime", 8)) {
if(g_iCurrentRules == e_mMR) {
client_print_color(id, print_team_blue, "%L", id, "NOT_SET_TIME", prefix);
return PLUGIN_HANDLED;
}
trim(szTarget);

if (!getUserInAccess(id))
return PLUGIN_HANDLED;

if(g_iCurrentRules == e_mMR) {
client_print_color(id, print_team_blue, "%L", id, "NOT_SET_TIME", prefix);
return PLUGIN_HANDLED;
}

if (is_str_num(szTarget)) {
set_pcvar_num(g_eCvars[e_cCapTime], str_to_num(szTarget));
client_print_color(0, print_team_blue, "%L", id, "SET_WINTIME", prefix, getUserName(id), str_to_num(szTarget));
Expand All @@ -54,19 +55,94 @@ public sayHandle(id) {
}

if (equali(szArgs, "/maxround", 10)) {
trim(szTarget);

if (!getUserInAccess(id))
return PLUGIN_HANDLED;

if(g_iCurrentRules == e_mTimer) {
client_print_color(id, print_team_blue, "%L", id, "NOT_SET_MR", prefix);
return PLUGIN_HANDLED;
}

if (is_str_num(szTarget)) {
set_pcvar_num(g_eCvars[e_cMaxRounds], str_to_num(szTarget));
client_print_color(0, print_team_blue, "%L", id, "SET_MAXROUNDS", prefix, getUserName(id), str_to_num(szTarget));
}
return PLUGIN_CONTINUE;
}

if (equali(szArgs, "/tt", 15)) {
trim(szTarget);

if (!getUserInAccess(id))
return PLUGIN_HANDLED;

if (is_str_num(szTarget)) {
set_pcvar_num(g_eCvars[e_cMaxRounds], str_to_num(szTarget));
client_print_color(0, print_team_blue, "%L", id, "SET_MAXROUNDS", prefix, getUserName(id), str_to_num(szTarget));
if(g_iCurrentRules != e_mTimer) {
return PLUGIN_HANDLED;
}

new szMinutes[10], szSeconds[16];
replace(szTarget, charsmax(szTarget), ":", " ");
replace(szTarget, charsmax(szTarget), ".", " ");

if (!parse(szTarget, szMinutes, charsmax(szMinutes), szSeconds, charsmax(szSeconds))) {
client_print_color(id, print_team_blue, "%L", id, "NOT_SET_TT", prefix);
return PLUGIN_HANDLED;
}

if (!szMinutes[0] || !szSeconds[0]) {
client_print_color(id, print_team_blue, "%L", id, "NOT_SET_TT", prefix);
return PLUGIN_HANDLED;
}

new minutes = str_to_num(szMinutes);
new seconds = str_to_num(szSeconds);

if (seconds >= 60) {
client_print_color(id, print_team_blue, "%L", id, "NOT_SET_TT", prefix);
return PLUGIN_HANDLED;
}

g_flSidesTime[!g_iCurrentSW] = (get_pcvar_float(g_eCvars[e_cCapTime]) - (minutes + (seconds / 60.0))) * 60.0;
client_print_color(0, print_team_blue, "%L", 0, "SER_TIME_TT", prefix, id, szMinutes, szSeconds);
return PLUGIN_CONTINUE;
}

if (equali(szArgs, "/ct", 15)) {
trim(szTarget);

if (!getUserInAccess(id))
return PLUGIN_HANDLED;

if(g_iCurrentRules != e_mTimer) {
return PLUGIN_HANDLED;
}

new szMinutes[10], szSeconds[16];
replace(szTarget, charsmax(szTarget), ":", " ");
replace(szTarget, charsmax(szTarget), ".", " ");

if (!parse(szTarget, szMinutes, charsmax(szMinutes), szSeconds, charsmax(szSeconds))) {
client_print_color(id, print_team_blue, "%L", id, "NOT_SET_СT", prefix);
return PLUGIN_HANDLED;
}

if (!szMinutes[0] || !szSeconds[0]) {
client_print_color(id, print_team_blue, "%L", id, "NOT_SET_СT", prefix);
return PLUGIN_HANDLED;
}

new minutes = str_to_num(szMinutes);
new seconds = str_to_num(szSeconds);

if (seconds >= 60) {
client_print_color(id, print_team_blue, "%L", id, "NOT_SET_СT", prefix);
return PLUGIN_HANDLED;
}

g_flSidesTime[!g_iCurrentSW] = (get_pcvar_float(g_eCvars[e_cCapTime]) - (minutes + (seconds / 60.0))) * 60.0;
client_print_color(0, print_team_blue, "%L", 0, "SER_TIME_CT", prefix, id, szMinutes, szSeconds);
return PLUGIN_CONTINUE;
}

Expand Down
3 changes: 0 additions & 3 deletions scripting/include/hns-match/showinfo.inc
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ public apply_stats() {
}

public task_ShowPlayerInfo() {
if(g_iCurrentMode != e_mMatch)
return;

new iPlayers[MAX_PLAYERS], iNum;
get_players(iPlayers, iNum);

Expand Down

0 comments on commit 80ae7c8

Please sign in to comment.