Forum

> > CS2D > Scripts > How to get player status ?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to get player status ?

5 replies
To the start Previous 1 Next To the start

old Re: How to get player status ?

Avo
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
nplayer = function(id,cmd)
	if cmd == "alive" then
		if player(id,"health") <= 0 then
			return false
		else
			return player(id,"health")
		end
	else
		return player(id,cmd)
	end
end

old Re: How to get player status ?

mafia_man
User Off Offline

Quote
user Avo has written
1
2
3
4
5
6
7
8
9
10
11
nplayer = function(id,cmd)
	if cmd == "alive" then
		if player(id,"health") <= 0 then
			return false
		else
			return player(id,"health")
		end
	else
		return player(id,cmd)
	end
end

And you think he will know how to use it lol?
Put this at top of your script:
1
2
3
4
5
6
7
_player = player
function player(id, v)
	if v == "alive" then
		return _player(id, "health") > 0
	end
	return _player(id, v)
end

Usage:
1
2
3
if player(id, "alive") then
	-- your code here
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview