English King-Crown

9 replies
Goto Page
To the start Previous 1 Next To the start
17.06.18 03:30:19 pm
Up
NikiCheL
User
Offline Off
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
17.06.18 06:03:53 pm
Up
KingShadow
User
Offline Off
heh very simple script it worked on me and tested without any problem

Code:
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
17.06.18 06:15:17 pm
Up
NikiCheL
User
Offline Off
@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!
17.06.18 06:21:56 pm
Up
KingShadow
User
Offline Off
you mean if someone reached the king no one after him gain it
17.06.18 07:03:08 pm
Up
NikiCheL
User
Offline Off
@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
24.06.18 06:18:18 pm
Up
Cure Pikachu
User
Offline Off
@user KingShadow: I lol'd at your script, it's wrong in so many ways...
Here, give this a shot?
Code:
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("hudtxt2 "..id.." 40 \"\169000255000King "..player(k,"name").."\" 52 104 1")
     else
          parse("hudtxt2 "..id.." 40 \"\169000255000King not found"\" 52 104 1")
     end
end
edited 5×, last 24.06.18 08:17:57 pm
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
24.06.18 06:55:32 pm
Up
NikiCheL
User
Offline Off
@user Cure Pikachu:
I checked your script and it's not working.
24.06.18 08:34:16 pm
Up
M3_Quick
User
Offline Off
@user NikiCheL: its working for me.
24.06.18 08:48:41 pm
Up
NikiCheL
User
Offline Off
@user M3_Quick: What do you mean?
edited 2×, last 26.06.18 07:14:26 am
25.06.18 04:48:45 pm
Up
KingShadow
User
Offline Off
@user Cure Pikachu: i started learning scripting 1month ago nvm
To the start Previous 1 Next To the start