#define WEAPONSTATS_GETINDEX(awep,abot,vwep,vbot) (((vwep) + (awep) * (WEP_LAST - WEP_FIRST + 1) - (WEP_FIRST + WEP_FIRST * (WEP_LAST - WEP_FIRST + 1))) * 4 + (abot) * 2 + (vbot))
-void WeaponStats_Shutdown()
+string WeaponStats_prefix;
+void WeaponStats_ready(entity fh, entity pass, float status)
{
- float i, j, ibot, jbot, idx;
+ float i, j, n, ibot, jbot, idx;
- float fh;
vector v;
string prefix;
- if(weaponstats_buffer < 0)
- return;
- prefix = strcat(autocvar_hostname, "\t", GetGametype(), "_", GetMapname(), "\t");
- if(autocvar_sv_weaponstats_file != "")
+ switch(status)
{
- fh = fopen(autocvar_sv_weaponstats_file, FILE_APPEND);
- if(fh >= 0)
- {
- fputs(fh, "#begin statsfile\n");
- fputs(fh, strcat("#date ", strftime(TRUE, "%a %b %e %H:%M:%S %Z %Y"), "\n"));
- fputs(fh, strcat("#config ", ftos(crc16(FALSE, cvar_purechanges)), "\n"));
- fputs(fh, strcat("#cvar_purechanges ", ftos(cvar_purechanges_count), "\n"));
+ case URL_READY_CANWRITE:
+ prefix = strcat(autocvar_hostname, "\t", GetGametype(), "_", GetMapname(), "\t");
+ url_fputs(fh, "#begin statsfile\n");
+ url_fputs(fh, strcat("#date ", strftime(TRUE, "%a %b %e %H:%M:%S %Z %Y"), "\n"));
- url_fputs(fh, strcat("#config ", ftos(crc16(FALSE, cvar_changes)), "\n"));
++ url_fputs(fh, strcat("#config ", ftos(crc16(FALSE, cvar_purechanges)), "\n"));
++ url_fputs(fh, strcat("#cvar_purechanges ", ftos(cvar_purechanges_count), "\n"));
+ n = tokenizebyseparator(cvar_purechanges, "\n");
+ for(i = 0; i < n; ++i)
- fputs(fh, strcat("#cvar_purechange ", argv(i), "\n"));
++ url_fputs(fh, strcat("#cvar_purechange ", argv(i), "\n"));
for(i = WEP_FIRST; i <= WEP_LAST; ++i) for(ibot = 0; ibot <= 1; ++ibot)
for(j = WEP_FIRST; j <= WEP_LAST; ++j) for(jbot = 0; jbot <= 1; ++jbot)
{