English Customkill doesn't work

6 replies
Goto Page
To the start Previous 1 Next To the start
11.06.15 06:05:55 am
Up
Ridho
User
Offline Off
Hi all cookie , I was trying to make a customkill with image but found an error, here's my code
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
Code:
LUA ERROR: sys/lua/autorun/Unknown.lua:1027: attempt to call a number value

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


Thanks
Just PM me or chat (+62)8994518003 for necessary business
11.06.15 06:18:57 am
Up
Talented Doge
User
Offline Off
Code:
1
parse("customkill "..source..' "Hi, gfx/weapon1.bmp"'.." "..id)


This should work.

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


Version with custom one.

The above sentences aren't tested.
Talented Doge
11.06.15 08:06:42 am
Up
Ridho
User
Offline Off
@user Talented Doge: how to get ''..weaponname..' ?

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

because the weapon images in gfx/weapons/ is in text form
but I dont know how
Just PM me or chat (+62)8994518003 for necessary business
11.06.15 09:12:25 am
Up
Talented Doge
User
Offline Off
weaponname would possibly be the varible of the killer's weapon.

Code:
1
function _kill(k, v, wpn)


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


Same to gfx part.
Talented Doge
11.06.15 06:09:38 pm
Up
Ridho
User
Offline Off
it works, but the [+] isn't showed in beside kill image but in console.
Is that normal or some minor bug?
Code:
Player killed Doom with [+]
Just PM me or chat (+62)8994518003 for necessary business
12.06.15 03:30:14 am
Up
MikuAuahDark
User
Offline Off
to get weapon name, use cs2d lua cmd itemtype
Code:
parse("customkill "..source.." \"[+],gfx/weapons/"..itemtype(wpn,"name").."_k.bmp\" "..id)


Untested but i think that's what you want.
file cs2d LuaJIT for Dedicated Server (13) JIT POWER! | Know your Lua errors! | Part of LÖVE development team since 11.3
17.06.15 04:02:57 am
Up
Ridho
User
Offline Off
@user MikuAuahDark: still does not working, the [+] is not showed in kill images, but only in console
Just PM me or chat (+62)8994518003 for necessary business
To the start Previous 1 Next To the start