Permalink
Browse files

Add TTT_OpenClientRules

Needed (maybe as feature) for #319 and #315 (if we extract rdm manager from core plugin)
  • Loading branch information...
Bara committed May 3, 2018
1 parent 424eab5 commit 26e245f354a768898b3ff17de28f8c38e83ad7ab
@@ -284,6 +284,13 @@ native int TTT_AddRoundSlays(int client, int rounds, bool force);
*/
native int TTT_SetRoundSlays(int client, int rounds, bool force);
/*
* Open rules menu for the client
*
* @param client The client index.
*/
native void TTT_ClientOpenRules(int client);
stock void TTT_GetRoleNameByID(int role, char[] name, int length = ROLE_LENGTH)
{
if (role == TTT_TEAM_INNOCENT)
@@ -37,6 +37,7 @@ void InitNatives()
CreateNative("TTT_AddRoundSlays", Native_AddRoundSlays);
CreateNative("TTT_SetRoundSlays", Native_SetRoundSlays);
CreateNative("TTT_IsPlayerAlive", Native_IsPlayerAlive);
CreateNative("TTT_ClientOpenRules", Native_ClientOpenRules);
}
public int Native_IsRoundActive(Handle plugin, int numParams)
@@ -349,3 +350,16 @@ public int Native_IsPlayerAlive(Handle plugin, int numParams)
{
return g_bAlive[GetNativeCell(1)];
}
public int Native_ClientOpenRules(Handle plugin, int numParams)
{
int client = GetNativeCell(1);
g_bRules[client] = false;
char sBuffer[12];
IntToString(g_bRules[client], sBuffer, sizeof(sBuffer));
SetClientCookie(client, g_hRules, sBuffer);
ShowRules(client, g_iSite[client]);
}
@@ -2093,12 +2093,14 @@ stock void ShowRules(int client, int iItem)
if (!kvRules.ImportFromFile(g_sRulesFile))
{
SetFailState("Can't read %s correctly! (ImportFromFile)", g_sRulesFile);
delete kvRules;
return;
}
if (!kvRules.GotoFirstSubKey())
{
SetFailState("Can't read %s correctly! (GotoFirstSubKey)", g_sRulesFile);
delete kvRules;
return;
}

0 comments on commit 26e245f

Please sign in to comment.