Forum

> > CS2D > Scripts > Death zone.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Death zone.

36 replies
Page
To the start Previous 1 2 Next To the start

old Re: Death zone.

Talented Doge
User 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
local TotalSeconds = 0
wait = 15
succeed = false

addhook("second","_sec")
addhook("startround", "_st")

function _sec()
    if TotalSeconds < wait and not succeed then
        TotalSeconds = TotalSeconds + 1
        parse('hudtxt 0 "\169255255255'..wait-TotalSeconds..' until wall opens!" 300 30 1')
    elseif not succeed then
        parse("trigger MyWall")
        parse("hudtxt 0")
		succeed = true
		TotalSeconds = 0
    end
end

function _st()
	succeed = false
end

old Re: Death zone.

MixTape
User Off Offline

Quote
It's working too, thank you.

//edit; or not The 'gate' was close after 30 sec, the mistake is in
1
parse("trigger MyWall")

Read my last post, i dont test this script without this line becouse script by @user Rainoth: is working without this line and i will use his script. I dont like combine, his script is working so im happy

//Minimal offtopic, do u know how to make in team deathmatch, player can respawn after 15 sec after dead?
edited 3×, last 01.08.15 04:06:25 pm

old Re: Death zone.

The Gajos
BANNED Off Offline

Quote
user MixTape has written
(...) do u know how to make in team deathmatch, player can respawn after 15 sec after dead?

cs2d cmd mp_respawndelay 15
On first or last line in lua script (just can't be in hook or function that is called by the hook):
parse('mp_respawndelay 15')
edited 1×, last 01.08.15 04:20:02 pm

old Re: Death zone.

MixTape
User Off Offline

Quote
Yes, i saw it last time but now i cant find it, thank you.

Btw. this script can work?

1
2
3
4
5
6
7
8
9
local TotalSeconds = 0
addhook("second","hp")
function hp()
     if TotalSeconds < 120 then
          parse('mp_respawndelay 0')
     elseif TotalSeconds >= 120 then
          parse('mp_respawndelay 15')
     end
end
edited 1×, last 01.08.15 04:43:49 pm

old Re: Death zone.

Rainoth
Moderator Off Offline

Quote
I fixed a little error there (if > elseif) otherwise it wouldn't work.

Yes it will work but it's not needed to keep calling command to set the setting every second after it's been set. You could just do == instead of >=

old Re: Death zone.

MixTape
User Off Offline

Quote
It doesn't work! Do u know what i mean? I dlike to after 2 minutes in game will be change respawntime to 15 secs.

1
2
3
4
5
6
7
8
9
local TotalSeconds = 0
addhook("second","hp")
function hp()
     if TotalSeconds < 120 then
          parse('mp_respawndelay 0')
     if TotalSeconds == 120 then
          parse('mp_respawndelay 15')
     end
end

I was try with it too.
1
elseif TotalSeconds == 120 then

old Re: Death zone.

The Gajos
BANNED Off Offline

Quote
Do you even know how any computer program works?
Where are you increasing TotalSeconds?!
Fixed >

old Re: Death zone.

MixTape
User Off Offline

Quote
user The Gajos has written
Do you even know how any computer program works?

No. :c Thank you again my friend! Can i hide server text when it is change? Im thinking about "respawn leday changed to 15" on the center of screen.

I have one more problem, do u know where i can add "return 1" in this code to hide chat command? And time to can use again this command.

1
2
3
4
5
6
7
8
9
10
11
addhook("say","md")
function md(id,txt)
if (sample.classes.class[id]==2) then
if txt=="!medickit" then
parse("spawnitem 64 "..player(id,"tilex").." "..player(id,"tiley"))
end
else
          msg2(id,"You arent shaman!")
		  
end
end

old Re: Death zone.

The Gajos
BANNED Off Offline

Quote
Here I took some time for you
Replace my script with your code that is written above mine.

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
-----------------------------------------
-- Small Command Processor for MixTape --
--     Copyrights (c) Adrian Gajos     --
-----------------------------------------
command = {
	['medickit'] = {
		alivePlayer = true; -- player must be alive to use this command or not: false
		reUse = 10;
		action = function(id,txt)
			if (sample.classes.class[id]==2) then
				parse('spawnitem 64 '..player(id,'tilex')..' '..player(id,'tiley')) -- I think you can use 'equip' command for automaticly heal
			else
				msg2(id,'\169255050000You are not shaman!') -- full english better .!.
			end
		end;
	};
}
reUse = {}

function chatInput(id,txt)
	if validCommand(txt) then
		local txt = string.lower(txt)
		local words = toTable(txt)
		local cmd = words[1]:sub(2)
		local args = words
		table.remove(args,1)
		
		if isCommand(cmd) then
			local Return = true
			if command[cmd].alivePlayer then
				if player(id,'health') <= 0 then
					Return = false
				end
			end
			if Return then
				reUse[id] = reUse[id] or {}
				reUse[id][cmd] = reUse[id][cmd] or 0
				if os.time() - command[cmd].reUse >= reUse[id][cmd] then
					command[cmd].action(id,unpack(args))
					reUse[id][cmd] = os.time()
				end
			else
				msg2(id,'\169255050000You cannot use this command while you are dead')
			end
		else
			msg2(id,'\169255050000Unknown command '..string.char(39)..cmd..string.char(39))
		end
		return 1
	end
end
addhook('say','chatInput')

function validCommand(txt)
	if (txt:sub(1,1) == '@' or txt:sub(1,1) == '!') and txt ~= 'rank' then
		return true
	end
	return false
end

function isCommand(cmd)
	for i in pairs(command) do
		if i == cmd then
			return true
		end
	end
	return false
end

function toTable(txt,match)
	local cmd = {}
	if not match then match = '[^%s]+' end
	for word in string.gmatch(txt,match) do
		table.insert(cmd,word)
	end
	return cmd
end

EDIT: I think it won't work while reUse time is 0 . Just use 1 if it's necessary.
EDIT 2: Or not
edited 4×, last 02.08.15 10:49:50 pm

old Re: Death zone.

MixTape
User Off Offline

Quote
This code is very complicated, i think it's easier. It isnt hide command in chat Can you please make more comments in code? I'd like understand it more.

old Re: Death zone.

The Gajos
BANNED Off Offline

Quote
user MixTape has written
It isnt hide command in chat

Your face isn't hidden. Are you fu*cking using more than 1 hook of 'say'? Then it can't work . When I was testing this, it worked for me.

old Re: Death zone.

MixTape
User Off Offline

Quote
So what i can do with it? I'm using this hook in shop script.

old Re: Death zone.

The Gajos
BANNED Off Offline

Quote
Replace function ChatCommands with this in shop script:
1
2
3
4
5
6
7
8
9
10
function ChatCommands(id, msg) --My chat command system
     local cmd = string.lower(msg)
     
     if commands[cmd] then
          commands[cmd](id)
          
          return settings.hideCommands
     end
     chatInput(id,msg)
end
And remove this line from mine (line 51):
addhook('say','chatInput')

old Re: Death zone.

MixTape
User Off Offline

Quote
Spoiler >

I wouldn't to tell it again, because maybe i make something wrong.

Admin/mod comment

a ] was missing and made this post unreadable. Added. /DC

old Re: Death zone.

The Gajos
BANNED Off Offline

Quote
Yeye... his post got fucked but you can see what he wrote using 'Reply with quote'. Anyway for sure I can't see his post above.

You did it not bad but also remove line 51 from my script. Just delete this line.

old Re: Death zone.

MixTape
User Off Offline

Quote
Quote
but you can see what he wrote using 'Reply with quote'.

?

I gave you wrong code, I deleted line 51 and situation is the same. Sry.

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
-----------------------------------------
-- Small Command Processor for MixTape --
--     Copyrights (c) Adrian Gajos     --
-----------------------------------------
command = {
     ['medickit'] = {
          alivePlayer = true; -- player must be alive to use this command or not: false
          reUse = 10;
          action = function(id,txt)
               if (sample.classes.class[id]==2) then
                    parse('spawnitem 64 '..player(id,'tilex')..' '..player(id,'tiley')) -- I think you can use 'equip' command for automaticly heal
               else
                    msg2(id,'\169255050000You are not shaman!') -- full english better .!.
               end
          end;
     };
}
reUse = {}

function chatInput(id,txt)
     if validCommand(txt) then
          local txt = string.lower(txt)
          local words = toTable(txt)
          local cmd = words[1]:sub(2)
          local args = words
          table.remove(args,1)
          
          if isCommand(cmd) then
               local Return = true
               if command[cmd].alivePlayer then
                    if player(id,'health') <= 0 then
                         Return = false
                    end
               end
               if Return then
                    reUse[id] = reUse[id] or {}
                    reUse[id][cmd] = reUse[id][cmd] or 0
                    if os.time() - command[cmd].reUse >= reUse[id][cmd] then
                         command[cmd].action(id,unpack(args))
                         reUse[id][cmd] = os.time()
                    end
               else
                    msg2(id,'\169255050000You cannot use this command while you are dead')
               end
          else
               msg2(id,'\169255050000Unknown command '..string.char(39)..cmd..string.char(39))
          end
          return 1
     end
end


function validCommand(txt)
     if (txt:sub(1,1) == '@' or txt:sub(1,1) == '!') and txt ~= 'rank' then
          return true
     end
     return false
end

function isCommand(cmd)
     for i in pairs(command) do
          if i == cmd then
               return true
          end
     end
     return false
end

function toTable(txt,match)
     local cmd = {}
     if not match then match = '[^%s]+' end
     for word in string.gmatch(txt,match) do
          table.insert(cmd,word)
     end
     return cmd
end

PS; Ty admin, i'm writting bbcode manually.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview