Forum

> > CS2D > Scripts > Counter Strike Source and Global Offensive Script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Counter Strike Source and Global Offensive Script

8 replies
To the start Previous 1 Next To the start

old Counter Strike Source and Global Offensive Script

DrL
User Off Offline

Quote
Can anyone make the script like in CSS And CSGO , The one when the match has ended there will be a Message that contains : MVP : Player Name : Kills , The most kill will become MVP! Can anyone make it? Please!?

old Re: Counter Strike Source and Global Offensive Script

Apache uwu
User Off Offline

Quote
Like this?

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
26
27
28
addhook("endround","_endround")

function _endround()
	local kills=nil
	for _,id in pairs(player(0,"table")) do
		if player(id,"team")~=0 then
			if kills==nil or player(id,"score")>kills then
				kills=player(id,"score")
			end
		end
	end
	local players={}
	for _,id in pairs(player(0,"table")) do
		if player(id,"team")~=0 then
			if player(id,"score")==kills then
				table.insert(players,id)
			end
		end
	end
	if #players==1 then
		msg(string.char(169).."255255255MVP : "..player(players[1],"name").." : "..kills)
	elseif #players~=0 then
		msg(string.char(169).."255255255There are "..#players.." MVPS:")
		for _,id in pairs(players) do
			msg(string.char(169).."255255255MVP : "..player(id,"name").." : "..kills)
		end
	end
end

old Re: Counter Strike Source and Global Offensive Script

EngiN33R
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function table.find(table,element)
	for k,v in pairs(table) do
		if v==element then
			return k
		end
	end
end

addhook("endround","showmvp")
function showmvp()
	for i=1,2 do
		local kills={}
		for i=1,32 do
			kills[i]=0
		end
		for _,id in pairs(player(0,"team"..i)) do
			kills[id]=player(id,"score")
		end
		local mvp=math.max(unpack(kills))
		for _,id in pairs(player(0,"team"..i)) do
			msg2(id,string.char(169).."255255255MVP: "..player(table.find(kills,mvp),"name").." ("..mvp.." kills)")
		end
	end
end

EDIT: Ay, user Apache uwu was quicker and broke my reply streak. Still, his implementation is more sophisticated, you'd probably be better off using that.

old Re: Counter Strike Source and Global Offensive Script

EngiN33R
Moderator Off Offline

Quote
user DrL has written
Edit! @user EngiN33R: It only makes my team the MVP! Please fix it!


Well, that script edition tells all members of CT the MVP in the CT team, and to T - the MVP in the T team. If you want it to show the absolute best player, here's how:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function table.find(table,element)
     for k,v in pairs(table) do
          if v==element then
               return k
          end
     end
end

addhook("endround","showmvp")
function showmvp()
      local kills={}
      for i=1,32 do
           kills[i]=0
      end
      for _,id in pairs(player(0,"table")) do
           kills[id]=player(id,"score")
      end
      local mvp=math.max(unpack(kills))
      for _,id in pairs(player(0,"table")) do
           msg2(id,string.char(169).."255255255MVP: "..player(table.find(kills,mvp),"name").." ("..mvp.." kills)")
      end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview