Forum

> > CS2D > Scripts > Weapon Detector
Forums overviewCS2D overview Scripts overviewLog in to reply

English Weapon Detector

2 replies
To the start Previous 1 Next To the start

old Weapon Detector

kralzaza_3
User Off Offline

Quote
Hello us!

I'm creating a jail map and i'm trying to make weapon detector.

When a CT player use !check id command, if player who checked with this command has ANY weapon (except knife, of course) CT player noticed with "Player has weapon". If not, CT player noticed with "Player has no weapon".

I don't know how to check weapons user have. I can do it myself all of these message errands, i just want learn how to check if a player has a weapon and team.

Thank you for your help.

old Re: Weapon Detector

Cure Pikachu
User 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
addhook("say","scan")
function scan(id,txt)
	if player(id,"team") >= 2 then
		if string.sub(txt,1,7) == "!check " then
			local t2 = tonumber(string.sub(txt,8))
			if t2 and player(t2,"exists") and player(t2,"health") > 0 then
				local a = 0
				-- Counter-measure in case knife gets stripped
				for _, w in ipairs(playerweapons(t2)) do
					if w ~= 50 then
						a = a + 1
					end
				end
				if a > 0 then
					msg2(id,player(t2,"name").." has at least 1 weapon!")
				else
					msg2(id,player(t2,"name").." has no weapon!")
				end
			end
		end
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview