My favorites
▼
|
Sign in
evolvemod
An advanced admin mod for Garry's Mod.
Project Home
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
417
attachment: sh_dynamicjail.lua
(3.9 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
local PLUGIN = {}
PLUGIN.Title = "Dynamic Jail"
PLUGIN.Description = "Jail a player."
PLUGIN.Author = "MDave"
PLUGIN.ChatCommand = "dyjail"
PLUGIN.Usage = "[players] [1/0]"
PLUGIN.Privileges = { "Jail" }
PLUGIN.JailCoords = {
{ model = "models/props_wasteland/interior_fence001b.mdl" , pos = Vector(0,0,0), angs = Angle(0,-90,180) },
{ model = "models/props_wasteland/interior_fence001g.mdl" , pos = Vector(0,30,0), angs = Angle(0,90,0) },
{ model = "models/props_wasteland/interior_fence001e.mdl" , pos = Vector(0,0,0), angs = Angle(0,90,0) },
{ model = "models/props_wasteland/interior_fence003d.mdl" , pos = Vector(30,0,0), angs = Angle(0,0,0) },
{ model = "models/props_wasteland/interior_fence003d.mdl" , pos = Vector(-30,0,0), angs = Angle(0,0,0) }
}
function PLUGIN:Call( ply, args )
if ( ply:EV_HasPrivilege( "Jail" ) ) then
local players = evolve:FindPlayer( args, ply, true )
local enabled = ( tonumber( args[ #args ] ) or 1 ) > 0
for _, pl in ipairs( players ) do
if ( enabled ) then
if ( !pl.EV_Jailed )then
pl.weaps = {}
for _,w in ipairs( pl:GetWeapons() )do table.insert( pl.weaps , w:GetClass() ) end
pl.jailEnts = {}
pl:ExitVehicle()
pl:StripWeapons()
pl:SetMoveType( MOVETYPE_WALK )
pl:SetCollisionGroup( COLLISION_GROUP_WEAPON )
//Build the jail:
for _,v in ipairs( self.JailCoords )do
local ent = ents.Create("prop_physics")
ent:SetModel( v.model )
ent:SetPos( v.pos + pl:GetPos() + Vector(0,0,60) )
ent:SetAngles( v.angs )
ent:SetUnFreezable(true)
ent:Spawn()
local pho = ent:GetPhysicsObject()
pho:EnableCollisions(true)
pho:EnableGravity(false)
pho:EnableMotion(false)
table.insert( pl.jailEnts , ent )
end
end
pl.EV_Jailed = true
pl:GodEnable()
else
pl.EV_Jailed = false
for _,i in ipairs( pl.jailEnts )do i:Remove() end
for _,w in ipairs( pl.weaps )do pl:Give(w) end
pl:GodDisable()
end
end
if ( #players > 0 ) then
if ( enabled ) then
evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " has jailed ", evolve.colors.red, evolve:CreatePlayerList( players ), evolve.colors.white, "." )
else
evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " has released ", evolve.colors.red, evolve:CreatePlayerList( players ), evolve.colors.white, "." )
end
else
evolve:Notify( ply, evolve.colors.red, evolve.constants.noplayers )
end
else
evolve:Notify( ply, evolve.colors.red, evolve.constants.notallowed )
end
end
function PLUGIN:CanPlayerSuicide( ply ) if ( ply.EV_Jailed ) then return false end end
function PLUGIN:PlayerUse( ply ) if ( ply.EV_Jailed ) then return false end end
function PLUGIN:PlayerNoClip( ply ) if ( ply.EV_Jailed ) then return false end end
function PLUGIN:PlayerSpawnProp( ply ) if ( ply.EV_Jailed ) then return false end end
function PLUGIN:PlayerSpawnSENT( ply ) if ( ply.EV_Jailed ) then return false end end
function PLUGIN:PlayerSpawnSWEP( ply ) if ( ply.EV_Jailed ) then return false end end
function PLUGIN:PlayerSpawnNPC( ply ) if ( ply.EV_Jailed ) then return false end end
function PLUGIN:PlayerSpawnEffect( ply ) if ( ply.EV_Jailed ) then return false end end
function PLUGIN:PlayerSpawnRagdoll( ply )if ( ply.EV_Jailed ) then return false end end
function PLUGIN:PlayerSpawnedVehicle( ply, veh )if ( ply.EV_Jailed ) then veh:Remove() end end
function PLUGIN:Menu( arg, players )
if ( arg ) then
table.insert( players, arg )
RunConsoleCommand( "ev", "dyjail", unpack( players ) )
else
return "Dynamic Jail", evolve.category.punishment, { { "Enable", 1 }, { "Disable", 0 } }
end
end
evolve:RegisterPlugin( PLUGIN )
Powered by
Google Project Hosting