Forum

> > CS2D > Scripts > [need script] toplist
Forums overviewCS2D overview Scripts overviewLog in to reply

English [need script] toplist

4 replies
To the start Previous 1 Next To the start

old [need script] toplist

HaRe
User Off Offline

Quote
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

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.

old Re: [need script] toplist

HaRe
User Off Offline

Quote
Thanks, But i'd like to have an lua script that saves into an text document not an dat document.

old Re: [need script] toplist

EngiN33R
Moderator Off Offline

Quote
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.

old Re: [need script] toplist

HaRe
User Off Offline

Quote
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).
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview