ULX

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

0 Members and 1 Guest are viewing this topic.

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
How to restrict ENTITIES and WEAPONS?
« on: February 24, 2014, 05:22:31 PM »
For about a year now this question has yet to be answered. I've tried asking experts, lua coders, friends, almost everybody who could have expertise.
All the answers and codes that I have received have not worked. Not a single one.

The question is:
How do I restrict Weapons, and Entities on a server based upon a ULX rank with lua code?
(I do not want to use "URS" or any other addon whatsoever)

Whenever I try a new code, either I get errors, or the code has absolutely no effect whatsoever.
Some of these are for entities and some are for weapons. Nevertheless, they all don't work.

Here are all the codes that have failed:

Code: [Select]
function ENT:SpawnFunction(ply, tr)    if ply:IsUserGroup("user") then
        ply:ChatPrint("You must be a donator to use this item!")
    return
end


Code: [Select]
if not ply:IsUserGroup("donator") thenply:ChatPrint("You must be a donator to use this item!")
     return
end


Code: [Select]
function checkAdmin(ply)
     if not ply:IsUserGroup("donator") then
ply:ChatPrint("You must be a donator to use this item!")
    end
end

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)

Code: [Select]
function checkAdmin(ply)
     if not ply:IsUserGroup("donator") then
    ply:ChatPrint("You must be a donator to use this item!")
    end
end



I am looking for somebody who would be kind enough to assist me in making a code that works.
All codes that I posted above are free game, but individually they are about as useful as a '--'.
I don't care how it is written, or how complex the code is. I need to get this working period.
As an added bonus, if you could help explain what you did and how the code works I'd be very appreciative.
I am a novice coder and I need to learn about this stuff in order to expand my knowledge.

Sorry for the rant.
Thanks in advance!

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: How to restrict ENTITIES and WEAPONS?
« Reply #1 on: February 24, 2014, 06:24:12 PM »
i am the same way im new but everyone says try something simpler but i dont thing you can get much simpler than a 20 line code and they keep saying you need to learn before i can do that but i cant learn without trying i dont work that way lol but i failed to help you i am sorry i tryed a few things but i guess you need someone smarter than me :/ sorry i couldnt help

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 #2 on: February 24, 2014, 09:09:41 PM »
..(I do not want to use "URS" or any other addon whatsoever)..

Why? It's what you're looking for, exactly, and is already written/free to use. Are you looking for someone to help you make something to sell or something? It seems strange that you refuse to use the one system that works (and seem to think that these experts can't figure it out, considering it exists).

i am the same way im new but everyone says try something simpler but i dont thing you can get much simpler than a 20 line code and they keep saying you need to learn before i can do that but i cant learn without trying i dont work that way lol but i failed to help you i am sorry i tryed a few things but i guess you need someone smarter than me :/ sorry i couldnt help

Who cares if it's 20 lines of code or 200, as long as it works?

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: How to restrict ENTITIES and WEAPONS?
« Reply #3 on: February 24, 2014, 10:44:19 PM »
I don't understand why you wouldn't use URS.

And I can see you want to understand how to do it as well.
Just download URS and crack up the Lua file open.

Open up notepad or whatever else you're using to code, and start typing every line of code by hand.

You'll need to understand the basics first, though.
Out of the Garry's Mod business.

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: How to restrict ENTITIES and WEAPONS?
« Reply #4 on: February 25, 2014, 03:59:48 AM »
I do not want to use URS for a variety of reasons, predominantly the inability to change the message that appears when an entity has been blocked.
I'm not going to change the URS blocked message because I use it for other entities.

I would like to lua code. Not URS. If I wanted to URS I would have already done so. There is nothing you can say to make me think otherwise.
I'm looking for a lua code that is compatible with Garry's Mod 13 that will block entities and weapons via ULX ranks.
« Last Edit: February 25, 2014, 04:01:46 AM by Samg381 »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: How to restrict ENTITIES and WEAPONS?
« Reply #5 on: February 25, 2014, 06:22:57 AM »
As stated above, if you don't want to use URS, at least look and see how it restricts so you understand why your approach isn't working.
Experiencing God's grace one day at a time.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: How to restrict ENTITIES and WEAPONS?
« Reply #6 on: February 25, 2014, 12:35:52 PM »
hey if you REALLY really wanted to it is possible to change it you just have to have a little bit of lua knowlege and know what goes where and what does what :P

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: How to restrict ENTITIES and WEAPONS?
« Reply #7 on: February 25, 2014, 12:44:21 PM »
hey if you REALLY really wanted to it is possible to change it you just have to have a little bit of lua knowlege and know what goes where and what does what :P


That's why I'm asking someone to help.

Offline lynx

  • Jr. Member
  • **
  • Posts: 59
  • Karma: 15
Re: How to restrict ENTITIES and WEAPONS?
« Reply #8 on: February 25, 2014, 01:05:32 PM »
As multiple people have stated so far, get URS. You don't have to use it, but if you want to learn then learn by example. Look through the code in URS, see what it uses to make deny happen. Then adapt that to your own wants and needs.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: How to restrict ENTITIES and WEAPONS?
« Reply #9 on: February 25, 2014, 02:06:34 PM »

That's why I'm asking someone to help.
sorry i meant you could change the urs user msg but if that is the only reason cant you get past that i mean it is working and you dont have to do anything :) but if you dont want it then thats whatever i mean but you can probably get some knowlege from google :P or lua tuts like if you watch the gamemode lua tuts it takes awhile but when you make it its kinda basic but you know alot of lua :)

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: How to restrict ENTITIES and WEAPONS?
« Reply #10 on: February 25, 2014, 02:21:41 PM »
I do not want to use URS for a variety of reasons, predominantly the inability to change the message that appears when an entity has been blocked.
I'm not going to change the URS blocked message because I use it for other entities.

I would like to lua code. Not URS. If I wanted to URS I would have already done so. There is nothing you can say to make me think otherwise.
I'm looking for a lua code that is compatible with Garry's Mod 13 that will block entities and weapons via ULX ranks.
Hey there's this cool addon called URS, don't know if you have heard of it but you might want to check it out. It's exactly what you need and you can even change the message that appears when you try to spawn an entity.

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 #11 on: February 25, 2014, 04:49:42 PM »
Hey there's this cool addon called URS, don't know if you have heard of it but you might want to check it out. It's exactly what you need and you can even change the message that appears when you try to spawn an entity.

This guy knows what's up.

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 #12 on: February 25, 2014, 07:12:35 PM »
Just to be clear Samg, most of us aren't asking you to USE URS.
We're suggesting you review the code in URS to see how it ticks.

Overall, it uses the same hooks and checks for ULib groups any other code would.

Best way to learn...by example.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: How to restrict ENTITIES and WEAPONS?
« Reply #13 on: February 25, 2014, 07:15:28 PM »
tl;dr Download URS. Do not use. Look at code.
Out of the Garry's Mod business.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: How to restrict ENTITIES and WEAPONS?
« Reply #14 on: February 25, 2014, 07:21:40 PM »
Just to be clear Samg, most of us aren't asking you to USE URS.
We're suggesting you review the code in URS to see how it ticks.

Overall, it uses the same hooks and checks for ULib groups any other code would.

Best way to learn...by example.
And by doing it yourself(meaning you cant learn by watching you can only learn by doin) :P