Forum

> > CS2D > Scripts > Player down
Forums overviewCS2D overview Scripts overviewLog in to reply

English Player down

9 replies
To the start Previous 1 Next To the start

old Player down

Suprise
BANNED Off Offline

Quote
So I'm currently making a mod. It goes very good, but now I need help.
When a zombie hit a human 4 times, the human can't move and he has an image on himself.

Here is what I done so far:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("hit","RotU.hit_hook")
function RotU.hit_hook(id,source,weapon,hpdmg,apdmg,rawdmg)
	if player(id,"team") == 2 then
		if player(source,"team") == 1 then
			if lives[id] == 1 then
				health[id] = health[id] - 25
			end
			if health[id] <= 10 then
				if onced[id] == 0 then
					RotU_msg("©255000255"..player(id,"name").." is down!")
					lives[id] = 0
					pdown[id] = 1
					parse("speedmod "..id.." -100")
					onced[id] = 1
				end
			end
		end
	end
end

So when someone Press E for 5 seconds on the guy who is down, he get his health back (health[id] = 100) and he can move..

(Also, please complete my hit hook with the image(gfx/Reign of the Undead/rotu_help_img.png)).

Thanks in advance.

old Re: Player down

Jynxxx
User Off Offline

Quote
Try this.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("hit","RotU.hit_hook")
function RotU.hit_hook(id,source,weapon)
	if player(id,"team") == 2 then
		if hits[id] == 4 then
			RotU_msg("©255000255"..player(id,"name").." is down!")
			local playerdown = image("gfx/Reign of the Undead/rotu_help_img.png",id+200)
			lives[id] = 0
			pdown[id] = 1
			parse("speedmod "..id.." -100")
			onced[id] = 1
			pdown[id] = 1
		else
			hits[id] = hits[id] + 1
		end
	end
	return 1
end
If it's not right then, I'm sorry I really didn't understand what you said.

old Re: Player down

Suprise
BANNED Off Offline

Quote
The hit hook doesn't seems to has problem

What I need is When someone press E on a human('use' hook, I guess) who is down, that player(who is down) can move again.

old Re: Player down

EngiN33R
Moderator Off Offline

Quote
Well, there is no nice way to capture how long someone is holding down the use key, so I'll just make it so that you press E once and it takes five seconds, if you move you stop reviving. I think this code should work, didn't test it:

More >


Please provide feedback.
edited 1×, last 22.11.12 03:02:04 pm

old Re: Player down

Cure Pikachu
User Off Offline

Quote
user EngiN33R 's script will need a fix. This one allows players that are revived to move.
1
2
3
4
5
6
7
8
9
10
function RotU.revive(id)
	id=tonumber(id)
	if pdown[id] then
		freeimage(playerdownimg[id])
		pdown[id]=false
		parse("speedmod "..id.." 0") -- Add this line
		lives[id]=true
		onced[id]=true
	end
end

old Re: Player down

Suprise
BANNED Off Offline

Quote
I've changed some things in Engineer's script, and now it work!
Thank you so much Engineer.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview