Skip to content

Commit 5fa7a83

Browse files
committed
Fix startPercent handling in rg_send_bartime2 native
1 parent 18660b5 commit 5fa7a83

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

reapi/src/natives/natives_misc.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,16 +2076,18 @@ cell AMX_NATIVE_CALL rg_send_bartime2(AMX *amx, cell *params)
20762076
CHECK_CONNECTED(pPlayer, arg_index);
20772077

20782078
CAmxArgs args(amx, params);
2079+
int duration = args[arg_time];
20792080
float startPercent = args[arg_start_percent];
20802081
if (!args[arg_observer]) {
20812082
EMESSAGE_BEGIN(MSG_ONE_UNRELIABLE, gmsgBarTime2, nullptr, pPlayer->edict());
2082-
EWRITE_SHORT(args[arg_time]);
2083+
EWRITE_SHORT(duration);
20832084
EWRITE_SHORT(startPercent);
20842085
EMESSAGE_END();
20852086
return TRUE;
20862087
}
20872088

2088-
pPlayer->CSPlayer()->SetProgressBarTime2(args[arg_time], startPercent);
2089+
float timeElapsed = (startPercent / 100.0f) * duration;
2090+
pPlayer->CSPlayer()->SetProgressBarTime2(duration, timeElapsed);
20892091
return TRUE;
20902092
}
20912093

0 commit comments

Comments
 (0)