English King room

3 replies
Goto Page
To the start Previous 1 Next To the start
06.12.18 09:48:16 am
Up
ImQuiet
User
Offline Off
Hello guys, i need a script .. i hope somebody will help me

I want, when a player kill 12 or 15 kills in a round, his game will start from different place in a next round, actually i made a room in my map and i want Only 12 kills Killer can open use this room as a reward and can Open gate of this room and after completing reward round, his game will normally start like normal players ...
edited 1×, last 06.12.18 06:55:41 pm
FRiendly boYy.
06.12.18 02:20:22 pm
Up
-3Jlou_nTu4-
User
Offline Off
You gave too little information, what exactly do you want and under what conditions, for example, this script will work only in standard rounds

How it work:
If there is a king, the time is allocated during which the reward round takes place. At this time, all players except the king cannot move, after the reward time, the king returns to his start position and all players get the opportunity to move.

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
local KINGROOM_TILEX = 1     --x position of king room in TILE
local KINGROOM_TILEY = 1     --y position of king room in TILE
local KINGROOM_REWARDTIME = 2     --reward round time in SECONDS

local plPrevSpeed = {}
local kingPrevPos = nil

addhook("startround", "startround_proc")

function rewardTimeOff(plid)
     if player(plid, "health")>0 then
          parse("setpos "..tostring(plid)..' '..tostring(kingPrevPos.x)..' '..tostring(kingPrevPos.y))
     end

     for _, val in pairs(playerlist) do
          if val~=plid and plPrevSpeed[val] then
               parse("speedmod "..tostring(val)..' '..tostring(plPrevSpeed[val]))
          end
     end
end

function rewardTime(plid)
     local playerlist = player(0, "table")

     for _, val in pairs(playerlist) do
          if val~=plid then
               plPrevSpeed[val] = player(plid, "speedmod")
               parse("speedmod "..tostring(val).." -100")
          end
     end

     timer(KINGROOM_REWARDTIME * 1000, "rewardTimeOff", tostring(plid), 1)
end

function startround_proc(mode)
     local playerlist = player(0, "table")

     for _, plid in pairs(playerlist) do
          if player(plid, "score")==12 or player(plid, "score")==15 then
               kingPrevPos =
                    {
                    x = player(plid, "x"),
                    y = player(plid, "y")
                    }
               parse("setpos "..tostring(plid)..' '..tostring(KINGROOM_TILEX*32+16)..' '..tostring(KINGROOM_TILEY*32+16))
               rewardTime(plid)
               break
          end
     end
end
edited 2×, last 06.12.18 02:41:24 pm
06.12.18 03:38:33 pm
Up
KingShadow
User
Offline Off
@user -3Jlou_nTu4-: He won't understand this kind of code if he wants to edit it later

just make it simple like that
Spoiler >
edited 1×, last 06.12.18 03:50:14 pm
06.12.18 05:14:24 pm
Up
ImQuiet
User
Offline Off
@user KingShadow: & @user -3Jlou_nTu4-: thanks both of you but @user KingShadow: i want, Until nobody became king, nobody can open king room and show error, but when i tested it, The gate is opening and even error not showing, you did maybe some miatakes
FRiendly boYy.
To the start Previous 1 Next To the start