Ulysses
Ulysses Stuff => General Chat & Help and Support => Topic started by: johnlukeg on July 15, 2008, 02:08:17 PM
-
Ok... I know for a fact this has been explained before on the boards, but I've been searching for the last 15 minutes and cannot find it. Sorry if you can easily find the post for this - I just need to know what file I had to edit so I can back it up before reinstalling my server.
I recall editing a file to disable the spawning of NPCs from Clients while allowing Admins to spawn them. You had to set the maximum NPCs variable to 1 above the limit you wanted for admins, if I recall. Anyway, can anyone remember which file this is and/or what you need to do?
Or actually finding that post would be even better. I'm very sorry for bringing it up again....
-
Here you go, NOT tested:
// Dev-Solution.org and Ulyssesmod.net
local Max_User_NPC = 0 // Set this to what you want the max number of npc's spawnable to non-admins
local Max_Admin_NPC = nil // Same as above except for admins, and if you set to nil it will default to the server's max npc's
//===========================END OF CONFIG============================//
if Max_Admin_NPC == nil then
Max_Admin_NPC = GetConVarNumber("sbox_maxnpcs")
end
function Restrict_NPCS( ply, npc, weapon )
if ply:IsAdmin() or ply:IsSuperadmin() then
if not ply:CheckLimit("sbox_maxnpcs") <= Max_Admin_NPC then
return false
end
else
if not ply:CheckLimit("sbox_maxnpcs") <= Max_User_NPC then
return false
end
end
end
hook.Add("PlayerSpawnNPC", "Restict_NPCS_Hook", Restrict_NPCS )
To use:
copy and paste to a text file, then save as "anything.lua" NO QUOTES, then place the lua file in your <server>/garrysmod/lua/autorun/anything.lua
set your Max_User_NPC and your Max_Admin_NPC, and you'll be done :D
-
Thanks, I'll test it once my server finishes reinstalling. Different than what I was using, but this looks cleaner.
-
Is there any chance that this could be modified so that it would support different numbers of npc's for different groups?
-
Jay, perhaps group NPC or other entity, prop limits like this could be added to URestrict?
Seems to me that it might be a reasonable addition.
Perhaps a new tab for each major item? <wire> tab. <NPC tab>
I don't know. Just rambling right now.
All, Remember our motto though. We strive for simplicity. If it would be more difficult to incorporate into URestrict than hoped, jay could nix it.
-
Jay, perhaps group NPC or other entity, prop limits like this could be added to URestrict?
Seems to me that it might be a reasonable addition.
Perhaps a new tab for each major item? <wire> tab. <NPC tab>
I don't know. Just rambling right now.
All, Remember our motto though. We strive for simplicity. If it would be more difficult to incorporate into URestrict than hoped, jay could nix it.
-Hmm... It's do-able, but it'll be some time before I get to it with work/school.