Forum

> > CS2D > Scripts > very easy lua
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch very easy lua

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt very easy lua

karnash_btt
User Off Offline

Zitieren
Look at this:
1
2
3
4
5
6
7
addhook("attack" , "attackshake")
function attackshake(id)
parse("shake "..id.." 3")
if (player(id,"health")<=30) then
parse("shake "..id.." 5")
end
end

Please help me, im learning lua from scratch:
this script shakes the player when attacking (very simple) but i dont know how to make the player not shaking when walking (with left shift) thanx
1× editiert, zuletzt 16.09.11 03:46:25

alt Re: very easy lua

Apache uwu
User Off Offline

Zitieren
Here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("move","_move")
addhook("attack","_attack")

t_walk={}

function _move(id,x,y,walk)
	t_walk[id]=walk
end

function _attack(id)
	if t_walk[id]=="0" then --not walking
	parse("shake "..id.." 3")
		if (player(id,"health")<=30) then
			parse("shake "..id.." 5")
		end
	end
end

alt Re: very easy lua

Starkkz
Moderator Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function Millisecs()
	return os.clock() * 1000
end

LastMovement = {}

addhook("move","moves")
function moves(id,x,y,slow)
	if slow == 1 then
		LastMovement[id] = Millisecs()
	end
end

addhook("attack","attackHook")
function attackHook(id)
	if not LastMovement[id] or Millisecs() - LastMovement[id] <= 99 then
		if player(id,"health") <= 30 then
			parse("shake "..id.." 5")
		end
	end
end

alt Re: very easy lua

karnash_btt
User Off Offline

Zitieren
Thanks this is very useful but doesnt shake when standing. Is it possible to make it shake when standing?

also can you help me doing a stun script(slow player for 3 seconds) when hit?

alt Re: very easy lua

MikuAuahDark
User Off Offline

Zitieren
just test this script:
Spoiler >

is possible to make player shake while standing, but i don't know how to make it
bdw here the stun script:
Spoiler >

i hope there no errors

alt Re: very easy lua

karnash_btt
User Off Offline

Zitieren
yes there are.
LUA ERROR: sys/lua/advancedshake.lua:13: attempt to index global 'slowplayer' (a nil value)
LUA ERROR: sys/lua/advancedshake.lua:26: attempt to index global 'slowplayer' (a nil value)

alt Re: very easy lua

MikuAuahDark
User Off Offline

Zitieren
wow i forgot something, here the fixed code:
Spoiler >

alt Re: very easy lua

karnash_btt
User Off Offline

Zitieren
thx a lot its working
*edit*
but i cant change speedmod
1× editiert, zuletzt 03.10.11 01:58:19
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht