General > Developers Corner

Groups, Props, and Tools

(1/4) > >>

Avien:
Before you say use the search function, i already have and included the threads i have found useful.  I am just unsure how to make the 3 things fit together.  I want to be able to make certain props and tools be blocked to certain groups.  Respectably, nothing limited to superadmins, and most of my things are directed toward clients.

I read the following threads:
http://forums.ulyssesmod.net/index.php/topic,682.0.html
http://forums.ulyssesmod.net/index.php/topic,858.0.html
http://forums.ulyssesmod.net/index.php/topic,721.0.html

My question is how do i put these things together in to one file, along with blocking ignite, paint, and other spammable tools to be blocked from regular clients?  I have no experience with lua and don't want to mess things up.

I know i am asking for someone to figure out what to do, but i included the threads in which the stuff i am looking for, i am just not sure how to go about putting them together and having them work the way they should

As for limiting props, do i just add the other things i want blocked after the comma in this code:

--- Code: ---{ "models/Effects/splode.mdl", }
--- End code ---

This is mainly to block TNT barrels to clients so people wont crash server with the bufferoverflow message.


I greatly appreciate any help given, as i am a total noob in lua.

JamminR:

--- Quote from: Avien on May 11, 2007, 08:52:08 PM ---
As for limiting props, do i just add the other things i want blocked after the comma in this code:

--- Code: ---{ "models/Effects/splode.mdl", }
--- End code ---

This is mainly to block TNT barrels to clients so people wont crash server with the bufferoverflow message.

--- End quote ---

Avien,
Look at page 2 of your first posted link regarding blocking larger props. It has more 'final' working code bits, and includes some example answer to your question.
Which, by the way, is yes. :)

Avien:
I saw all of this, but i want to put all the code together in one file.  Having groups where i block props for clients, such as TNT barrels, phx explosive barrels, along with the ignite tool and paint tool.  But all the examples i have included are for either props, or groups, and i have no idea how to put them together.  So i am asking for help in doing that, since i know nothing about lua.


This would work:

--- Code: ---if not SERVER then return end

local groups = { "superadmin", "admin", "opperator" } --Add your groups here

local function block_build( ply )
    for _,v in ipairs( groups ) do
        if ply:IsUserGroup( v ) then
            return
        end
    end
    ULib.tsay( ply, "You are not allowed to build." )
    return false
end
hook.Add( "PlayerSpawnProp", "block_prop", block_build )
hook.Add( "PlayerSpawnEffect", "block_effect", block_build )
hook.Add( "PlayerSpawnVehicle", "block_vehicle", block_build )
hook.Add( "PlayerSpawnSENT", "block_sent", block_build )
hook.Add( "CanTool", "block_tool", block_build )
--- End code ---

I see the block_prop, effect, vehicle, tool, etc... but i dont know where to put the things i want to block.  Do i replace the ply in
--- Code: ---block_build( ply )
--- End code ---
with the location for props, and the tools?

JamminR:
Avien, ply is the player passed to the function.
Replacing it will not help you reach your goal of banning certain players from certain props.
Adding on however might.

I'm sorry I don't have time to rewrite the code you wish.

I recommend attempting to teach yourself Lua.
www.lua.org and Google are great places to learn about lua, especially "for" loops and "tables", which, are much of what you're trying to work with for the player grouptables, and the prop list tables you don't want spawned.

Avien:
I tried asking for help on the facepunch forums, but as of now noone seems to have any idea.

Navigation

[0] Message Index

[#] Next page

Go to full version