Forum

> > CS2D > Scripts > Hunger games script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Hunger games script

7 replies
To the start Previous 1 Next To the start

old Hunger games script

rzvthePsycho
User Off Offline

Quote
Heya Unrealsoftware.

Since I don't know a single thing about lua I wanted to search for help here.

The hunger games script should work like this:

- Round will start when there are minimum 6 players.
- When a player will die there will be a message on center of the screen with the message "*That specific player* died"
- After a player dies it will be moved to spectators.
- When there will be only 1 player alive the round will end with a message on the center of the screen: "*That specific player* won".

And that's basically it. Thanks for your time.

old Re: Hunger games script

Masea
Super User Off Offline

Quote
Probably there will be persons which can make it easily. But just saying, when I back my home, I can do this for you. Much much easy. I mean, 3-4 hours later, you can get your script from me.

And also an question; will round start when there is 6 players in the server or team?

old Re: Hunger games script

Rainoth
Moderator 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
23
24
25
26
27
28
29
30
31
32
33
34
hunger = {
hooks = {"startround","die","team"},
round = false
}

function hg_startround(mode)
	if (#player(0,"tableliving") >= 6) then
		hunger.round = true
	end		
end

function hg_die(victim, killer)
	if hunger.round then
		msg(player(victim,"name").." has been killed!@C")
		parse("makespec "..victim)
		if (#player(0,"tableliving") <= 1) then
			for _,id in pairs (player(0,"tableliving")) do
				msg(player(id,"name").." won!@C")
			end
			hunger.round = false
		end
	end
end

function hg_team(id, team)
	if player(id,"team") == 0 and hunger.round and team ~= 0 then
		msg2(id,"You cannot join the hunger game right now...")
		return 1
	end
end

for k,v in pairs (hunger.hooks) do
	addhook(v,"hg_"..v)
end
edited 1×, last 22.07.16 04:49:09 pm

old Re: Hunger games script

Yates
Reviewer Off Offline

Quote
@user Rainoth: You can return 1 on team hook instead of putting them back into spectators. Otherwise you may have idiots switching teams to spam the view of everyone else.

old Re: Hunger games script

Yates
Reviewer Off Offline

Quote
@user TrialAndError: What? I don't get what you're trying to say. In case you are saying return 1 will not work; cs2d cmd team:

Quote
Return Values
0: proceed normally
1: don't change team + close menu


In case you mean that using return 1 will disallow dead players to join the spectators team: read @user Rainoth's code. It clearly states that it will disallow a player from spectator (and ONLY spectator) to change teams - this does NOT apply for any other player in any other team.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview