Forum

> > CS2D > Scripts > disconnected alive or dead
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch disconnected alive or dead

12 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt disconnected alive or dead

EnderCrypt
User Off Offline

Zitieren
hi
i have a leave hook
is it possible to know if they player disconnected when alive, or when dead (or in spect)

cause i would like to have somheting to tell if player was alive or not

thx

alt Re: disconnected alive or dead

KimKat
GAME BANNED Off Offline

Zitieren
I think the leave hook would solve all of this.

Why would one want to check if the players are dead or alive when they disconnect from the server? just asking.

Anyways I think this would solve it...
1
2
3
4
5
6
7
8
9
10
addhook("leave","health_check")
function health_check(id)
	if player(id,"health")==0 then
		msg2(id,"©255255000"..player(id,"name").." disconnected while DEAD!")
		return 0
	elseif player(id,"health")>=0 then
		msg2(id,"©255255000"..player(id,"name").." disconnected while ALIVE!")
		return 0
	end
end
This should work.
3× editiert, zuletzt 28.02.11 23:04:17

alt Re: disconnected alive or dead

EnderCrypt
User Off Offline

Zitieren
gonna try

edit: why it never works...

i tink everyone has 0 hp when leaving... that would explain why no message apper
2× editiert, zuletzt 02.03.11 16:31:25

alt Re: disconnected alive or dead

KimKat
GAME BANNED Off Offline

Zitieren
pheangsri hat geschrieben
gonna try

edit: why it never works...

i tink everyone has 0 hp when leaving... that would explain why no message apper
I simply forgot to make it so that all on server can see the messages...

1
2
3
4
5
6
7
8
9
10
11
12
addhook("leave","health_check")
function health_check(id)
	local p_hp = player(id,"health")
	local p_nm = player(id,"name")
	if p_hp==0 then
		msg([[©255255000"..p_nm.." disconnected while DEAD!]])
	return 0
	elseif p_hp>=0 then
		msg([[©255255000"..p_nm.." disconnected while ALIVE but injured to "..p_hp.." health!]])
	return 0
	end
end
That should work, flawlessly.

alt Re: disconnected alive or dead

EnderCrypt
User Off Offline

Zitieren
anyone else got a idea?

edit... hm my fault should have added stuff before tested

seems to work now thx
edit 2, i tink i know what was wrong
when i changed name of this to what i normally use in this hook, then it didnt work, so there was problably a name conflict, even if there only was that name on 2 places in my lua

adhook and function...
1× editiert, zuletzt 06.03.11 21:22:02
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht