Skip to content

Commit

Permalink
ChatAdditions.inc: Fix compilation on AMXX 1.9.0 (#286)
Browse files Browse the repository at this point in the history
* ChatAdditions.inc revert df22f3a

* ChatAdditions.inc: seconds values from time.inc
  • Loading branch information
Nord1cWarr1or committed Mar 7, 2023
1 parent df22f3a commit 81c9f03
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions cstrike/addons/amxmodx/scripting/include/ChatAdditions.inc
Expand Up @@ -19,10 +19,6 @@
#define CA_VERSION "%CA_VERSION%"
#endif

#if !defined _time_included
#include <time>
#endif

const CA_MAX_MESSAGE_SIZE = 188

/**
Expand Down Expand Up @@ -66,6 +62,13 @@ new stock const BASE_CHAT_TRIGGERS[][] = { /* "", */"/", "\", "!", "." };


stock parseTime(const value[]) {
const _SECONDS_IN_MINUTE = 60;
const _SECONDS_IN_HOUR = 3600;
const _SECONDS_IN_DAY = 86400;
const _SECONDS_IN_WEEK = 604800;
const _SECONDS_IN_MONTH = 2592000;
const _SECONDS_IN_YEAR = 31536000;

new t, k;
for (new i; value[i] != EOS; i++) {
switch (value[i]) {
Expand All @@ -74,32 +77,32 @@ stock parseTime(const value[]) {
}

case 'i': {
k += t * SECONDS_IN_MINUTE;
k += t * _SECONDS_IN_MINUTE;
t = 0;
}

case 'h': {
k += t * SECONDS_IN_HOUR;
k += t * _SECONDS_IN_HOUR;
t = 0;
}

case 'd': {
k += t * SECONDS_IN_DAY;
k += t * _SECONDS_IN_DAY;
t = 0;
}

case 'w': {
k += t * SECONDS_IN_WEEK;
k += t * _SECONDS_IN_WEEK;
t = 0;
}

case 'm': {
k += t * SECONDS_IN_MONTH;
k += t * _SECONDS_IN_MONTH;
t = 0;
}

case 'y': {
k += t * SECONDS_IN_YEAR;
k += t * _SECONDS_IN_YEAR;
t = 0;
}

Expand Down

0 comments on commit 81c9f03

Please sign in to comment.