Jump to content

track last five maps played on a server


dodgeitorelse3
Go to solution Solved by scootstah,

Recommended Posts

Hi all,

we have a game tracker that tracks lots of data from several game servers. I want to be able to track the last five maps for these servers but I am not sure how to go about it. If any one has a suggestion or a tutorial for me to look at I would be greatly appreciative. I am not looking for someone to write code for me, I just want to be pointed in the right direction is all. At the moment I have no code for this part.

Link to comment
Share on other sites

we track america's army coop servers. In the tracker it shows the current map ( see trackers at http://chevys-place.game-server.cc/servertracker.php. All the data in the tracker is cached in our database. I want to place a link on each tracker that will show the last 5 maps that have been on each server. I want to do this via an include file but I am not sure how to go about storing a list of maps in database. I wil be using a separate db for this data as it will make it easier for me to keep an eye on all the stuff we have. What I need a point in the right direction is this. Say I created a new database for this and managed to store the first map in there. then the next map that is on tracker wiould look at database and say  hey, there is only one so we will add a second, and so on till there are 5. then how to remove the first and add another at the 5th spot so that I have a valid list of 5 maps in order of being seen on server.

Hope this makes sense. Would this need to be a cron job? As I said I have no code for this yet. I am just looking for input from skilled folks like you to point me in the right direction.

 

I should also say that since the data is cached in database the only time cache is updated is when a user looks at tracker page. So really to keep an accurate count of the last 5 maps would it need to be a cron job?

 

 

Link to comment
Share on other sites

  • Solution

Yeah, you'd probably need a cron job for accurate results. Ping the script once a minute or so, or whatever feels right.

 

As for the database, if you only want to ever have 5 rows then you'd simply need to delete the oldest when inserting a 5th. You can determine the oldest with either a timestamp or by using the lowest auto-incremented ID.

Link to comment
Share on other sites

  • 1 year later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.