Forum

> > CS2D > Scripts > Score control and save
Forums overviewCS2D overview Scripts overviewLog in to reply

English Score control and save

6 replies
To the start Previous 1 Next To the start

old Score control and save

limonata
User Off Offline

Quote
Hi all i want to control player's score but this score should be same in the rank. When player write rank, there is a him score and i want to check it. For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
playerScore = "him score in rank"
vip = {}
mod = {}
admin = {}
addhook("join","j")
function j(id)
	if playerScore >= 500 then
	vip[id] = true
	elseif playerScore >= 1000 then
	mod[id] = true
	elseif playerScore >= 2000 then
	admin[id] = true
	end
end
Like that. Also i need to take log for admin/mod/vip list with usgn Numbers.

This code is absolutely wrong i know. This codes are just example. Thanks, sorry for my bad english.

old Re: Score control and save

Yates
Reviewer Off Offline

Quote
The only way to get a score is to go into the scores file.

The dinosaur tool will help you with this. Maybe DC will add a return to score/death/kill values when someone says rank some day.

Also;
1
2
3
4
5
6
[...]
elseif playerScore >= 1000 then
	mod[id] = true
elseif playerScore >= 2000 then
	admin[id] = true
[...]
pls no

old Re: Score control and save

MikuAuahDark
User Off Offline

Quote
file cs2d [UNUSED] Get Player Rank v1.4

user limonata has written
Also i need to take log for admin/mod/vip list with usgn Numbers.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
adminlist={}
viplist={}
modlist={}
-- to check if mod/admin/vip
fai_contains=fai_contains or function(t,e)
	for _, value in pairs(t) do
		if value == e then
			return true
		end
	end
	return false
end
if fai_contains(adminlist,player_usgn) then
	-- admin
end
if fai_contains(modlist,player_usgn) then
	-- mod
end
if fai_contains(viplist,player_usgn) then
	-- vip
end

old Re: Score control and save

MikuAuahDark
User Off Offline

Quote
@user limonata: It seems that you don't read the description correctly

Example how to get player rank score
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("join","joinhook")
function joinhook(id)
	local usgn=player(id,"usgn")
	if usgn>0 then
		local rank=GetUserStatsRank(usgn)
		if rank.isexists then
			msg2(id,"Score: "..rank.score)
			msg2(id,"Frags: "..rank.frags)
			msg2(id,"Deaths: "..rank.deaths)
			msg2(id,"Time on server: "..rank.time.." seconds!")
		else
			msg2(id,"It seems that you're new in this server.")
		end
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview