Forum

> > CS2D > Scripts > the weapons disappear when you die
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch the weapons disappear when you die

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt the weapons disappear when you die

jerezinho
User Off Offline

Zitieren
Hi everyone. can someone help me with this please?

I have a problem with this lua, when they kill me and I use the spawnplayer function, the things the player has disappears...

the weapons that the player who was murdered have disappeared and they do not drop.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
UTSFX=true

addhook("kill","_killer")
function _killer(killer,victim,x,y)
if UTSFX==true then
local clr
		if player(killer,"team") == 0 then -- t
			clr = "©255220000" -- t
		elseif player(killer,"team") == 1 then -- t
			clr = "©255025000" -- t
		elseif player(killer,"team") == 2 then -- ct
			clr = "©050150255" -- ct
end	
			parse("killplayer "..killer)
			msg(clr..player(killer,"name").."©255220000 YOU CAN'T KILL ANYONE NOW! TRY IN NIGHT!")
local x,y = player(victim,'x'),player(victim,'y')
parse('spawnplayer '..victim..' '..x..' '..y)
end
end
1× editiert, zuletzt 23.10.18 10:03:10

alt Re: the weapons disappear when you die

GeoB99
Moderator Off Offline

Zitieren
Instead of cs2d lua hook kill, use the cs2d lua hook die hook to allow the killed player having the items dropped. Just make sure that the source of the death was actually caused by a player and not by a different entity. Such as in this code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
UTSFX = true

function DropOnDeath(victim, killer, weapon, x, y, kobj)
  if (UTSFX == true) then
    local clr
    
    if (killer > 0) then -- Sanity check!
      -- Code here
    end
  end
  
  return 0 -- Drop the items, normally
end

addhook('die', 'DropOnDeath')
So that you can easily implement the rest of your code in a proper way without breaking things.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht