English [need script] toplist

4 replies
Goto Page
To the start Previous 1 Next To the start
02.07.12 12:47:06 am
Up
HaRe
User
Offline Off
I'm making an CS2D toplist with functions that the current one doesn't this toplist is coded in PHP which the other one isn't so to make this work i will need a LUA Script that is saving all kills and deaths in an text file that looks something like this

Code:
1
2
3
4
5
NAME|USGN|2|1
NAME|USGN|9|3
NAME|USGN|1|2

>NAME | USGN | KILLS | DEATHS<


Notice that the order doesn't matter, So if anyone could help i'd be happy to continue this project.

The functions i'm going to add is an admin panel and an main page with the top list. There will also be site side functions so you can change etc icon of page, title of page, change users kills and deaths. There will also be an search function to search after the USGN ID and also getting the rank id.
w0w im so eXotiK
02.07.12 12:51:52 am
Up
Hador
User
Offline Off
go to your Counter-Strike 2D folder and open the file called "serverstats.html".

Should that not be enough, I would advise you to use the file cs2d StatsDecoder (8) .
02.07.12 12:55:12 am
Up
HaRe
User
Offline Off
Thanks, But i'd like to have an lua script that saves into an text document not an dat document.
w0w im so eXotiK
02.07.12 09:45:58 am
Up
EngiN33R
Moderator
Offline Off
Code:
1
2
3
4
5
6
7
8
9
function dumpscores()
     local f=assert(io.open("sys/scores.txt","w"))
     for _,id in pairs(player(0,"table")) do
          f:write(player(id,"name").."|"..player(id,"usgn").."|"..player(id,"score").."|"..player(id,"deaths").."\n")
     end
     f:close()
end

dumpscores()


I think this should work.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
02.07.12 01:46:34 pm
Up
HaRe
User
Offline Off
Awesome thanks, A question does it overwrite the existing USGN, also does it check if the player has an usgn if not it shouldn't save the user.

Edit: Just noticed that it doesn't write the overall score (oldscore+newscore) & (olddeaths+newdeaths).
w0w im so eXotiK
To the start Previous 1 Next To the start