Forum

> > CS2D > Scripts > Exploding Machete
Forums overviewCS2D overview Scripts overviewLog in to reply

English Exploding Machete

6 replies
To the start Previous 1 Next To the start

old Exploding Machete

Jynxxx
User Off Offline

Quote
i need help trying to make the machete explode where ever the cursor is.
this is what i have so far, can someone help me.
1
2
3
4
5
6
7
8
9
addhook("hit","my_hit")
function my_hit(id,source,weapon,hpdmg,apdmg)
	if(weapon == 69) then
		local x = player(id,"x")
		local y = player(id,"y")
		parse("explosion "..x.." "..y.." 25 5000 "..source)
		return 1
	end
end
but every time i hit the explosion is no where to be found

old Re: Exploding Machete

EngiN33R
Moderator Off Offline

Quote
It's incorrect overall.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
cx={}
cy={}

addhook("attack","exp")
function exp(id)
	reqcld(id,2)
	parse("explosion "..cx[id].." "..cy[id].." 25 5000 "..source)
end

addhook("clientdata","reccd")
function reccd(id,mode,x,y)
	if (mode==2) then
		cx[id]=x
		cy[id]=y
	end
end

I think that should work, I'm not sure whether I got the mode right. Let me know if it doesn't work.

old Re: Exploding Machete

J4x
User Off Offline

Quote
Maybe this:
1
function exp(id)
Should be like that?
1
function exp(id,source)

old Re: Exploding Machete

Cure Pikachu
User Off Offline

Quote
@user J4x: The attack hook only has one parameter (See info.txt). So it won't work.

This one's extended from user EngiN33R's script, along with a fix.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cx={}
cy={}

addhook("attack","exp")
function exp(id)
	if player(id,"weapontype") == 69 then
		reqcld(id,2)
		parse("explosion "..cx[id].." "..cy[id].." 25 5000 "..id)
	end
end

addhook("clientdata","reccd")
function reccd(id,mode,x,y)
	if (mode==2) then
		cx[id]=x
		cy[id]=y
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview