Forum

> > CS2D > Scripts > Respawn only if everyone is dead.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Respawn only if everyone is dead.

9 replies
To the start Previous 1 Next To the start

old Respawn only if everyone is dead.

Raaj Nadar
User Off Offline

Quote
Hey guys,

I was making a script and i need a script which checks that if a player dies then he can't re-spawn untill all the player's are dead.

I want something that happens in standard server.
No spawn untill all are dead and everyone spawn after round start.

I don't have any idea to make it i was confused weather to use a kill hook or a die hook.??

[Remember]
Everyone should re-spawn after the rounds start.

If anyone can help please put a post.

old Re: Respawn only if everyone is dead.

_Yank
User Off Offline

Quote
This cannot be done with the standart gamemode. Oh, wait, this can't be done at all unless you do it the dirty way (by killing the player if he tries to spawn)

old Re: Respawn only if everyone is dead.

Ajmin
User Off Offline

Quote
It can be done with DM using killing method!
i mean if player dead once then whenever he tries to spawn he will be killed! (just a suggestion i dont know if it will work 100%)

By the way:
Raj Nadar has written
if a player dies then he can't re-spawn untill all the player's are dead.

who will kill the last player?

Edit:
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
once = {}
started = 0
addhook('join','j')
function j(id)
if started==0 then
once[id]=0
else
once[id]=1
end
end

addhook('die','d')
function d(id)
started = 1
once[id]=1
if #player(0,"tableliving")==1 then
started=0
once[id]=0
end
end


addhook('spawn','s')
function s(id)
if once[id]==1 then
parse("kill "..id.."")
end
end
This is another 1 using lock spec! :
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
parse("mp_randomspawn 1") --random spawn [optional]
locked = 0

addhook("spawn","s")
function s(id) --this func is only needed if u turn on random spawn!
return "id of wpns u want (seperate with comma)"
end

addhook("startround_prespawn","sp")
function sp(mode)
locked = 0
for id=1, 32 do
     if player(id,"exists") and player(id,"team")==0 then
     parse("makect "..id)
     end
end
end

addhook("kill","k")
function k(kil,vic,wpn)
parse("makespec "..vic)
locked = 1
end



addhook("ms100","ms")
function ms()
if #player(0,"tableliving")==1 and locked==1 then
     for id=1,32 do
          if player(id,"exists") and player(id,"health")>0 then
          msg("©000255000"..player(id,"name").." won this match!@C")
          parse("restart 3")
          end
     end
end
end
addhook("team","te")
function te(id,team)
if team~=0 and locked==1 then
msg2(id,"©255000000Wait till the round gets over!")
return 1
end
end

This code works fine and also tested!

But in case if the player is dead without a killer (i mean suicide or killed by creatures) then he will be able to spawn again!
Better to use die hook if u need this to be disabled!
i mean hook the cmd "makespec" in the hook "die"
(currently hooked in "kill" hook)
edited 19×, last 26.12.14 04:13:18 pm

old Re: Respawn only if everyone is dead.

Raaj Nadar
User Off Offline

Quote
Oh thanks ajmin you gave a good idea of soec locking after the death.


Who will kill the last player?
Sirry my mistake i want restart after only one player is left lol tgere is also a way for all dead last player suicides lol.

Thanks everyone i will test and tell the result.
map and no


Edit no problem no way to suicide in my map and no creatures.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview