Forum

> > CS2D > General > Creating a txt file of stats.
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Creating a txt file of stats.

15 replies
To the start Previous 1 Next To the start

old Creating a txt file of stats.

Bierbuikje
User Off Offline

Quote
Hello,

Is there a way to save the kills and deaths of each player in the server into a text file? And after it the kill/death ratio.

I mean it like this:

1
2
3
Name -tab- Kills -tab- Deaths -tab- Kills/death ratio
Bierbuikje -tab- 100 -tab- 50 -tab- 2.00
Anymous -tab- 50 -tab- 100 -tab- 0.50

The way to calculate the deathratio is: kills/death=ratio.

Is it even possible to do this?

Thank you very much,

Bierbuikje

old Re: Creating a txt file of stats.

Bierbuikje
User Off Offline

Quote
I see, but that is for USGN users only. Not 'not-registered players' (like me and all my players), we don't have an account. Is it possbile to make it for every player? Not USGN players only?

old Re: Creating a txt file of stats.

Ultr4killer
BANNED Off Offline

Quote
Bierbuikje has written
I see, but that is for USGN users only. Not 'not-registered players' (like me and all my players), we don't have an account. Is it possbile to make it for every player? Not USGN players only?


well only usgn can have stats. Even in game when non-usgn say rank it says "this player have no usgn login" or something like that. So it is not possible in other words

old Re: Creating a txt file of stats.

Banaan
User Off Offline

Quote
That's because without a USGN, people can't be identified automatically. (Changing IPs, multiple people with the same IP, different names, etc.)

old Re: Creating a txt file of stats.

Jermuk
User Off Offline

Quote
Bierbuikje has written
I'm now trying something else with tops ingame. Is there a code to get the number of deaths and kills of a specific id/player?


Lua? Then there is a Code for the ACTUALLY score/death:
player(id, "score")/player(id, "death")
Not tested. Look for more information into the sys/lua/info.txt

old Re: Creating a txt file of stats.

Yasday
User Off Offline

Quote
Yes in lua...
addhook("start","whatyouwant")
function whatyouwant(id)
...
i think...
the round end i dont know
hope this is right

MfG Yasday

old Re: Creating a txt file of stats.

HaRe
User Off Offline

Quote
1
2
3
4
5
6
7
addhook("startround","starter") function starter()
	msg("The round has started") -- Msg
end

addhook("endround","ender") function ender()
	msg("The round has ended") -- Msg
end

old Re: Creating a txt file of stats.

archmage
User Off Offline

Quote
It would be best to save the players USGN instead of name. As many names are overused (such as "Player" which is also the default name).
This is how to write to a file:
1
2
3
4
5
6
7
8
9
10
11
local file = io.open (file_name, mode)
--[[
Basic Modes:
"r" = read a file
"w" = write to a file
"a" = write to a file (without erasing everything post-writing)
]]--

file:write( what_you_want_to_write )
file:close() -- ALWAYS close the file when it is no longer needed.
-- Also use the escape character '\' followed by a 'n' to start a new line

old Re: Creating a txt file of stats.

djedu
User Off Offline

Quote
hi guys, im coding to and i want to know what is wrong here:
1
2
3
4
if (player(id,"usgn")>0) then 
  file = io.open("sys/lua/acc/"..player(id,"usgn")..".txt","r")
  content = io.read(file)
  file:close()
i want read the first line and save it in an variable. but CS2D say that ("read") is an invalid option

PLEASE GUYS, NEED HELP!

old Re: Creating a txt file of stats.

DC
Admin Off Offline

Quote
@Bierbuikje:
I'm not sure if you are aware of this fact but you do have an account, namely "Bierbuikje" you can use this account in-game.
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview