Forum

> > CS2D > Scripts > Is it possible to..
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Is it possible to..

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Is it possible to..

OsteeN
User Off Offline

Zitieren
Create a script that detects which weapon a player was hit by, and if the weapon was, for example, a m4a1, the player would freeze?

I don't use Lua, so no need to flame. I'm just curious if it's possible.

-OsteeN

alt Re: Is it possible to..

Alistaire
User Off Offline

Zitieren
1
2
3
4
5
6
7
addhook('hit', '_hit')

function _hit(id, source, weapon)
	if weapon == 32 then
		parse('speedmod '..id..' -100')
	end
end

or

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function array(v)
	local a = {}
	for i = 1, 32 do
		a[i] = v
	end
	return a;
end

plr = {}
plr.freeze = array(0)
plr.pos = {['x'] = array(0), ['y'] = array(0)}

frz = {}
frz.wpns = {
	[32] = 10
}

addhook('hit', '_hit')
addhook('move', '_move')
addhook('ms100', '_ms100')

function _hit(id, source, weapon)
	for k, v in pairs(frz.wpns) do
		if k == weapon then
			plr.freeze[id] = plr.freeze[id] + v
		end
	end
end

function _move(id, x, y)
	if plr.freeze[id] == 0 then
		plr.pos.x[id] = x
		plr.pos.y[id] = y
	else
		setpos(id..' '..plr.pos.x[id]..' '..plr.pos.y[id])
	end
end

function _ms100()
	for _, id in pairs(player(0, 'tableliving')) do
		if plr.freeze[id] > 0 then
			plr.freeze[id] = plr.freeze[id] - 1
		end
	end
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht