Help with adv dup limitations

Hey guys,

I am working on a new gamemode right now that uses my RPW but with spacebuild and lifesupport3. At anyrate I wanted to add in a way where people can buy entites through the f4 rp menu and still allow people to dup up their work with OUT either allowing the entites to dupe up with the ship or not allowing entites to paste with the dup.

So is there a way I can limit what is duped like say disallowing SOME entites from duping through.

I know I can just block the entites all together but I want people to be able to buy them from the F4 menu but NOT be able to copy them with dup. This way it forces them to have to buy the entites every time they want to use them rather then just copy them from nothing.

In the shared.lua of the entity add ENT.nodupe = true
Only do that if it’s FPP.

Else you could do a entity check in the duplicator to prevent spawning.

No go, I am running FPP and added the command to the shared file of the entity but still allows people to dup it up. Is there something I have do add or remove in FPP for this to take effect?

As per your other suggestion not to sure how to do an entity check with the duplicator is that something you could either direct me to or explain how. I pick up on things really fast so if I just had a small idea of what to do I could figure it out.


King Flawless I think you might have missunderstood. My problem is not a simple tool restrict problem as I said I want people to be able to use Adv Dupe I dont want entities to be able to be duped in WITH their other items.

I am looking for a way to stop either ALL entities from being able to be pasted into the server with adv dupe or a way to list entities by name that are not allowed to be pasted in.

Thanks for the reply but that does NOTHING to help solve my issue.

Your going to need to edit the tool directly then

Please stop just saying entities, all thing in GMod are entities, props, players, guns, etc. be a little more specific. You could read the adv. duplicator code and see which function takes care of pasting, override that function, with a modified version that checks entity classes before pasting, and if the class is one you wish to not have pasted then skip it. I believe any function you’ll be looking for will be in the file, addons\AdvDuplicator\lua\autorun\server\AdvDupe.lua
right around line 2898 i found:
local function NoItems(Player, ClassName, EntTable)
if ( Player:IsAdmin( ) or Player:IsSuperAdmin() ) then return true end
if string.find(ClassName, “^weapon_.")
or string.find(ClassName, "^item_.
or string.find(ClassName, “^npc_.*”) then
MsgN(“AdvDupe: disalowing “,tostring(Player),” pasting item “,ClassName,” (NoItems Rule)”)
AdvDupe.SendClientInfoMsg(Player, “Not allowed to paste Weapons or NPCs”, true)
return false
return true
local function AddNoItems()
AdvDupe.AdminSettings.AddEntCheckHook(“AdvDupe_NoItems”, NoItems, AddNoItems)
– SNIP –

So maybe that’s a function that’s built in that may work for you, but take a read through it, it’s only 3674 lines of code. You may find undocumented functions that do what you want to do.

That took 3 min to look up.

Sorry I should be more specific. I want people to be able to buy SBEP Weapons,Gcombat and stargate entities/weapons through the f4 DarkRP buy menu (which is the easy part) but NOT be able to paste those same weapons in using adv dupe.

What you have there looks like it would be on the right track but at the same time I am just starting off on lua coding. Would something like this work:
or string.find(ClassName, “^SBEP_Weapons”)
or string.find(ClassName, “^GCOMBAT08”)

Sorry like I said im still a lua noob not sure if SBEP_Weapons would even be considered by the lua as a “ClassName”

I’m not really sure, that was just a quick look through the file, you’d have to see if any options need to be enabled for that to be called, I was just point you in a general right direction. I guess you could try it, save a backup copy of the file before you do.

Yeah I looked through the luas man I really did its not like I just came here trying to get help with out first looking. I even tried some things but I just cant get them to not paste no matter what I try. I really had just hoped someone on here might have an idea that I didnt yet try.

I am still stuck on this and I tried the above with now sucess so if anyone has any ideas please let me know I would love you for life.

ok, I just thought of another solution
function stopCreation( ent )
if ( ent:GetClass() == “some_class” ) and ent.nodupe then
SafeRemoveEntityDelayed(0, ent) – Remove next tick
hook.Add(“OnEntityCreated”, stopCreation)

Basically that will kill all entities of a certain class only if it has nodupe set, when it spawns.

[editline]5th June 2011[/editline]

set no dupe to true on everything except in the buy menu.

So could “some_class” be “SBEP_Weapons”

well are all weapons named SBEP_Weapons? if not goto the entities folder for SBEP and look at the folder names in weapons, that will tell you the class names of those weapons, they all start the same you can use **[String.match](** and check for the part that’s the same on all of them like
if !(string.match(ent:GetClass(), “part_thats_the_same”, 1) == nil) and ent.nodupe then

you may need to play with how you set the nodupe variable, basically when you buy something it should be false, other wise it should be true. Might need to edit the weapon files, I’m not sure what all variables are being set on the weapon entities. So if you edited the weapon file and in SWEP:Initialize() you set a variable called nodupe to true, then if you spawn it from the buy menu set it to false before spawning it.

well in SBEP it would be “SF-” for the most part but some are a different name all together. But I guess I could at least do the SF- class that way. Any ideas what I would do for something like GCOMBAT08 where NONE of the names are the same. Could I just list each GCOMBAT weapon folder as its own class?

yes, each folder name is the class name. Have you figured out how to get that function called, it looks like it’s part of advanced dupes admin functions, if I get some time after I finish my GCC entry i’ll take a closer look, but i’m also moving on the 14th of this month do I don’t know that i’ll get much time before then.

Nothing I seem to try works, you think there would be an easier way to stop pasting of what you dont want in a server.

email/pm the person/people who made it, since that function is there there’s gotta be a setting to make it work.