Skip to content

Commit

Permalink
Fix createComponent error when superuser (#1643)
Browse files Browse the repository at this point in the history
* Fix createComponent error when superuser

* Move into block
  • Loading branch information
thegrb93 authored Feb 25, 2024
1 parent b47ce9d commit a562fb3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lua/starfall/libs_sv/prop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,12 @@ function props_library.createComponent(pos, ang, class, model, frozen)
local ply = instance.player
model = SF.CheckModel(model, ply, true)

if not ply:CheckLimit("starfall_components") then SF.Throw("Limit of components reached!", 2) end
plyPropBurst:use(ply, 1)
entList:checkuse(ply, 1)
if ply ~= SF.Superuser and gamemode.Call("PlayerSpawnSENT", ply, class)==false then SF.Throw("Another hook prevented the component from spawning", 2) end
if ply ~= SF.Superuser then
if not ply:CheckLimit("starfall_components") then SF.Throw("Limit of components reached!", 2) end
plyPropBurst:use(ply, 1)
entList:checkuse(ply, 1)
if gamemode.Call("PlayerSpawnSENT", ply, class)==false then SF.Throw("Another hook prevented the component from spawning", 2) end
end

local comp = ents.Create(class)
comp:SetPos(pos)
Expand Down

0 comments on commit a562fb3

Please sign in to comment.