Forum

> > CS2D > Scripts > How can I create this script?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How can I create this script?

5 replies
To the start Previous 1 Next To the start

old Re: How can I create this script?

Mora
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
typesounds={
[30]="weapons/airstrike.ogg",
[32]="weapons/barbedwire.ogg"
}
addhook("hit","_hit")
function _hit(id,source,weapon,hpdmg,apdmg,rawdmg)
	if typesounds[weapon] then
		parse('sv_soundpos "'..typesounds[weapon]..'" '..player(id,"x")..' '..player(id,"y"))
	end
end
Try this, seems it working for me.
Oh btw, to make this script you need hit hook. ID is player who being hit by SOURCE. So im using
player(id,"y")
to parse this sounds related to his position. WEAPON is weapon of player who hit ID.
Table is made specially to recognize which weapon have which sound to be played when hit.

You can see yourself, add your weapon id in squarebrackets and set a path w/o "sfx" included.

old Re: How can I create this script?

VaiN
User Off Offline

Quote
Since your topic has such a vague title, I feel compelled to give you the obvious answer.

"How can I create this script?"

If you are asking us this question, instead of yourself, then you're doing it wrong.



And don't forget to ask the documentation too.

(At least @user Mora: was nicer than me)

old Re: How can I create this script?

light and gaia
User Off Offline

Quote
user VaiN has written
Since your topic has such a vague title, I feel compelled to give you the obvious answer.

"How can I create this script?"

If you are asking us this question, instead of yourself, then you're doing it wrong.



And don't forget to ask the documentation too.

(At least @user Mora: was nicer than me)


ok
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview