@@ -108,16 +108,6 @@ enum _:COUNTERS
108
108
COUNTER_SP,
109
109
}
110
110
111
- enum _: STATS
112
- {
113
- STATS_ID[32 ],
114
- STATS_NAME[32 ],
115
- STATS_CP,
116
- STATS_TP,
117
- Float: STATS_TIME, // Timer value
118
- STATS_TIMESTAMP, // Date
119
- }
120
-
121
111
enum BUTTON_TYPE
122
112
{
123
113
BUTTON_START,
@@ -225,14 +215,13 @@ new g_FwLightStyle;
225
215
new pcvar_sv_ag_match_running;
226
216
227
217
new mfwd_hlkz_cheating;
218
+ new mfwd_hlkz_worldrecord;
228
219
229
220
new Array: g_ArrayStatsNub;
230
221
new Array: g_ArrayStatsPro;
231
222
new Array: g_ArrayStatsPure;
232
223
233
224
234
-
235
-
236
225
public plugin_precache ()
237
226
{
238
227
g_FwLightStyle = register_forward (FM_LightStyle, " Fw_FmLightStyle" );
@@ -337,7 +326,8 @@ public plugin_init()
337
326
register_touch (" trigger_push" , " player" , " Fw_FmPlayerTouchPush" );
338
327
register_touch (" trigger_multiple" , " player" , " Fw_FmPlayerTouchHealthBooster" );
339
328
340
- mfwd_hlkz_cheating = CreateMultiForward ( " hlkz_cheating" , ET_IGNORE, FP_CELL );
329
+ mfwd_hlkz_cheating = CreateMultiForward (" hlkz_cheating" , ET_IGNORE, FP_CELL);
330
+ mfwd_hlkz_worldrecord = CreateMultiForward (" hlkz_worldrecord" , ET_IGNORE, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL);
341
331
342
332
register_message (get_user_msgid (" Health" ), " Fw_MsgHealth" );
343
333
register_message (SVC_TEMPENTITY, " Fw_MsgTempEntity" );
@@ -1685,10 +1675,10 @@ FinishTimer(id)
1685
1675
{
1686
1676
if (get_bit (g_baIsPureRunning, id))
1687
1677
{
1688
- log_amx (" ----- Checking records after Pure Run end ------" );
1689
- log_amx (" Checking Pure top... " );
1678
+ // log_amx(" ----- Checking records after Pure Run end ------");
1679
+ // log_amx("Checking Pure top... ");
1690
1680
UpdateRecords (id, kztime, g_szTops[0 ]);
1691
- log_amx (" Checking Pro top... " );
1681
+ // log_amx("Checking Pro top... ");
1692
1682
UpdateRecords (id, kztime, g_szTops[1 ]);
1693
1683
}
1694
1684
else
@@ -2865,7 +2855,7 @@ LoadRecords(szTopType[])
2865
2855
2866
2856
new data[1024 ], stats[STATS], uniqueid[32 ], name[32 ], cp[24 ], tp[24 ];
2867
2857
new kztime[24 ], timestamp[24 ];
2868
- // new current_time = get_systime();
2858
+
2869
2859
new Array: arr;
2870
2860
if (equali (szTopType, g_szTops[0 ]))
2871
2861
arr = g_ArrayStatsPure;
@@ -2886,21 +2876,13 @@ LoadRecords(szTopType[])
2886
2876
2887
2877
stats[STATS_TIMESTAMP] = str_to_num (timestamp);
2888
2878
2889
- /*
2890
- // Stale old records that are below specified amount, otherwise we use them to inform player about better/worse time and position
2891
- if (current_time - stats[STATS_TIMESTAMP] > staleStatTime &&
2892
- i > keepStatPlayers)
2893
- continue;
2894
- */
2895
-
2896
2879
copy (stats[STATS_ID], charsmax (stats[STATS_ID]), uniqueid);
2897
2880
copy (stats[STATS_NAME], charsmax (stats[STATS_NAME]), name);
2898
2881
stats[STATS_CP] = str_to_num (cp);
2899
2882
stats[STATS_TP] = str_to_num (tp);
2900
2883
stats[STATS_TIME] = _: str_to_float (kztime);
2901
2884
2902
2885
ArrayPushArray (arr, stats);
2903
- // i++;
2904
2886
}
2905
2887
2906
2888
fclose (file);
@@ -2952,51 +2934,65 @@ UpdateRecords(id, Float:kztime, szTopType[])
2952
2934
new minutes, Float: seconds, Float: slower, Float: faster;
2953
2935
LoadRecords (szTopType);
2954
2936
2955
- new Array: arr;
2937
+ new Array: arr, type ;
2956
2938
if (equali (szTopType, g_szTops[0 ]))
2939
+ {
2957
2940
arr = g_ArrayStatsPure;
2941
+ type = 0 ;
2942
+ }
2958
2943
else if (equali (szTopType, g_szTops[1 ]))
2944
+ {
2959
2945
arr = g_ArrayStatsPro;
2946
+ type = 1 ;
2947
+ }
2960
2948
else
2949
+ {
2961
2950
arr = g_ArrayStatsNub;
2951
+ type = 2 ;
2952
+ }
2962
2953
2963
2954
GetUserUniqueId (id, uniqueid, charsmax (uniqueid));
2964
2955
GetColorlessName (id, name, charsmax (name));
2965
2956
2966
- new result, bool: skipResult = false ;
2957
+ new result;
2967
2958
2968
- log_amx (" uniqueid = %s , name = %s " , uniqueid, name);
2959
+ // log_amx("uniqueid = %s, name = %s", uniqueid, name);
2969
2960
2970
- log_amx (" -- Entering records loop. Array size: %d " , ArraySize (arr));
2961
+ // log_amx("-- Entering records loop. Array size: %d", ArraySize(arr));
2971
2962
for (new i = 0 ; i < ArraySize (arr); i++ )
2972
2963
{
2973
2964
ArrayGetArray (arr, i, stats);
2974
2965
result = floatcmp (kztime, stats[STATS_TIME]);
2975
- log_amx (" comparing current run's time (%.2f ) to best #%d time (%.2f ); result = %d " , kztime, i+ 1 , stats[STATS_TIME], result);
2966
+ // log_amx("comparing current run's time (%.2f) to best #%d time (%.2f); result = %d", kztime, i+1, stats[STATS_TIME], result);
2976
2967
2977
2968
if (result == - 1 && insertItemId == - 1 )
2978
2969
{
2979
2970
insertItemId = i;
2980
- log_amx (" insertItemId = %d " , insertItemId);
2971
+ // log_amx("insertItemId = %d", insertItemId);
2981
2972
}
2982
2973
2983
- log_amx (" comparing %s to current runner ID (%s )" , stats[STATS_ID], uniqueid);
2974
+ // log_amx("comparing %s to current runner ID (%s)", stats[STATS_ID], uniqueid);
2984
2975
if (! equal (stats[STATS_ID], uniqueid))
2985
2976
{
2986
- log_amx (" not equal, continue finding the current runner's position..." );
2977
+ // log_amx("not equal, continue finding the current runner's position...");
2987
2978
continue ;
2988
2979
}
2989
- log_amx (" equal, this is the record that we want to check..." );
2980
+ // log_amx("equal, this is the record that we want to check...");
2990
2981
2991
2982
if (result != - 1 )
2992
2983
{
2993
2984
slower = kztime - stats[STATS_TIME];
2994
2985
minutes = floatround (slower, floatround_floor) / 60 ;
2995
2986
seconds = slower - (60 * minutes);
2996
- client_print (id, print_chat, GetVariableDecimalMessage (id, " [%s ] You failed your %s time by %02d :% " ),
2997
- PLUGIN_TAG, szTopType, minutes, seconds);
2987
+ if (get_bit (g_baIsPureRunning, id))
2988
+ {
2989
+ client_print (id, print_chat, GetVariableDecimalMessage (id, " [%s ] You failed your %s time by %02d :% " ),
2990
+ PLUGIN_TAG, szTopType, minutes, seconds);
2991
+ }
2992
+ /*
2998
2993
log_amx(GetVariableDecimalMessage(id, "%s failed their %s time by %02d:%", ", nothing to update here!"),
2999
2994
name, szTopType, minutes, seconds);
2995
+ */
3000
2996
3001
2997
return ;
3002
2998
}
@@ -3006,20 +3002,22 @@ UpdateRecords(id, Float:kztime, szTopType[])
3006
3002
seconds = faster - (60 * minutes);
3007
3003
client_print (id, print_chat, GetVariableDecimalMessage (id, " [%s ] You improved your %s time by %02d :% " ),
3008
3004
PLUGIN_TAG, szTopType, minutes, seconds);
3005
+ /*
3009
3006
log_amx(GetVariableDecimalMessage(id, "%s improved their %s time by %02d:%"),
3010
3007
name, szTopType, minutes, seconds);
3008
+ */
3011
3009
3012
3010
deleteItemId = i;
3013
- log_amx (" deleteItemId = %d " , deleteItemId);
3011
+ // log_amx("deleteItemId = %d", deleteItemId);
3014
3012
3015
3013
break ;
3016
3014
}
3017
- log_amx (" -- Records loop finished. State of variables:" );
3018
- log_amx (" uniqueid = %s , name = %s " , uniqueid, name);
3019
- log_amx (" current run's time = %.2f " , kztime);
3020
- log_amx (" result = %d " , result);
3021
- log_amx (" insertItemId = %d " , insertItemId);
3022
- log_amx (" deleteItemId = %d " , deleteItemId);
3015
+ // log_amx("-- Records loop finished. State of variables:");
3016
+ // log_amx("uniqueid = %s, name = %s", uniqueid, name);
3017
+ // log_amx("current run's time = %.2f", kztime);
3018
+ // log_amx("result = %d", result);
3019
+ // log_amx("insertItemId = %d", insertItemId);
3020
+ // log_amx("deleteItemId = %d", deleteItemId);
3023
3021
3024
3022
copy (stats[STATS_ID], charsmax (stats[STATS_ID]), uniqueid);
3025
3023
copy (stats[STATS_NAME], charsmax (stats[STATS_NAME]), name);
@@ -3043,7 +3041,7 @@ UpdateRecords(id, Float:kztime, szTopType[])
3043
3041
ArrayDeleteItem (arr, insertItemId != - 1 ? deleteItemId + 1 : deleteItemId);
3044
3042
3045
3043
rank++ ;
3046
- log_amx (" checking rank... rank = %d " , rank);
3044
+ // log_amx("checking rank... rank = %d", rank);
3047
3045
if (rank <= get_pcvar_num (pcvar_kz_top_records))
3048
3046
{
3049
3047
client_cmd (0 , " spk woop" );
@@ -3054,6 +3052,12 @@ UpdateRecords(id, Float:kztime, szTopType[])
3054
3052
3055
3053
SaveRecords (szTopType);
3056
3054
3055
+ if (rank == 1 )
3056
+ {
3057
+ new ret;
3058
+ // new iArrayPass = PrepareArray(arr, ArraySize(arr));
3059
+ ExecuteForward (mfwd_hlkz_worldrecord, ret, id, kztime, type, arr);
3060
+ }
3057
3061
}
3058
3062
3059
3063
ShowTopClimbers (id, szTopType[])
0 commit comments