Teleports / Lua Entities that allow use depending on USERGROUP
3 replies, posted
Hello, facepunchers. Just a quick question and a slight request, any help is appreciated!
On an old clan server of mine, they added a sign into the map (not via sourceSDK because there was no map change, must have been lua).
This sign allowed VIPs to pass through it but didn't allow guests.
Can anybody help me to determine how to check this? I know plycheckgroup etc. but I'm wondering how they made a physical sign that allowed no collision depending on a players UserGroup in lua?
If this is too difficult, on SourceSDK how can I make a trigger_teleport check for the usergroup in ULX? Is there any way?
Would anybody know how to do this? Or to help me with this?
Many thanks in advance!
You might be able to do this with the lua_run entity, but I don't know hammer too well.
Right now i'm thinking:
FindInBox-[URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexac6c.html"]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexac6c.html[/URL]
I see you already know ply:IsUserGroup("group").
What kind of sign was it? Was it a prop, or a door with a sign over it?
If you have the privilege of using source sdk (ie: access to the map directly):
You can create your own custom entity, here is an entity I created for another gamemode, it's a gravity controller, allows you to set special gravity sections, you'll get the basic idea anyways:
[lua]ENT.Base = "base_brush"
ENT.Type = "brush"
function ENT:Initialize()
self.Entity.gravity = self.Entity.gravity or 1
self.Entity.Start = self.Entity.Start or 1
self.Entity.End = self.Entity.End or 1
end
function ENT:AcceptInput( name, activator, caller, data )
if ( string.lower(name) == "start" ) then
if data == "!activator" then
activator:SetGravity(self.Entity.gravity )
end
end
if ( string.lower(name) == "end" ) then
if data == "!activator" then
activator:SetGravity(1)
end
end
return false
end
function ENT:KeyValue( key, value )
if ( key == "targetname" ) then
self.Entity:SetName(value)
end
if ( key == "gravity" ) then
self.Entity.gravity = tonumber(value)
end
if ( key == "start" ) then
self.Entity.Start = tonumber(value)
end
if ( key == "end" ) then
self.Entity.End = tonumber(value)
end
end
function ENT:StartTouch( ent )
if ent:IsValid() then
if self.Entity.Start == 1 then
ent:SetGravity(self.Entity.gravity)
end
end
end
function ENT:EndTouch( ent )
if ent:IsValid() then
if self.Entity.End == 1 then
ent:SetGravity(1)
end
end
end
[/lua]
FYI: That code would go into a file called "init.lua" in "entities/entities/<yourentityname.lua>", no need for a client side file, since it's a server sided script...
Sorry, you need to Log In to post a reply to this thread.