Is there any way to take this code and make it so its not a ban prop but make it so the props listed are the only ones allowed
if SERVER then
local BannedProps = {}
function BanProp(mdl) table.insert(BannedProps, mdl) end
BanProp("models/props_combine/CombineTrain02b.mdl")
BanProp("models/props_c17/furnitureStove001a.mdl")
function CheckSpawnProp(Player, mdl)
if not BannedProps then return true end
if Player:IsAdmin() then
return false
end
for k,v in pairs(BannedProps) do
if v == mdl then Player:PrintMessage(HUD_PRINTTALK, mdl .. " is a banned prop") return true end
end
return true
end
hook.Add("PlayerSpawnProp", "PlayerSpawnPropBan", CheckSpawnProp)
end
[lua]if SERVER then
local AllowedProps = {}
function AllowProp(mdl)
table.insert(AllowedProps, mdl)
end
AllowProp("models/props_combine/CombineTrain02b.mdl")
AllowProp("models/props_c17/furnitureStove001a.mdl")
function CheckSpawnProp(ply, mdl)
if not AllowedProps then return true end
if table.HasValue(AllowedProps, mdl) or ply:IsAdmin() then
return true
end
return false
end
hook.Add("PlayerSpawnProp", "PlayerSpawnPropWhitelist", CheckSpawnProp)
end
[/lua]
I believe this is correct.
Code does what you asked for now.
Just tested it too :D.
Sorry, you need to Log In to post a reply to this thread.