Forum

> > CS2D > Scripts > attack hook
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch attack hook

19 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt attack hook

kalis
User Off Offline

Zitieren
hey why this lua not work ?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("attack","rp_attack")
function rp_attack(id)
	local wpn = player(id,"weapontype")
	for i = 1,32 do
		if player(i,"exists") and i ~= id then
			local x = player(i,"x")
			local y = player(i,"y")
			local x_c = player(id,"x")
			local x_c = player(id,"y")
			if (x < x_c + 64 and x > x_c - 64) and (y < y_c + 64 and y > y_c - 64)	then
					parse("shake "..i.." 50")
			end
		end
	end	
end

alt Re: attack hook

Alistaire
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("attack","rp_attack")
function rp_attack(id)
	local wpn = player(id,"weapontype")
	for i = 1,32 do
		if player(i,"exists") and i ~= id then
			local x = player(i,"x")
			local y = player(i,"y")
			local x_c = player(id,"x")
			local y_c = player(id,"y")
			if (x < x_c + 64 and x > x_c - 64) and (y < y_c + 64 and y > y_c - 64)	then
					parse("shake "..i.." 50")
			end
		end
	end	
end

You didn't make an y_c parameter thing. Just two x_c's.

alt Re: attack hook

kalis
User Off Offline

Zitieren
it not error. but dont work
@alistaire
why dont use y_c @ @?
you understand ? my lua do what?

alt Re: attack hook

kalis
User Off Offline

Zitieren
1
if (x < x_c + 64 and x > x_c - 64) and (y < y_c + 64 and y > y_c - 64)     then
i have x_c and y_c @ @

alt Re: attack hook

DannyDeth
User Off Offline

Zitieren
1
2
local x_c = player(id,"x")
local x_c = player(id,"y")
You wrote this in your script.

alt Re: attack hook

Alistaire
User Off Offline

Zitieren
user Alistaire hat geschrieben
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("attack","rp_attack")
function rp_attack(id)
	local wpn = player(id,"weapontype")
	for i = 1,32 do
		if player(i,"exists") and i ~= id then
			local x = player(i,"x")
			local y = player(i,"y")
			local x_c = player(id,"x")
			local y_c = player(id,"y")
			if (x < x_c + 64 and x > x_c - 64) and (y < y_c + 64 and y > y_c - 64)	then
					parse("shake "..i.." 50")
			end
		end
	end	
end


This one works smartass. At least it has to.

alt Re: attack hook

DannyDeth
User Off Offline

Zitieren
You did not define c_y, you did c_x twice instead of c_x and c_y, capeesh?

alt Re: attack hook

kalis
User Off Offline

Zitieren
1
(x < x_c + 64 and x > x_c - 64)
this is area -xsize (source near id will be shake)

1
(y < y_c + 64 and y> y_c + 64)
this is area -y size

alt Re: attack hook

DannyDeth
User Off Offline

Zitieren
READ YOUR CODE:
ORIGINAL CODE >

See this part:
1
2
3
4
local x = player(i,"x")
local y = player(i,"y")
local x_c = player(id,"x")
local x_c = player(id,"y")
Where is c_y in there? You did not define it. It does not exist.

@user Alistaire:
No, I shall never give up, talking to brick-walls like this guy is way too much fun.

alt Re: attack hook

kalis
User Off Offline

Zitieren
OMG
big problem @ @
i think i dont have eyes @ @
sorry all
ok thank all

alt Re: attack hook

kalis
User Off Offline

Zitieren
why i dont see it ?
it very very small problem
ok
i go to test lua

alt Re: attack hook

Black Wolf
User Off Offline

Zitieren
Please check what console say. Any errors? is this full script of your lua or just part? If you need help you should put more information about your script.

alt Re: attack hook

Alistaire
User Off Offline

Zitieren
user Black Wolf hat geschrieben
Please check what console say. Any errors? is this full script of your lua or just part? If you need help you should put more information about your script.


Bro the problem's already solved.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht