Forum

> > CS2D > Scripts > Custom Attack Machete
Forums overviewCS2D overview Scripts overviewLog in to reply

English Custom Attack Machete

9 replies
To the start Previous 1 Next To the start

old Custom Attack Machete

Blacko
User Off Offline

Quote
Hello all !
I need a script.
>When I use Machete, an explosion appear where I hit If you prefer, it's the same of RP... And just USGN list can use Machete explosion, for other it's basic Machete... Thanks for help me !
iDios.

old Re: Custom Attack Machete

Robotic-Brain
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
admins={YOUR USGN, XXXXX, YYYYY}
addhook("hit","hithook")
function hithook(id, source, weapon)
	if (searchArray(admins,source) and weapon == 69) then
		parse("explosion "..player(id,"x").." "..player(id,"y").." 64 10 "..source)
	end
end

function searchArray(array,value)
	for k,v in pairs(array) do
		if v==value then return true end
	end
	return false
end

not tested

for the oter params:
http://cs2d.com/help.php?cat=all&cmd=explosion#cmd

did you want it like that?

old Re: Custom Attack Machete

EngiN33R
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
addhook("attack","a")
function a(id)
	local rot = player(id,"rot")
        if rot < -90 then rot = rot + 360 end
	local rad = math.rad(math.abs( rot + 90 )) - math.pi
	local x = player(id,"x") + math.cos(rad) * 56
        local y = player(id,"y") + math.sin(rad) * 56
	if (player(id,"weapon")==69) then
		parse("explosion "..x.." "..y.." 64 10 "..id)
	end
end

This is the function. The explosion appears 56 pixels away from the player. You can adjust it.
I didn't put any RP functions, you'll put them yourself if you want to.

old Re: Custom Attack Machete

EngiN33R
Moderator Off Offline

Quote
Are you stupid? Just copy my code into a script and run it on your server, that's all, what didn't you understand?

old Re: Custom Attack Machete

Yates
Reviewer Off Offline

Quote
People these days, copy the script then put in this file..
counter strike-2d/sys/lua/server
Put it in there..
The "server", open it with notepad then just paste the script..
edited 1×, last 20.02.11 08:17:02 pm

old Re: Custom Attack Machete

Robotic-Brain
User Off Offline

Quote
ah of course

1
2
3
4
5
function hithook(id, source, weapon)
	if (searchArray(admins,player(source,"usgn")) and weapon == 69) then
		parse("explosion "..player(id,"x").." "..player(id,"y").." 64 10 "..source)
	end
end

i forgot to take the usgn istead the id value
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview