Forum

> > CS2D > Scripts > Again customkill
Forums overviewCS2D overview Scripts overviewLog in to reply

English Again customkill

7 replies
To the start Previous 1 Next To the start

old Again customkill

Mora
User Off Offline

Quote
Hello us
I need little help with the shit i got, customkill "weapon".
Works:
1
parse("customkill "..source.." killed "..id)
Not:
1
parse("customkill "..source.." "..player(source,"weaponname").." "..id)
the console says:
if the damage is more than hpvalue then customkill, but it's says this instead.
LUA ERROR: sys/lua/morehp.lua:14: attempt to concatenate a boolean value
 -> sys/lua/morehp.lua:14: in function <sys/lua/morehp.lua:12>
 -> in Lua hook 'hit', params: 2, 1, 46, 30, 0, 30


i just don't know why the fck it's not work.
But if i change "weaponname" to "weapon" it's will work and "weapon" will be number, but not the name of wpn.
thank you
edited 1×, last 06.08.15 01:54:37 pm

old Re: Again customkill

Rainoth
Moderator Off Offline

Quote
You're using it in hit hook which supplies weapon ID I think, why the hell would you need to access player table to get it again?
Try using item(weaponid,'name') or whatever it was.

old Re: Again customkill

Mora
User Off Offline

Quote
@user Rainoth:
1
LUA ERROR: sys/lua/morehp.lua:14: bad argument #1 to 'item' (number expected, got nil)
maybe bcs i need check who've hit "..id?

old Re: Again customkill

GeoB99
Moderator Off Offline

Quote
Alternatively, you can do this too using cs2d lua cmd itemtype to get the name of the weapon, although I am not sure if it'll work but you can try.
1
itemtype(wpn,"name")

old Re: Again customkill

Mora
User Off Offline

Quote
@user GeoB99: thank you, but i'm already fix it by myself, just ya come too fast.
Fixed bcs @user Rainoth: give me example of this.
Anyway thank you guy
/i cannot check gas mask?
example, if i have an gas mask:
if not checkitem(id,60) then

1
2
3
4
5
6
7
function checkitem (id, itemid)
     for key, item in pairs (playerweapons (id)) do
          if (item == itemid) then
               return true
          end
     end
end

old Re: Again customkill

Rainoth
Moderator Off Offline

Quote
No, you can't do that because they're technically not in your inventory and playerweapons(id) returns only weapons in your inventory.
You'll have to use
1
if player(id,'value') then
where 'value' can be 'defusekit', 'bomb', 'flag', 'gasmask' and so on.
In other words, you'll have to use player table rather than his inventory table... cs2d lua cmd player
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview