Behind Enemy Lines :: View topic - Ultra Stats Manual

Main  •  FAQ  •  Search  •  User Groups  •  Profile  •  Members List  •  Private Messages
Arcade  •  Attachments  •  Buddy List  •  Ranks  •  Rules  •  Smilies List  •  Statistics  •  Staff

Ultra Stats Manual

 
Post new topic   Reply to topic    Behind Enemy Lines Forum Index -> UltraStats Printable Version
View previous topic :: View next topic  
Author Message
MrDudes
Private
Private


Joined: Dec 03, 2009
Posts: 61


Items

Status: Offline

PostPosted: Fri Mar 05, 2010 1:10 pm    Post subject: Ultra Stats Manual Reply with quote

I decided to write this little tutorial to help other people with their ultrastats. This tutorial is based on
CoD5, but you might be able to use this also for CoD4.
First thing you need to do is tell the game server to start logging the information for the ultra stats.
to do this you have to change the server.cfg file and add the following information.

Quote:

//Gamestats
set logfile "1" // 0 = NO log, 1 = log file enabled
set g_logsync "2" // 0=no log, 1=buffered, 2=continuous, 3=append
set g_log "games_stats.log" // Name of log file.
set sv_log_damage "1" // Enables damage logging.


This will create a games_stats.log file in the main folder of the game server.
This is the file we need to parse the information in the Ultra Stats.

Next we need a website that will support MySQL and PHP.
On the CoD5 disk there is a folder with Ultra Stats. Upload this to the website and run the install.
Now you have the basic install for the Ultra Stats done.
If you look at the folder structure you will see a folder called "gamelogs". This is the folder that we have to put our games.stats.log file for parsing.

You need to setup a server in the server administration.
Once you parse the games_stats.log file you will see the basic statistics and the basic medals that come with the Ultra Stats.

To activate the anti medals we have to uncomment the following lines.
First find the file "functions_parser-medals.php" file in the include folder.

Now find the following line.

Quote:

*** ANTI MEDAL CODE REMOVED BY REQUEST ***


Now remove the "/*" in front of the line and find the "*/" down below and remove that one too.

Now when you parse the games_stat.log file you will see the standard medals and the anti medals.

If everything went okay, than you should have the basic installation done and it should be showing the basic medals. Now you can start creating new medals and changing the existing medals.

To create a new medal or change an existing medal you need a program like PhotoShop or othe graphics program that you can create your own medals. You need to save the new medal as a PNG file and it needs to have the filename that referres to the name in the code.
Example: the code to create a medal for the most kills is :

Code:

   // --- PRO MEDALS
   $content['medals']['medal_pro_killer']['DisplayName'] = "Killer";
   $content['medals']['medal_pro_killer']['GroupedPlayerID'] = "PLAYERID";
   $content['medals']['medal_pro_killer']['sql'] = "SELECT " .
            STATS_PLAYER_KILLS . ".PLAYERID, " .
            " sum(" . STATS_PLAYER_KILLS . ".Kills) as AllKills" .
            " FROM " . STATS_PLAYER_KILLS .
            " INNER JOIN (" . STATS_ROUNDS .
            ") ON (" .
            STATS_PLAYER_KILLS . ".ROUNDID=" . STATS_ROUNDS . ".ID " .
            ")" .
            " WHERE 1=1 " .
            GetCustomServerWhereQuery(STATS_PLAYER_KILLS, false, false, $serverid) .
            GetBannedPlayerWhereQuery(STATS_PLAYER_KILLS, "PLAYERID", false) .
            $szTimeFilter .
            " GROUP BY " . STATS_PLAYER_KILLS . ".PLAYERID " .
            " ORDER BY AllKills";


The name of your medal should be medal_pro_killer.png
Then you need to place this medal in the folder "images/medals/normal".

Now to create the new medals.
We are going to be using the file "functions_parser-medals.php" which is located in the include folder.
Open the file with a text editor.

