Forum

> > CS2D > Scripts > Top player score script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Top player score script

4 replies
To the start Previous 1 Next To the start

old Top player score script

Joni And Friends
User Off Offline

Quote
Could anyone help me for make "The top player score" script for me? i want that script for my server..

> Description script
I want that script using server message for show the Top Player score every minute, The top player score is who have highest score than other playes in server, the score is not score in player data server but score in showing on TAB

Sorry for bad in english
edited 1×, last 05.07.15 06:55:07 am

old Re: Top player score script

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
addhook("minute","a")
function a()
local highest = 0
local id = 0
	for k,v in pairs (player(0,"table")) do
		if player(v,"score")>highest then
			highest = player(id,"score")
			id = v
		end
	end
	msg("Player "..player(id,"name").." has the highest score of "..highest)
end

Hope I didn't screw up anything

old Re: Top player score script

Joni And Friends
User Off Offline

Quote
Its not work user Rainoth,have error in this line
1
LUA ERROR: sys/lua/server.lua:11: attempt to concatenate a boolean value

Thanks for reply my topic and help me for making the script, i has fix it and now it work. This the code i fixing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
s=0
h=0
addhook("minute","_s")
function _s()
for _,id in pairs (player(0,"table")) do
        if player(id,"score")>s and player(id,"score")>0 then
               s=player(id,"score")
               h=id
          end
   end
if h>0 and player(h,"exists") then
            msg("higest is "..player(h,"name").." with score "..player(h,"score"))
     return 1
         elseif not player(h,"exists") then
             h=0
             s=0
     end
end
edited 6×, last 06.11.14 04:49:31 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview