Files

> > CS2D > Lua Scripts > TOP3 in Server Info
Files overviewCS2D overviewLua Scripts overview

English TOP3 in Server Info >

2 comments74 kb, 165 Downloads

Comments

2 comments
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in

old

Komo the Cat
User Off Offline

gotta install it on my client
I like it!

old

Mami Tomoe
User Off Offline

On line 10 of serverinfo.lua, change this
stats(steam,"rank")
to this
steamstats(steam,"rank")
.

cs2d lua cmd stats
cs2d lua cmd steamstats

In addition to that, you didn't mention that this wouldn't update until the server changes map.
This is ineffective for servers that don't often (or at all) change their maps.
You might want to include an automatic map reload when the server is empty (and other variables), but that could be up to the user.
Regardless, you must mention how it updates.

Furthermore, this is a very static way of doing this.
That means if the average kiddo tries to modify either serverinfo.txt or serverinfo.lua then they most likely will end up breaking something.

I do like the concept, but the execution is flawed.
I would much prefer if you had just added comments inside serverinfo.txt that will be read by serverinfo.lua to know when exactly to place each player.

Like this:
1
2
3
4
<text size = "15" color="#BABABA" align="left">
<!-- FIRST PLACE -->
To be updated
</text>

And do this within Lua:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- Undefined:
-- id // Player ID
-- position // Player position on the board
-- playerLogin // Player login ID, U.S.G.N. or STEAM

local filePath	= 'sys/serverinfo.txt'
local file, _	= io.open(filePath, 'r')

if not file then

	return
end

local output	= { }

for line in file:lines() do
	if position == 1 and line:find('FIRST PLACE')
		or position == 2 and line:find('SECOND PLACE')
		or position == 3 and line:find('THIRD PLACE') then

		output[#output+1] = player(id, 'name') .. '#' .. playerLogin
	else
		output[#output+1] = line
	end
end

I didn't test any of the code, but the concept is there.
To the start Previous 1 Next To the start