Skip to content

Commit

Permalink
Fixed an error when dupe-spawning admin only NPCs without player obj
Browse files Browse the repository at this point in the history
  • Loading branch information
robotboy655 committed Jun 8, 2022
1 parent f3220da commit 4f8207b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions garrysmod/gamemodes/sandbox/gamemode/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ local function InternalSpawnNPC( ply, Position, Normal, Class, Equipment, SpawnF
return
end

local isAdmin = ply:IsAdmin() || game.SinglePlayer()
local isAdmin = ( IsValid( ply ) && ply:IsAdmin() ) || game.SinglePlayer()
if ( NPCData.AdminOnly && !isAdmin ) then return end

local bDropToFloor = false
Expand Down Expand Up @@ -687,7 +687,7 @@ AddNPCToDuplicator( "monster_sentry" )
-----------------------------------------------------------]]
local function CanPlayerSpawnSENT( ply, EntityName )

local isAdmin = ply:IsAdmin() || game.SinglePlayer()
local isAdmin = ( IsValid( ply ) && ply:IsAdmin() ) || game.SinglePlayer()

-- Make sure this is a SWEP
local sent = scripted_ents.GetStored( EntityName )
Expand Down

0 comments on commit 4f8207b

Please sign in to comment.