Forum

> > CS2D > Scripts > Player down
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Player down

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Player down

Suprise
BANNED Off Offline

Zitieren
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.

alt Re: Player down

Jynxxx
User Off Offline

Zitieren
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.

alt Re: Player down

Suprise
BANNED Off Offline

Zitieren
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.

alt Re: Player down

EngiN33R
Moderator Off Offline

Zitieren
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:

Mehr >


Please provide feedback.
1× editiert, zuletzt 22.11.12 15:02:04

alt Re: Player down

Cure Pikachu
User Off Offline

Zitieren
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

alt Re: Player down

Suprise
BANNED Off Offline

Zitieren
I've changed some things in Engineer's script, and now it work!
Thank you so much Engineer.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht