Forum

> > CS2D > General > Creating a txt file of stats.
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch Creating a txt file of stats.

15 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Creating a txt file of stats.

Bierbuikje
User Off Offline

Zitieren
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

alt Re: Creating a txt file of stats.

Bierbuikje
User Off Offline

Zitieren
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?

alt Re: Creating a txt file of stats.

Ultr4killer
BANNED Off Offline

Zitieren
Bierbuikje hat geschrieben
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

alt Re: Creating a txt file of stats.

Banaan
User Off Offline

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

alt Re: Creating a txt file of stats.

Jermuk
User Off Offline

Zitieren
Bierbuikje hat geschrieben
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

alt Re: Creating a txt file of stats.

Yasday
User Off Offline

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

MfG Yasday

alt Re: Creating a txt file of stats.

HaRe
User Off Offline

Zitieren
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

alt Re: Creating a txt file of stats.

archmage
User Off Offline

Zitieren
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

alt Re: Creating a txt file of stats.

djedu
User Off Offline

Zitieren
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!

alt Re: Creating a txt file of stats.

DC
Admin Off Offline

Zitieren
@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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht