Skip to content

Commit 2bf4402

Browse files
authored
Merge pull request #359 from GMLambda/weapon-respawn
Fix player weapons respawning
2 parents 241d5b4 + 706afa9 commit 2bf4402

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- Fixed: Level transition can carry some unwanted entities to the next map.
2020
- Fixed: d2_coast_08: Incorrect player spawn when directly starting from this map.
2121
- Fixed: Compatibility with addons that use GM:AddDeathNotice, this caused errors to appear.
22+
- Fixed: Weapons from players respawning when picked up.
2223

2324
0.9.27
2425
- Fixed: Entity inputs/outputs are parsed incorrect.

gamemode/sv_player_pickup.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ function GM:PlayerCanPickupItem(ply, item)
197197
DbgPrintPickup("PlayerCanPickupItem", ply, item)
198198

199199
if item.CreatedForPlayer ~= nil then
200-
if item.CreatedForPlayer == ply then
200+
if item.CreatedForPlayer == ply or item.CreatedForPlayer == NULL then
201201
DbgPrintPickup("Simple pickup, created for player: " .. tostring(ply))
202202

203203
return true
@@ -252,7 +252,7 @@ function GM:PlayerCanPickupWeapon(ply, wep)
252252
end
253253

254254
if wep.CreatedForPlayer ~= nil then
255-
if wep.CreatedForPlayer == ply then
255+
if wep.CreatedForPlayer == ply or wep.CreatedForPlayer == NULL then
256256
DbgPrintPickup(ply, "Simple pickup, created for player")
257257

258258
return true
@@ -311,7 +311,7 @@ function GM:WeaponEquip(wep, owner)
311311
end
312312
end
313313

314-
if wep.CreatedForPlayer ~= owner and wep.DroppedByPlayer == nil then
314+
if wep.CreatedForPlayer == nil and wep.DroppedByPlayer == nil then
315315
if AMMO_LIKE_WEAPONS[wep:GetClass()] ~= true and self:CallGameTypeFunc("ShouldRespawnWeapon", wep) == true then
316316
local respawnTime = self:CallGameTypeFunc("GetWeaponRespawnTime") or 0.5
317317

@@ -321,5 +321,5 @@ function GM:WeaponEquip(wep, owner)
321321
end
322322
end
323323

324-
wep.CreatedForPlayer = nil
324+
wep.CreatedForPlayer = NULL
325325
end

0 commit comments

Comments
 (0)