When we create a new medal we have two parts of code that we have to deal with. First I will start
with an example code.

Code:

   // MOST BAYONET KILLS MEDAL
   $content['medals']['medal_pro_bayonet'['DisplayName'] = "Bayonet";
   $content['medals']['medal_pro_bayonet']['GroupedPlayerID'] = "PLAYERID";
   $content['medals']['medal_pro_bayonet']['sql'] = "SELECT " .
               STATS_PLAYER_KILLS . ".PLAYERID, " .
               " sum(" . STATS_PLAYER_KILLS . ".Kills) as AllKills" .
               " FROM " . STATS_PLAYER_KILLS .
               " INNER JOIN (" . STATS_WEAPONS . ", " . STATS_ROUNDS .
               ") ON (" .
               STATS_WEAPONS . ".ID=" . STATS_PLAYER_KILLS . ".WEAPONID AND " .
               STATS_PLAYER_KILLS . ".ROUNDID=" . STATS_ROUNDS . ".ID " .
               ") " .
               " WHERE " . STATS_WEAPONS . ".INGAMENAME IN ('springfield_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('type99rifle_bayonet_mp') ". " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('mosinrifle_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('kar98k_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('m1garand_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('m1carbine_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('shotgun_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('type99lmg_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               GetCustomServerWhereQuery(STATS_PLAYER_KILLS, false, false, $serverid) .
               GetBannedPlayerWhereQuery(STATS_PLAYER_KILLS, "PLAYERID", false) .
               $szTimeFilter .
               " GROUP BY " . STATS_PLAYER_KILLS . ".PLAYERID " .
               " ORDER BY AllKills";


The first part we have to look at is the name of this medal. In this case "medal_pro_bayonet".
This has to be a unique name. Then where it sats Displayname, we fillout a name for the medal.

Now as you can see this medal is for Bayonet kills. So what we need to know is when is a kill registrered as a bayonet kill.
In the databases for Ultra Stats we have two tables with information for our medals.
The first table is "stats_weapons" which will lists the weapons and "stats_damagetypes" which will list the damagetypes.

Now for our medal we just want the kills with a bayonet. But a bayonet is attached to certain weapons. Who do we know whether a person is killed with the bayonet or a bullet?

Well first we need to know which weapons can have the bayonet attachment. This information is located in the "stats_weapons" table and I will post a File with all weapons and attachments in the downloads area on this site.
Then we need to know the damage type. there are several damagetype and the one we need is "MOD_BAYONET".

The first weapon that I found was the Springfield and the code for the springfield with bayonet is
"springfield_bayonet_mp".
Our query will ask for the Springfield with a bayonet, but we still dont know if he used the bayonet or shot another player. To find this we add the damage type "MOD_BAYONET". In my case it's record number 14.

So now it will filter and look for all kills with a Springfield with a bayonet and the damagetype (Actullay used the bayonet) "MOD_BAYONET".

So our first piece of code is:
Code:

" WHERE " . STATS_WEAPONS . ".INGAMENAME IN ('springfield_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) "


Now we have to look for all weapons with the bayonet attachment and damage type "MOD_BAYONET" (14).

We end up with the following code.
Code:

   // MOST BAYONET KILLS MEDAL
   $content['medals']['medal_pro_bayonet']['DisplayName'] = "Bayonet";
   $content['medals']['medal_pro_bayonet']['GroupedPlayerID'] = "PLAYERID";
   $content['medals']['medal_pro_bayonet']['sql'] = "SELECT " .
               STATS_PLAYER_KILLS . ".PLAYERID, " .
               " sum(" . STATS_PLAYER_KILLS . ".Kills) as AllKills" .
               " FROM " . STATS_PLAYER_KILLS .
               " INNER JOIN (" . STATS_WEAPONS . ", " . STATS_ROUNDS .
               ") ON (" .
               STATS_WEAPONS . ".ID=" . STATS_PLAYER_KILLS . ".WEAPONID AND " .
               STATS_PLAYER_KILLS . ".ROUNDID=" . STATS_ROUNDS . ".ID " .
               ") " .
               " WHERE " . STATS_WEAPONS . ".INGAMENAME IN ('springfield_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('type99rifle_bayonet_mp') ". " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('mosinrifle_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('kar98k_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('m1garand_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('m1carbine_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('shotgun_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               " OR " . STATS_WEAPONS . ".INGAMENAME IN ('type99lmg_bayonet_mp') " . " AND " . STATS_PLAYER_KILLS . ".DAMAGETYPEID IN (14) " .
               GetCustomServerWhereQuery(STATS_PLAYER_KILLS, false, false, $serverid) .
               GetBannedPlayerWhereQuery(STATS_PLAYER_KILLS, "PLAYERID", false) .
               $szTimeFilter .
               " GROUP BY " . STATS_PLAYER_KILLS . ".PLAYERID " .
               " ORDER BY AllKills";


Now the first part is done. We gave our criteria for filtering out all weapons with a bayonet and actual bayonet kills.

Now we have to add another piece in the code that will generate the medal.

We need to scroll down untill we find the "// --- Calc: medal_pro_killer".
This is where the medal calculation code starts.
Each medal has it's own piece of code to create the medal.
Now we need to scroll down untill we find the last one and we need to code the following code below it.

Code:

      // --- Calc: medal_pro_bayonet
      if ( $content["medal_pro_bayonet"] == "yes" )
      {
         $sqlquery =   $content['medals']['medal_pro_bayonet']['sql'] . " DESC LIMIT 1";
         PrintHTMLDebugInfo( DEBUG_ULTRADEBUG, "Medal", "medal_pro_bayonet: " . $sqlquery );

         $topplayer = ReturnMedalValue($sqlquery);
         if ( isset($topplayer['PLAYERID']) && $topplayer['AllKills'] > 0 )
            InsertOrUpdateMedalValue(   "medal_pro_bayonet",
                                 $content['medals']['medal_pro_bayonet']['DisplayName'],
                                 $serverid,
                                 "medal_pro_bayonet",
                                 $topplayer['AllKills'],
                                 "Kills",
                                 $topplayer['PLAYERID'],
                                 4 );
         else
            PrintHTMLDebugInfo( DEBUG_INFO, "Medal", "medal_pro_bayonet is empty!" );
      }


Now you can see we still use the "medal_pro_bayonet" like we did with our query. You have to make sure you keep the name "medal_pro_bayonet" the same with the first piece of code.

Then another important part is the "4". You have to look add the medal creation code before this one and make this one 1 higher. In my case the previous medal creation code was 3, that's why this one has to be 4.

Once you have done this you are ready to parse your games_stats.log file and you new medal should show up.
Now what probably is going to happen is that there is no description for your medal.
To change this login as admin in to the ultra stats and go to string editor.
Now we need to add a new string and the string is called "medal_pro_bayonet".
Then fill out a description (This description will show underneath your medal) and you are done.

I hope this will help people to create their own medals and stats and have fun showing them of



Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Behind Enemy Lines Forum Index -> UltraStats All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Announcement: Website Changes 0 MrDudes 97 Sat Feb 27, 2010 10:24 pm
MrDudes View latest post
No new posts Sticky: BANNED 0 Administrator 104 Sun Dec 06, 2009 11:26 am
Administrator View latest post
No new posts Hello everyone 18 Mad-mac 745 Sun Feb 28, 2010 11:07 am
MrsGeneral View latest post
 


Powered by phpBB © 2001, 2005 phpBB Group :: Aviator Theme By Heefy ::

All times are GMT - 5 Hours
Forums ©
1:  DataBase Entries for Weapons 2
2:  CoD5 Profile backup Tool  13
3:  Map pack 4 5
4:  Map pack 3 5
5:  CoD5 Map Pack 2 5
6:  CoD5 Map Pack 1 10