Forum

> > CS2D > Scripts > Killing with weapon name
Forums overviewCS2D overview Scripts overviewLog in to reply

English Killing with weapon name

11 replies
To the start Previous 1 Next To the start

old Re: Killing with weapon name

DC
Admin Off Offline

Quote
You don't need scripts for that. It's a simple setting. cs2d cmd deathnoticeimg

In the options menu just disable "Use Images for Death Notices"
IMG:https://snag.gy/IchTPA.jpg



If you still want to do it with scripts however, so everybody on the server sees it with text, you could do some magic with cs2d lua hook hit (prevent normal death using return 1) and cs2d cmd customkill

old Re: Killing with weapon name

Hidder
BANNED Off Offline

Quote
@user DC:

ok thanks

but how to make it if he got killed from chainsaw ? i know how to do customkill but i don't know how to make it especially for chainsaw

old Re: Killing with weapon name

DC
Admin Off Offline

Quote
As I said: Use the cs2d lua hook hit hook and...

• check if the weapon is the chainsaw
weapon == 85

• check if the player would be killed by that hit
player(id, "health")<=hpdmg

• if both is true:
customkill(source, item(weapon, "name"), id)
and
return 1
to cancel the normal killing

Not tested but this is how it should work.
The part
item(weapon, "name")
just retrieves the name of the chainsaw. You could replace it with
"Chainsaw"
directly or any other string you would like to see.

old Re: Killing with weapon name

Hidder
BANNED Off Offline

Quote
@user DC:

DC plz understand me, my way to learn is NOT reading
My best way to learn is editing, i really hate reading so much
can you send for me the whole code plz ???

old Re: Killing with weapon name

Starkkz
Moderator Off Offline

Quote
@user Hidder: Don't be lazy, he already spent a good time trying to make you understand.

If you really wish to get free code you shall make it yourself. You can see youtube tutorials out there if you want to learn Lua by editing without having to read.

old Re: Killing with weapon name

Hidder
BANNED Off Offline

Quote
@user Starkkz:
I learned all thing about scripting from editing ._.
Do you know i didn't even spent 5 min on reading to learn scripts ?
Its not lazy or something, i hate reading at all

old Re: Killing with weapon name

DC
Admin Off Offline

Quote
I basically gave you the whole code already.
All you still need to do is:
• write it in a function which has the same parameters as the cs2d lua hook hit hook
• make an if condition with an
and
as described in my previous post
• add that function to the cs2d lua hook hit hook via cs2d lua cmd addhook

A little bit trial and error and looking at other scripts (and/or a basic Lua tutorial) and you should be able to do it
It's less than 10 lines.

If you don't manage to do it you didn't understand how Lua / CS2D hooks work. This is not a bad thing but if you want to write scripts you should learn it

So please just try and if you run into problems just ask. We'll then try to help you.

old Re: Killing with weapon name

TrialAndError
User Off Offline

Quote
user Hidder has written
I learned all thing about scripting from editing ._.


This is said everywhere and that is the lazy mans saying. The only way to "learn" is actually trying it yourself and experimenting. Sure, editing will help you a bit along the way, but you can't just look at the Empire State Building and say "Hey, now I know how to build a house!".

old Re: Killing with weapon name

Hidder
BANNED Off Offline

Quote
ugh! don't worry now i know how 2 do it
i download burn molotov script and i edited it to know how ._.
i don't need help about this script any more :3
and i didn't read anything
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview