Forum

> > CS2D > Scripts > Again customkill
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Again customkill

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Again customkill

Mora
User Spielt CS2D

Zitieren
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
1× editiert, zuletzt 06.08.15 13:54:37

alt Re: Again customkill

Rainoth
Moderator Off Offline

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

alt Re: Again customkill

Mora
User Spielt CS2D

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

alt Re: Again customkill

GeoB99
Moderator Off Offline

Zitieren
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")

alt Re: Again customkill

Mora
User Spielt CS2D

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

alt Re: Again customkill

Rainoth
Moderator Off Offline

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