Well, ain't that great.
So, anyone can destroy your contraption by clicking on it.
NEEDS keyhook.lua (Download) on the server for this to work.
I've never tested keyhook, yet alone this particular e2, in multiplayer. So if anybody hosts their own games, then I'd be intrigued to hear whether it works ^_^
The code should destruct the e2 (and everything attached), as soon as someone right clicks it (or anything attached), with a dupe tool gun.
Code:@persist [E O]:entity if(keyClk()) { Ply = lastKeyPlayer() if(Ply != O) { Tool = Ply:tool() if(Tool == "adv_duplicator" | Tool == "duplicator") { AimEnt = Ply:aimEntity() Destruct = 0 if(AimEnt == E){Destruct = 1} elseif(E:hasConstraints()) { Constraints = E:getConstraints() for(I=1,Constraints:count()) { if(AimEnt == Constraints[I,entity]) { Destruct = 1 break } } } if(Destruct){selfDestructAll()} } } } elseif(first()|duped()) { runOnKeyAll("+attack2") E = entity() O = owner() }
SVN Tutorial
My SVN:Get dropbox and get 250 MB extra space: DropboxCode:http://divranspack.googlecode.com/svn/trunk/%20divranspack/
Its good i guess. But just for a protection its a BIT over complicated. I mean you can use a somewhat effective protection system that is one line long (even though the code CAN be edited in the adv dupe .txt file).
NO THATS THE WRONG ANSWER.
Chocolate: I'M HORNY
Chocolate: SRS
T3h: NOWAISRS
Chocolate: YASRS
T3h: SAME HIGH FIVE
Chocolate: WOOT
Chocolate: *High fives T3h*
Code:@persist TotalConstraints if( clk("check") ) { Constraints = E:hasConstraints() if ( Constraints > TotalConstraints ) { selfDestructAll() } timer("check",1000) } elseif(first()|duped()) { TotalConstraints = E:hasConstraints() timer("check",10) }
Ah, |3ulletje's method is super-sneaky. But does it get run (and duped() becomes true) before the contraption has finished duping?
Nah, this was for a finished contraption.
A finished contraption don't get more parts normally.
So when you put this code it checks the amount of parts.. If a new prop is attached by using a certain tool exploit, it deletes itself.
Pros:
Doesn't need any extention.
Cons:
Absolute useless when an admin dupes it.
But then you have been playing on the wrong server and you deserve it.
Anyway, I really don't understand all that dupe-protection crap.
What would you rather have.. some cool contraption for yourself but nobody can do more then look at it.
Or be like Generic Default. He became a living legend inside gmod. Not just because he made cool helicopters, no, he released them and they ended up in about every servers dupe folder on the planet.
Bookmarks