From 5fa7a8368e31d043760f7ae2abf96e11d3491225 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 7 Apr 2025 00:14:00 +0700 Subject: [PATCH] Fix startPercent handling in rg_send_bartime2 native --- reapi/src/natives/natives_misc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index 3f6a381..ae6cc87 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -2076,16 +2076,18 @@ cell AMX_NATIVE_CALL rg_send_bartime2(AMX *amx, cell *params) CHECK_CONNECTED(pPlayer, arg_index); CAmxArgs args(amx, params); + int duration = args[arg_time]; float startPercent = args[arg_start_percent]; if (!args[arg_observer]) { EMESSAGE_BEGIN(MSG_ONE_UNRELIABLE, gmsgBarTime2, nullptr, pPlayer->edict()); - EWRITE_SHORT(args[arg_time]); + EWRITE_SHORT(duration); EWRITE_SHORT(startPercent); EMESSAGE_END(); return TRUE; } - pPlayer->CSPlayer()->SetProgressBarTime2(args[arg_time], startPercent); + float timeElapsed = (startPercent / 100.0f) * duration; + pPlayer->CSPlayer()->SetProgressBarTime2(duration, timeElapsed); return TRUE; }