General > Developers Corner

How to restrict ENTITIES and WEAPONS?

(1/5) > >>

Samg381:
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: ---function ENT:SpawnFunction(ply, tr)    if ply:IsUserGroup("user") then
        ply:ChatPrint("You must be a donator to use this item!")
    return
end

--- End code ---



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

--- End code ---



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

--- End code ---


--- Code: ---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)

--- End code ---


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

--- End code ---



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!

lampman13:
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

Eccid:

--- Quote from: Samg381 on February 24, 2014, 05:22:31 PM ---..(I do not want to use "URS" or any other addon whatsoever)..

--- End quote ---

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).


--- Quote from: lampman13 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

--- End quote ---

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

Neku:
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.

Samg381:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version