mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 18:38:26 +00:00
Add Shavit_OnWRDeleted
This commit is contained in:
parent
c0f6883ca5
commit
3286ddcd1d
@ -149,6 +149,7 @@ Rankings **(NEW!)**
|
|||||||
- [x] Recalculate points for every record on the current map when a ROOT admin changes the point value for it. (retroactive!)
|
- [x] Recalculate points for every record on the current map when a ROOT admin changes the point value for it. (retroactive!)
|
||||||
- [x] Add natives. `float Shavit_GetPoints(int client)` `int Shavit_GetRank(int client)` `void Shavit_GetMapValues(float &points, float &idealtime)`
|
- [x] Add natives. `float Shavit_GetPoints(int client)` `int Shavit_GetRank(int client)` `void Shavit_GetMapValues(float &points, float &idealtime)`
|
||||||
- [ ] Add native that checks the total amount of players with over 0 points.
|
- [ ] Add native that checks the total amount of players with over 0 points.
|
||||||
|
- [ ] Remove deleted records from `playerpoints`.
|
||||||
|
|
||||||
Web Interface
|
Web Interface
|
||||||
--
|
--
|
||||||
|
|||||||
@ -374,6 +374,15 @@ forward void Shavit_OnFinish_Post(int client, BhopStyle style, float time, int j
|
|||||||
*/
|
*/
|
||||||
forward void Shavit_OnWorldRecord(int client, BhopStyle style, float time, int jumps);
|
forward void Shavit_OnWorldRecord(int client, BhopStyle style, float time, int jumps);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an admin deletes a WR.
|
||||||
|
*
|
||||||
|
* @param style Style the record was done on.
|
||||||
|
* @param id Record ID. -1 if mass deletion.
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
forward void Shavit_OnWRDeleted(BhopStyle style, int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player's timer paused.
|
* Called when a player's timer paused.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -39,6 +39,7 @@ bool gB_Rankings = false;
|
|||||||
// forwards
|
// forwards
|
||||||
Handle gH_OnWorldRecord = null;
|
Handle gH_OnWorldRecord = null;
|
||||||
Handle gH_OnFinish_Post = null;
|
Handle gH_OnFinish_Post = null;
|
||||||
|
Handle gH_OnWRDeleted = null;
|
||||||
|
|
||||||
// database handle
|
// database handle
|
||||||
Database gH_SQL = null;
|
Database gH_SQL = null;
|
||||||
@ -114,6 +115,7 @@ public void OnPluginStart()
|
|||||||
// forwards
|
// forwards
|
||||||
gH_OnWorldRecord = CreateGlobalForward("Shavit_OnWorldRecord", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
gH_OnWorldRecord = CreateGlobalForward("Shavit_OnWorldRecord", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
||||||
gH_OnFinish_Post = CreateGlobalForward("Shavit_OnFinish_Post", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
gH_OnFinish_Post = CreateGlobalForward("Shavit_OnFinish_Post", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
||||||
|
gH_OnWRDeleted = CreateGlobalForward("Shavit_OnWRDeleted", ET_Event, Param_Cell, Param_Cell);
|
||||||
|
|
||||||
// WR command
|
// WR command
|
||||||
RegConsoleCmd("sm_wr", Command_WorldRecord, "Usage: sm_wr [map]");
|
RegConsoleCmd("sm_wr", Command_WorldRecord, "Usage: sm_wr [map]");
|
||||||
@ -465,6 +467,22 @@ public int MenuHandler_DeleteAll(Menu m, MenuAction action, int param1, int para
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < MAX_STYLES; i++)
|
||||||
|
{
|
||||||
|
if(gI_StyleProperties[i] & STYLE_UNRANKED)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(gF_WRTime[i] != 0.0)
|
||||||
|
{
|
||||||
|
Call_StartForward(gH_OnWRDeleted);
|
||||||
|
Call_PushCell(i);
|
||||||
|
Call_PushCell(-1);
|
||||||
|
Call_Finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char[] sQuery = new char[256];
|
char[] sQuery = new char[256];
|
||||||
FormatEx(sQuery, 256, "DELETE FROM %splayertimes WHERE map = '%s';", gS_MySQLPrefix, gS_Map);
|
FormatEx(sQuery, 256, "DELETE FROM %splayertimes WHERE map = '%s';", gS_MySQLPrefix, gS_Map);
|
||||||
|
|
||||||
@ -621,16 +639,33 @@ public int DeleteConfirm_Handler(Menu m, MenuAction action, int param1, int para
|
|||||||
{
|
{
|
||||||
char[] info = new char[16];
|
char[] info = new char[16];
|
||||||
m.GetItem(param2, info, 16);
|
m.GetItem(param2, info, 16);
|
||||||
|
int iRecordID = StringToInt(info);
|
||||||
|
|
||||||
if(StringToInt(info) == -1)
|
if(iRecordID == -1)
|
||||||
{
|
{
|
||||||
Shavit_PrintToChat(param1, "Aborted deletion.");
|
Shavit_PrintToChat(param1, "Aborted deletion.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < MAX_STYLES; i++)
|
||||||
|
{
|
||||||
|
if(gI_StyleProperties[i] & STYLE_UNRANKED || gI_WRRecordID[i] != iRecordID)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(gF_WRTime[i] != 0.0)
|
||||||
|
{
|
||||||
|
Call_StartForward(gH_OnWRDeleted);
|
||||||
|
Call_PushCell(i);
|
||||||
|
Call_PushCell(iRecordID);
|
||||||
|
Call_Finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char[] sQuery = new char[256];
|
char[] sQuery = new char[256];
|
||||||
FormatEx(sQuery, 256, "DELETE FROM %splayertimes WHERE id = '%s';", gS_MySQLPrefix, info);
|
FormatEx(sQuery, 256, "DELETE FROM %splayertimes WHERE id = %d;", gS_MySQLPrefix, iRecordID);
|
||||||
|
|
||||||
gH_SQL.Query(DeleteConfirm_Callback, sQuery, GetClientSerial(param1), DBPrio_High);
|
gH_SQL.Query(DeleteConfirm_Callback, sQuery, GetClientSerial(param1), DBPrio_High);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user