Forum
CS2D Scripts Counter Strike Source and Global Offensive ScriptCounter Strike Source and Global Offensive Script
8 replies 1
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
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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, Apache uwu was quicker and broke my reply streak. Still, his implementation is more sophisticated, you'd probably be better off using that.
@ Apache uwu: When i tried yours it said EXCEPTION_ACCESS_VIOLATION..
@ EngiN33R: OK, It Worked! Thanks! But i'll just make it go to the Center!
Edit! @ EngiN33R: It only makes my team the MVP! Please fix it!
edited 2×, last 21.05.12 09:40:02 am
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
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
@ EngiN33R: Thanks!
@ Navy Seal: Well , to be exact , it shows both!(Maybe , i don't remember)
@ SkullzOrig: And What and why did you post here for?
1