mirror of
https://github.com/rehlds/reapi.git
synced 2025-02-06 18:42:19 +03:00
rg_round_end: Add option trigger to all hooks
This commit is contained in:
parent
c649b89f85
commit
f85b12ea75
@ -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 event The event is the end of the round
|
||||||
* @param message The message on round end
|
* @param message The message on round end
|
||||||
* @param sentence The sound at the end of the round
|
* @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.
|
* Updates current scores.
|
||||||
|
@ -61,6 +61,9 @@
|
|||||||
<Filter Include="common">
|
<Filter Include="common">
|
||||||
<UniqueIdentifier>{8232a3e7-911f-4ee1-8223-03ac077d7bee}</UniqueIdentifier>
|
<UniqueIdentifier>{8232a3e7-911f-4ee1-8223-03ac077d7bee}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="include\cssdk\dlls\API">
|
||||||
|
<UniqueIdentifier>{7bbc2807-1f04-4c73-a99c-e7955f9bda90}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\include\metamod\dllapi.h">
|
<ClInclude Include="..\include\metamod\dllapi.h">
|
||||||
@ -702,6 +705,21 @@
|
|||||||
<ClInclude Include="..\src\amx_hook.h">
|
<ClInclude Include="..\src\amx_hook.h">
|
||||||
<Filter>src</Filter>
|
<Filter>src</Filter>
|
||||||
</ClInclude>
|
</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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\include\cssdk\common\parsemsg.cpp">
|
<ClCompile Include="..\include\cssdk\common\parsemsg.cpp">
|
||||||
|
@ -408,13 +408,15 @@ struct {
|
|||||||
* @param event The event is the end of the round
|
* @param event The event is the end of the round
|
||||||
* @param message The message on round end
|
* @param message The message on round end
|
||||||
* @param sentence The sound at the end of the round
|
* @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
|
* @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)
|
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();
|
CHECK_GAMERULES();
|
||||||
|
|
||||||
@ -448,8 +450,24 @@ cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params)
|
|||||||
Broadcast(sentence);
|
Broadcast(sentence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()->EndRoundMessage(message, event);
|
||||||
CSGameRules()->TerminateRound(CAmxArg(amx, params[arg_delay]), winstatus);
|
CSGameRules()->TerminateRound(tmDelay, winstatus);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user