Ulysses

General => Developers Corner => Topic started by: ihasaaccount on September 06, 2009, 07:47:17 AM

Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: ihasaaccount on September 06, 2009, 07:47:17 AM
Please fix it so you can restrict your tools with Darkrp..
Please fix it so you can restrict your tools with Darkrp..
Please fix it so you can restrict your tools with Darkrp..
Please fix it so you can restrict your tools with Darkrp..



[NOTICE] - User was banned 7 days for this post. Once would have been plenty.
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: jay209015 on September 06, 2009, 09:01:55 AM
Ok, after a lot of research, I found the problem and came up with a solution.

In the attachment  there are three .lua files.
     physgunlimiter.lua
     sv_gamemode_functions.lua
     sv_init.lua

physgunlimiter.lua and sv_gamemode_functions.lua both go into your <server>/gamemode/DarkRP/gamemode folder and when prompted to replace say yes.
sv_init. lua goes into your <server>/gamemode/DarkRP/gamemode/SPropProtection and when prompted to replace say yes.

::EDIT::
For the record, this wasn't the fault of URestrict, the coder of DarkRP made the beginner mistake of returning true instead of just returning so other scripts don't get broken.
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: JamminR on September 06, 2009, 09:37:56 AM
came up with a solution.

Best solution, don't use it.
We as a team have said it before, and I'll say it again.
We even have a news release in which there were several exploits for one of the versions.
DarkRP is rubbish. Each new release by totally different authors have made it just as much broken, if not more, than the last release by someone else.
It amazes me, as much as RP seems popular on Gmod, that a decent lua coder hasn't made an RP game mode from scratch.
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Megiddo on September 06, 2009, 12:44:34 PM
Best solution, don't use it.
We as a team have said it before, and I'll say it again.
We even have a news release in which there were several exploits for one of the versions.
DarkRP is rubbish. Each new release by totally different authors have made it just as much broken, if not more, than the last release by someone else.
It amazes me, as much as RP seems popular on Gmod, that a decent lua coder hasn't made an RP game mode from scratch.


I don't think many decent coders like RP. :P
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Drakehawke on September 06, 2009, 01:09:00 PM
Could you please post exactly what you did to those files? I have customized DarkRP loads and also im using the SVN version by Falco, which uses FPP (Falco's Prop Protection), so it may be different. Sorry to be a pain.
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: jay209015 on September 06, 2009, 01:28:27 PM
Simply look at my files compared to yours.
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Drakehawke on September 06, 2009, 01:36:11 PM
Yes but, for me, physgunlimiter.lua and sv_init.lua dont exist. Im currently going to make the changes to sv_gamemode_functions.lua, and see if that helps.
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: jay209015 on September 06, 2009, 01:55:54 PM
Well, look anywhere that the author calls the CanTool hook and see if it returns true anywhere and if it does, make it just return
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Drakehawke on September 06, 2009, 02:06:07 PM
So wherever I find "return true" in the CanTool hooks, I change it to just "return"?
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Drakehawke on September 07, 2009, 10:23:43 AM
Ugh, just updated DarkRP for a different bug fix, the CanTool thing now does this:
Code: [Select]
...
end
return GAMEMODE:CanTool(ply, trace, tool)
end
hook.Add("CanTool", "FPP.Protect.CanTool", FPP.Protect.CanTool)

Do I still have to make it just return? Or will it work now?
Title: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: JamminR on September 07, 2009, 11:38:53 AM
Ugh. The more I see darkRP code, the more I cringe.
Drake, the DarkRP advice is far beyond the scope of this discussion for URestrict.
I'm splitting the conversation to the Developer's corner forum area.
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: atomicspark on September 07, 2009, 01:36:30 PM
Ok, after a lot of research, I found the problem and came up with a solution.

In the attachment  there are three .lua files.
     physgunlimiter.lua
     sv_gamemode_functions.lua
     sv_init.lua

physgunlimiter.lua and sv_gamemode_functions.lua both go into your <server>/gamemode/DarkRP/gamemode folder and when prompted to replace say yes.
sv_init. lua goes into your <server>/gamemode/DarkRP/gamemode/SPropProtection and when prompted to replace say yes.

::EDIT::
For the record, this wasn't the fault of URestrict, the coder of DarkRP made the beginner mistake of returning true instead of just returning so other scripts don't get broken.

Just in case you didn't know this already, Garry's Mod has a "physgun_limited" console command that when set to "1", protects world entities. I have only tested it on doors, but it seems to work very well. It doesn't even let you attempt to grab it, almost like the door isn't there. It's a nice feature to have enabled just in case your prop protection or gamemode script decides to implode.
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: jay209015 on September 07, 2009, 02:29:57 PM
...
Code: [Select]
...
end
return GAMEMODE:CanTool(ply, trace, tool)
end
hook.Add("CanTool", "FPP.Protect.CanTool", FPP.Protect.CanTool)

...
     - Is this just me or is he calling a hook within itself?
Ugh. The more I see darkRP code, the more I cringe.
...
     - Agree 100%
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: atomicspark on September 07, 2009, 03:12:35 PM
Ulysses RP?

I never understood the interest in RP gamemodes. It really just ends up being a cost system applied to weapons.
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Drakehawke on September 08, 2009, 03:38:32 PM
Will URestrict still work with this hook within itself, or do I still need to make it just return?
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: JamminR on September 08, 2009, 03:51:33 PM
Drake, difficult to really know.
Worth trying.
Problem is, with the way DarkRP is coded, if you change it to only 'return', you may break it or other scripts.
Tip for all Gmod lua coders - returning anything, even 'true', breaks 99% of most Gmod standard hooks.
It will in most cases prevent any other hook of the same type in other scripts from running.
Yes, sometimes that is wanted (returning false, etc), but in most you don't.

There are exceptions to this rule of course, but, not many.
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Drakehawke on September 17, 2009, 02:45:51 PM
Been very busy lately, and ive finally got round to trying to fix this.

Making all the CanTool functions not return at all, URestrict still dosn't work.
Making all the CanTool functions just return, URestrict Works :), Prop Protection breaks completely :-\.

Any ideas?
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: JamminR on September 17, 2009, 04:09:53 PM
Any ideas?

Find a better coded RP script? :/
Sorry, DarkRP just isn't coded well, and has been rehashed so many times by so many attempts of people who thought they could do better, that often didn't I'm betting, that I'm not sure a version exists that doesn't have major flaw somewhere.

Is there one out there?
I've no idea.

What Prop protect do you use? Are you talking of DarkRPs?
Did you edit your prop protect too?
Returning something sometimes is a good thing...just not as often as many seem to do.
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Drakehawke on September 18, 2009, 08:03:52 AM
Im using FPP (Falco's Prop Protection), Falco being the current updater of it. It comes with the DarkRP SVN, but you can download it seperately.
I have edited it as Jay told me to make any CanTool function not return true.
A guy on the DarkRP thread told me that he had got URestrict working without having to edit FPP, and only the CanTool in sv_gamemode_functions, this is the next thing im going to try.
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Drakehawke on September 18, 2009, 10:38:33 AM
Nevermind all of this, Falcos about to release an update to DarkRP with the ability to restrict tools to admins or superadmins.
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: jay209015 on September 18, 2009, 10:43:12 AM
You know Falco's steam nick?
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Drakehawke on September 18, 2009, 10:47:27 AM
No, I don't. But whatever he does to make his system work, should also automatically make URestrict work.
http://www.facepunch.com/showthread.php?t=778336&page=21
Thats the DarkRP thread, you can speak to him through there, his name on Facepunch is FPtje.
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: Jay on October 30, 2009, 11:48:37 PM
i think changing:
Quote
ur.config["loadouts"] = true
to
Quote
ur.config["loadouts"] = false

The loadouts seem to be giving me the problems. like   if you disable them all with the GUI in the game     people can spawn guns     but   with it enabled     no one spawned with keys, arrest stick, and so on.    disabling this may be the trick   ill let you know tomorow



not sure on that one.
Title: Re: DarkRP re: Urestrict - and anything else DarkRP breaks
Post by: jay209015 on October 31, 2009, 12:25:52 AM
That wont help at all, it would just reverse the effects of disabling it in the gui. To make it work, you have to add the keys, arrest stick, .... to the loadouts.