!cleantime name stage added 🤷

This commit is contained in:
jenzur 2019-09-05 23:14:56 +02:00
parent 050e9438e6
commit 23a02ceee7

View File

@ -54,6 +54,7 @@ public void OnPluginStart()
RegConsoleCmd("sm_mytime", cmd_timerCheckSelf, "checking your personal time");
RegConsoleCmd("sm_stages", cmd_timerCheckStage, "Checking race stages");
RegConsoleCmd("sm_hidetimer", cmd_hideTimerHUD, "Hides timer HUD");
RegAdminCmd("sm_cleantime", Cmd_timeReset, ADMFLAG_GENERIC);
//hooks
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
//HUD
@ -776,6 +777,28 @@ public int MenuHandler1(Menu menu, MenuAction action, int param1, int param2)
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Cmd_timeReset(int client, int args)
{
if (!IsValidClient(client))
return Plugin_Handled;
if (args != 2)
{
ReplyToCommand(client, "[SM] Usage cleantime <target> <course>");
return Plugin_Handled;
}
char sTarget[65], steam2[64];
GetCmdArg(1, sTarget, sizeof(sTarget));
int targetID = FindTarget(client, sTarget, false);
if(targetID == -1)
return Plugin_Handled;
GetClientAuthId(targetID, AuthId_Steam2, steam2, sizeof(steam2));
GetCmdArg(2, sTarget, sizeof(sTarget));
deleteClientTime(steam2, StringToInt(sTarget));
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action cmd_hideTimerHUD(int client, int args)
{
@ -878,6 +901,24 @@ public Action cmd_timerCheckSelf(int client, int args)
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void deleteClientTime(char[] steam2, int stage)
{
char l_cQuery[g_dLength];
if (stage > 1)
{
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table` SET `%sS%i` = 0.000 WHERE steam_auth = '%s'", g_cMapname, stage, steam2);
}
else
{
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table` SET `%s` = 0.000 WHERE steam_auth = '%s'", g_cMapname, steam2);
SQL_TQuery(g_dDatabase, DummyCallbackSimple, l_cQuery);
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table` SET `%sS1` = 0.000 WHERE steam_auth = '%s'", g_cMapname, steam2);
}
SQL_TQuery(g_dDatabase, DummyCallbackSimple, l_cQuery);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void Checkself(int client)
{
int l_iZoneCount = unloze_zoneCount();