2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-30 15:37:56 +03:00

rg_round_end: Add option trigger to all hooks

This commit is contained in:
s1lent 2018-05-22 16:26:14 +07:00
parent c649b89f85
commit f85b12ea75
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
3 changed files with 44 additions and 6 deletions

View File

@ -348,10 +348,12 @@ native Float:[3] rg_fire_bullets3(const inflictor, const attacker, Float:vecSrc[
* @param event The event is the end of the round
* @param message The message on round end
* @param sentence The sound at the end of the round
* @param trigger This will trigger to all hooks on that function
* Be very careful about recursion!
*
* @noreturn
* @return 1 on success, 0 otherwise
*/
native rg_round_end(const Float:tmDelay, const WinStatus:st, const ScenarioEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default");
native rg_round_end(const Float:tmDelay, const WinStatus:st, const ScenarioEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default", const bool:trigger = false);
/*
* Updates current scores.

View File

@ -61,6 +61,9 @@
<Filter Include="common">
<UniqueIdentifier>{8232a3e7-911f-4ee1-8223-03ac077d7bee}</UniqueIdentifier>
</Filter>
<Filter Include="include\cssdk\dlls\API">
<UniqueIdentifier>{7bbc2807-1f04-4c73-a99c-e7955f9bda90}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\metamod\dllapi.h">
@ -702,6 +705,21 @@
<ClInclude Include="..\src\amx_hook.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\include\cssdk\dlls\API\CSEntity.h">
<Filter>include\cssdk\dlls\API</Filter>
</ClInclude>
<ClInclude Include="..\include\cssdk\dlls\API\CSInterfaces.h">
<Filter>include\cssdk\dlls\API</Filter>
</ClInclude>
<ClInclude Include="..\include\cssdk\dlls\API\CSPlayer.h">
<Filter>include\cssdk\dlls\API</Filter>
</ClInclude>
<ClInclude Include="..\include\cssdk\dlls\API\CSPlayerItem.h">
<Filter>include\cssdk\dlls\API</Filter>
</ClInclude>
<ClInclude Include="..\include\cssdk\dlls\API\CSPlayerWeapon.h">
<Filter>include\cssdk\dlls\API</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\include\cssdk\common\parsemsg.cpp">

View File

@ -408,13 +408,15 @@ struct {
* @param event The event is the end of the round
* @param message The message on round end
* @param sentence The sound at the end of the round
* @param trigger This will trigger to all hooks on that function
* Be very careful about recursion!
*
* @noreturn
* native rg_round_end(const Float:tmDelay, const WinStatus:st, const ScenarioEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default");
* native rg_round_end(const Float:tmDelay, const WinStatus:st, const ScenarioEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default", const bool:trigger = false);
*/
cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_delay, arg_win, arg_event, arg_message, arg_sentence, arg_silent };
enum args_e { arg_count, arg_delay, arg_win, arg_event, arg_message, arg_sentence, arg_trigger };
CHECK_GAMERULES();
@ -448,8 +450,24 @@ cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params)
Broadcast(sentence);
}
CSGameRules()->EndRoundMessage(message, event);
CSGameRules()->TerminateRound(CAmxArg(amx, params[arg_delay]), winstatus);
float tmDelay = CAmxArg(amx, params[arg_delay]);
if (params[arg_trigger] != 0)
{
return callForward<BOOL>(RG_RoundEnd,
[&message](int _winStatus, ScenarioEventEndRound _event, float _tmDelay)
{
CSGameRules()->EndRoundMessage(message, _event);
CSGameRules()->TerminateRound(_tmDelay, _winStatus);
return TRUE;
},
winstatus, event, tmDelay);
}
else
{
CSGameRules()->EndRoundMessage(message, event);
CSGameRules()->TerminateRound(tmDelay, winstatus);
}
return TRUE;
}