Forum

> > CS2D > Scripts > Customkill doesn't work
Forums overviewCS2D overview Scripts overviewLog in to reply

English Customkill doesn't work

6 replies
To the start Previous 1 Next To the start

old Customkill doesn't work

Ridho
User Off Offline

Quote
Hi all cookie , I was trying to make a customkill with image but found an error, here's my code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("hit","dmgweapon_")
function dmgweapon_(id,source,wpn,hpdmg,apdmg)
  local angok=hpdmg*1.5
  local hpleft = player(id,"health")-angok
  if damage[source]==true and wpn<=91 then
    if player(source,"team") ~= player(id,"team") then
      if player(id,"health")>angok then
        parse("sethealth "..id.." "..hpleft)
        return 1
      else
        parse('customkill '..source..' "[+],gfx/weapons/'..player(source,"weapontype")"name"..'_k.bmp" '..id)
      end
    end
  end
end

when I run my script, the [+] isn't appeared but just the kill image, although my player character met all the conditional

I found this error written in console
LUA ERROR: sys/lua/autorun/Unknown.lua:1027: attempt to call a number value

line 1027 is in
parse('customkill '..source..' "[+],gfx/weapons/'..player(source,"weapontype")"name"..'_k.bmp" '..id)


Thanks

old Re: Customkill doesn't work

Talented Doge
User Off Offline

Quote
1
parse("customkill "..source..' "Hi, gfx/weapon1.bmp"'.." "..id)

This should work.

1
parse("customkill "..source..' "'..weaponname', gfx/'..weaponname..'.bmp"'.." "..id)

Version with custom one.

The above sentences aren't tested.

old Re: Customkill doesn't work

Ridho
User Off Offline

Quote
@user Talented Doge: how to get ''..weaponname..' ?

I want to use images from gfx/weapons/here
I used
"[+],'..(player(id,"weapon")"name")..'"

because the weapon images in gfx/weapons/ is in text form
but I dont know how

old Re: Customkill doesn't work

Talented Doge
User Off Offline

Quote
weaponname would possibly be the varible of the killer's weapon.

1
function _kill(k, v, wpn)

In this case just change weaponname to
1
itemtype(wpn, "name)

Same to gfx part.

old Re: Customkill doesn't work

Ridho
User Off Offline

Quote
it works, but the [+] isn't showed in beside kill image but in console.
Is that normal or some minor bug?
Player killed Doom with [+]
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview