Forum

> > CS2D > Scripts > Customkill doesn't work
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Customkill doesn't work

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Customkill doesn't work

Ridho
User Off Offline

Zitieren
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

alt Re: Customkill doesn't work

Talented Doge
User Off Offline

Zitieren
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.

alt Re: Customkill doesn't work

Ridho
User Off Offline

Zitieren
@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

alt Re: Customkill doesn't work

Talented Doge
User Off Offline

Zitieren
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.

alt Re: Customkill doesn't work

Ridho
User Off Offline

Zitieren
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 [+]
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht