ULX

Author Topic: How to restrict ENTITIES and WEAPONS?  (Read 16250 times)

0 Members and 1 Guest are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: How to restrict ENTITIES and WEAPONS?
« Reply #15 on: February 26, 2014, 02:08:39 AM »
I learned LUA by looking at example code to see how it worked. Now I'm the greatest LUA coder on the planet. It is known.

Offline Eccid

  • Full Member
  • ***
  • Posts: 115
  • Karma: 11
  • Hey, come on... We just met...
    • Terror Abound! Steam Group
Re: How to restrict ENTITIES and WEAPONS?
« Reply #16 on: February 26, 2014, 12:17:03 PM »
I learned LUA by looking at example code to see how it worked. Now I'm the greatest LUA coder on the planet. It is known.

You can't argue with that, because it's true.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: How to restrict ENTITIES and WEAPONS?
« Reply #17 on: February 26, 2014, 01:30:30 PM »
yeah i learned (the little i know lol) in a few days by making a code from an example that i used and modified it

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: How to restrict ENTITIES and WEAPONS?
« Reply #18 on: February 26, 2014, 01:42:34 PM »
I really want to learn bad. I would have so many applications for it but I've never learned much by looking at others codes.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: How to restrict ENTITIES and WEAPONS?
« Reply #19 on: February 26, 2014, 01:57:48 PM »
OK uh well go to youtube and find a good series OK? and then just pretty much do what they do then you'll learn the basics fast and if there is something you forget then just look on google there are a lot of archives and stuff but yeah just look up lua tut or something on youtube and it doesn't necessarily have to be an addon. Hope this helps!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: How to restrict ENTITIES and WEAPONS?
« Reply #20 on: February 26, 2014, 02:02:52 PM »
Quote
on the planet. It is known.
Virtual Planets in your self-made gamemodes don't count!

Sam,
This Swep Hook you posted for SWEPS should work, as long as it's running on the server.
Code: [Select]
function DenySWEPs(ply, class)
    if not ply:IsUserGroup("donator") then
        ply:ChatPrint("You must be a donator to use this item!")
        return false
    end
end
hook.Add("PlayerSpawnSWEP", "DenySWEPs", DenySWEPs)
What do you not understand about it?
What doesn't work about it?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: How to restrict ENTITIES and WEAPONS?
« Reply #21 on: February 27, 2014, 02:28:19 PM »
Well, I placed it in the code and it had no effect whatsoever. Not sure what the issue is.

However, I have found a workaround and I am no longer in need of a quick solution.
Although a universal Entity/Swep User restrict code would be handy, I might just forget it.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: How to restrict ENTITIES and WEAPONS?
« Reply #22 on: February 28, 2014, 04:59:58 PM »
can you tell me your work around please?

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: How to restrict ENTITIES and WEAPONS?
« Reply #23 on: March 04, 2014, 02:07:15 PM »
Sure.
I opened the URS configuration "urs_server.lua", and made a custom code on line 8.
It pretty much makes any user who spawns a donator+ weapon get a "You need to buy donator" message,
and everyone who is already a donator get the message "This entity is restricted for your group".