Permalink
Browse files

Add TTT_OnRulesMenu and TTT_OnDetectiveMenu

Close #308
  • Loading branch information...
Bara committed May 19, 2018
1 parent 0981059 commit ff1e3f5387cdfa3a5763d596081029025ae81eca
@@ -112,6 +112,24 @@ forward Action TTT_OnClientDeathPre(int victim, int attacker);
*/
forward void TTT_OnBodyFound(int client, int victim, const char[] deadPlayer, bool silentID);
/*
* Called before we create rules menu.
* If want to change it use "return Plugin_Changed;"
*
* @param client The client index.
* @param show True - Menu will be opened, False - Menu will not open
*/
forward Action TTT_OnRulesMenu(int client, bool &show);
/*
* Called before we create detectives menu.
* If want to change it use "return Plugin_Changed;"
*
* @param client The client index.
* @param show True - Menu will be opened, False - Menu will not open
*/
forward Action TTT_OnDetectiveMenu(int client, bool &show);
/*
* Called when a body is scanned (by a Detective - not really? (Line 2761-2765 ttt.sp) -).
*
@@ -110,6 +110,8 @@ Handle g_hOnButtonRelease = null;
Handle g_hOnModelUpdate = null;
Handle g_hOnPlayerDeathPre = null;
Handle g_hOnKarmaUpdate = null;
Handle g_hOnRulesMenu = null;
Handle g_hOnDetectiveMenu = null;
bool g_bSourcebans = false;
@@ -14,6 +14,8 @@ void InitForwards()
g_hOnModelUpdate = CreateGlobalForward("TTT_OnModelUpdate", ET_Ignore, Param_Cell, Param_String);
g_hOnPlayerDeathPre = CreateGlobalForward("TTT_OnPlayerDeath", ET_Event, Param_Cell, Param_Cell);
g_hOnKarmaUpdate = CreateGlobalForward("TTT_OnKarmaUpdate", ET_Ignore, Param_Cell, Param_Cell, Param_Cell);
g_hOnRulesMenu = CreateGlobalForward("TTT_OnRulesMenu", ET_Event, Param_Cell, Param_Cell);
g_hOnDetectiveMenu = CreateGlobalForward("TTT_OnDetectiveMenu", ET_Event, Param_Cell, Param_Cell);
}
void InitNatives()
@@ -2134,6 +2134,18 @@ stock void ShowRules(int client, int iItem)
{
return;
}
bool bShow = true;
Action res = Plugin_Continue;
Call_StartForward(g_hOnRulesMenu);
Call_PushCell(client);
Call_PushCellRef(bShow);
Call_Finish(res);
if (res == Plugin_Changed && !bShow)
{
return;
}
char sText[512], sYes[64];
Format(sText, sizeof(sText), "%T", "Welcome Menu", client, client, TTT_PLUGIN_AUTHOR);
@@ -2390,6 +2402,18 @@ stock void AskClientForMicrophone(int client)
{
return;
}
bool bShow = true;
Action res = Plugin_Continue;
Call_StartForward(g_hOnDetectiveMenu);
Call_PushCell(client);
Call_PushCellRef(bShow);
Call_Finish(res);
if (res == Plugin_Changed && !bShow)
{
return;
}
char sText[512], sYes[64], sNo[64];
Format(sText, sizeof(sText), "%T", "AM Question", client);

0 comments on commit ff1e3f5

Please sign in to comment.