Forum

> > CS2D > Scripts > King-Crown
Forums overviewCS2D overview Scripts overviewLog in to reply

English King-Crown

9 replies
To the start Previous 1 Next To the start

old King-Crown

NeptooN
User Off Offline

Quote
Hi, everybody.

Who can make a script for me?

When you kill 15 players without a single death, you become king.
If you died 5 times, you are no longer king.

When you're king, over you written king. And at the top of the center is written (King "name" ) - the name of the player who became king.

Help me?
edited 1×, last 26.06.18 06:42:12 pm

old okey !

KingShadow
User Off Offline

Quote
heh very simple script it worked on me and tested without any problem

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
29
30
31
32
33
----------------------------
addhook('say','kingchat')
addhook('die','die_hook')
addhook('kill','kingkill')
-----------------------------



function kingchat(id,txt)
if player(id,"score")==15 then
msg("\169255128000[King] "..player(id,"name").."\169255255255: "..txt)
return 1
end
if player(id,"score")==0 and player(id,'deaths')==0 or player(id,"score") and player(id,'deaths') then
msg("\169255025000"..player(id,"name").."\169255255000: "..txt)
return 1
elseif player(id,"team")==2 then
msg("\169000128255"..player(id,"name").."\169255255000: "..txt)
return 1     
     end
end

function kingkill(id)
if player(id,"score")==15 then
msg("\169000255000"..player(id,"name").." \169255255255is Now King For Killing 15 Players !")
end
end

function die_hook(id)
if player(id,"score")==15 and player(id,'deaths')==5 then
msg("\169255000000"..player(id,"name").." \169255255255is No Longer King !")
end
end
edited 2×, last 25.06.18 04:34:12 pm

old Re: King-Crown

NeptooN
User Off Offline

Quote
@user KingShadow: "When you're king, over you written king. And at the top of the center is written (King "name" ) - the name of the player who became king." And Yes by the way the king can be only one!

old Re: King-Crown

NeptooN
User Off Offline

Quote
@user KingShadow:
I mean, the player can't be king for one reason, you have to kill the king 5 times. after the five deaths of the king he not the king anymore.

You Help me?
edited 3×, last 24.06.18 05:29:46 pm

old Re: King-Crown

Cure Pikachu
User Off Offline

Quote
@user KingShadow: I lol'd at your script, it's wrong in so many ways...
Here, give this a shot?
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
if king == nil then king = {} end

king.kstreak = {} -- kill streak
king.dcount = {} -- king death count
king.currentking = {} -- current king

addhook("join","king.join")
function king.join(id)
	king.kstreak[id] = 0
	king.dcount[id] = 0
end

addhook("leave","king.leave")
function king.leave(id)
	-- if king or king candidate leaves the game
	if #king.currentking > 0 then
		for a, b in ipairs(king.currentking) do
			if b == id then
				table.remove(king.currentking,a)
				break
			end
		end
		updatehud()
	end
	king.kstreak[id] = nil
	king.dcount[id] = nil
end

addhook("kill","king.kill")
function king.kill(killer)
	king.kstreak[killer] = king.kstreak[killer] + 1
	if king.kstreak[killer] == 15 then -- 15 kill streak
		local isking = false
		if #king.currentking > 0 then
			for a, b in ipairs(king.currentking) do
				if b == killer then
					isking = true
					break
				end
			end
		end
		if not isking then
			table.insert(king.currentking,killer)
			if #king.currentking == 1 then
				msg2(killer,"\169000255000You are now king!")
			elseif #king.currentking > 1 then
				msg2(killer,"\169000255000You are now eligible to be a king! Kill the king and survive to be the next king!")
			end
			updatehud()
		end
	end
end

addhook("die","king.die")
function king.die(victim)
	-- Reset killstreak
	king.kstreak[victim] = 0
	if #king.currentking > 0 then
		if king.currentking[1] == victim then
			king.dcount[victim] = king.dcount[victim] + 1
			if king.dcount[victim] == 5 then
				table.remove(king.currentking,1)
				king.dcount[victim] = 0
				updatehud()
			end
		else
			for a, b in ipairs(king.currentking) do
				if b == id then
					table.remove(king.currentking,a)
					break
				end
			end
		end
	end
end

function updatehud()
	if #king.currentking > 0 then
		local k = king.currentking[1]
		parse("hudtxt 40 \"\169000255000King "..player(k,"name").."\" 52 104 1")
	else
		parse("hudtxt 40 \"\169000255000King not found"\" 52 104 1")
	end
end
edited 6×, last 14.12.19 02:10:28 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview