Tuto Jail personnalisé du darkrp

  • Initiateur de la discussion
MYSTY

MYSTY

Geek suprême
Messages
98
Score réaction
17
Points
120
Bonjour, j'avais vu sur un autre poste une personne qui voulais savoir si et comment on pouvez changer le model de la jail du DarkRP,
alors j'ai décidé de faire un poste tuto:
Étape 1

- Commencez à vous rendre sur votre ftp et suivez (srcds\garrysmod\gamemodes\darkrp\gamemode\modules\fadmin\fadmin\playeractions\jail)
- Choisissez le 'sv_init'

Étape 2

- Remplacez toute la page de base par sa:
Code (Je me suis inspiré de la jail nxserv):
local function Jail(ply, cmd, args) if not args[1] then return false end local targets = FAdmin.FindPlayer(args[1]) if not targets or #targets == 1 and not IsValid(targets[1]) then FAdmin.Messages.SendMessage(ply, 1, "Player not found") return false end local JailType = FAdmin.PlayerActions.JailTypes[tonumber(args[2])] or args[2] or FAdmin.PlayerActions.JailTypes[2] JailType = string.lower(JailType) local JailTime = tonumber(args[3]) or 0 local time = "" for _, target in pairs(targets) do if not IsValid(target) then continue end if not FAdmin.Access.PlayerHasPrivilege(ply, "Jail", target) then FAdmin.Messages.SendMessage(ply, 5, "No access!") return false end local jailDistance ply:ExitVehicle() local JailProps = {} if JailType == "unjail" or string.lower(cmd) == "unjail" then if target.FAdminJailProps then for k in pairs(target.FAdminJailProps) do if not IsValid(k) then continue end k:SetCanRemove(true) k:Remove() end end target.FAdminJailProps = nil timer.Remove("FAdmin_jail" .. target:UserID()) timer.Remove("FAdmin_jail_watch" .. target:UserID()) target:FAdmin_SetGlobal("fadmin_jailed", false) elseif JailType == "small" then jailDistance = 70 table.insert(JailProps, {pos = Vector(0,0,-4), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) table.insert(JailProps, {pos = Vector(0,0,0), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_curve360x2.mdl"}) table.insert(JailProps, {pos = Vector(0,0,92), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) elseif JailType == "normal" then jailDistance = 70 table.insert(JailProps, {pos = Vector(0,0,-4), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) table.insert(JailProps, {pos = Vector(0,0,0), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_curve360x2.mdl"}) table.insert(JailProps, {pos = Vector(0,0,92), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) elseif JailType == "big" then jailDistance = 100 table.insert(JailProps, {pos = Vector(0,0,-4), ang = Angle(0,0,0), model = "models/hunter/tubes/circle4x4.mdl"}) table.insert(JailProps, {pos = Vector(0,0,46), ang = Angle(0,0,0), model = "models/hunter/tubes/tube4x4x2.mdl"}) table.insert(JailProps, {pos = Vector(0,0,92), ang = Angle(0,0,0), model = "models/hunter/tubes/circle4x4.mdl"}) else FAdmin.Messages.SendMessage(ply, 5, "Bad arguments") return end if not target:FAdmin_GetGlobal("fadmin_jailed") and JailType ~= "unjail" and string.lower(cmd) ~= "unjail" then target:SetMoveType(MOVETYPE_WALK) target:FAdmin_SetGlobal("fadmin_jailed", true) target.FAdminJailPos = target:GetPos() target.FAdminJailProps = {} for _, v in pairs(JailProps) do local JailProp = ents.Create("fadmin_jail") JailProp:SetPos(target.FAdminJailPos + v.pos) JailProp:SetAngles(v.ang) JailProp:SetModel(v.model) JailProp:Spawn() JailProp:Activate() JailProp.target = target JailProp.targetPos = target.FAdminJailPos target.FAdminJailProps[JailProp] = true end if JailTime ~= 0 then timer.Create("FAdmin_jail" .. target:UserID(), JailTime, 1, function() if not IsValid(target) then return end if not target:FAdmin_GetGlobal("fadmin_jailed") then return end timer.Remove("FAdmin_jail_watch" .. target:UserID()) target:FAdmin_SetGlobal("fadmin_jailed", false) for k in pairs(target.FAdminJailProps) do if not IsValid(k) then continue end k:SetCanRemove(true) k:Remove() end target.FAdminJailProps = nil end) end jailDistance = jailDistance * jailDistance local userid = target:UserID() timer.Create("FAdmin_jail_watch" .. target:UserID(), 1, 0, function() if not IsValid(target) then timer.Remove("FAdmin_jail_watch" .. userid) return end if target:GetPos():DistToSqr(target.FAdminJailPos) > jailDistance then target:SetPos(target.FAdminJailPos) end end) time = "for " .. JailTime .. " seconds" if JailTime == 0 then time = "indefinitely" end end end if JailType == "unjail" or string.lower(cmd) == "unjail" then FAdmin.Messages.FireNotification("unjail", ply, targets) else FAdmin.Messages.FireNotification("jail", ply, targets, {JailTime}) end return true, targets, JailType, time
end
FAdmin.StartHooks["Jail"] = function() FAdmin.Commands.AddCommand("Jail", Jail) FAdmin.Commands.AddCommand("UnJail", Jail) FAdmin.Access.AddPrivilege("Jail", 2)
end
hook.Add("PlayerSpawn", "FAdmin_jail", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then timer.Simple(0.1, function() if IsValid(ply) then ply:SetPos(ply.FAdminJailPos) end end) end
end)
hook.Add("PlayerSpawnObject", "FAdmin_jailed", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then return false end
end)
hook.Add("CanPlayerEnterVehicle", "FAdmin_jailed", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then return false end
end)
--Kill stupid addons that does not call CanPlayerEnterVehicle (like Sit Anywhere script)
hook.Add("PlayerEnteredVehicle", "FAdmin_jailed", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then ply:ExitVehicle() end
end)
Étape 3
- Enregistrer & Profitez !
- les models de la jail est de la ligne (37 à 57)
- Je vous ai mis mon dossier perso car vous devez faire gaffe avec les 'jailDistance'


Question
- Postez vos avis ou question en commentaire

Support
- Support Steam: MYSTY
- Support Discord: MYSTY#5413
 
atox tm

atox tm

Geek suprême
Messages
666
Score réaction
26
Points
130
MYSTY à dit:
Étape 1
- Commencez à vous rendre sur votre ftp et suivez (srcds\garrysmod\gamemodes\darkrp\gamemode\modules\fadmin\fadmin\playeractions\jail)
- Choisissez le 'sv_init'

Étape 2

- Remplacez toute la page de base par sa:
Code (Je me suis inspiré de la jail nxserv):
local function Jail(ply, cmd, args) if not args[1] then return false end local targets = FAdmin.FindPlayer(args[1]) if not targets or #targets == 1 and not IsValid(targets[1]) then FAdmin.Messages.SendMessage(ply, 1, "Player not found") return false end local JailType = FAdmin.PlayerActions.JailTypes[tonumber(args[2])] or args[2] or FAdmin.PlayerActions.JailTypes[2] JailType = string.lower(JailType) local JailTime = tonumber(args[3]) or 0 local time = "" for _, target in pairs(targets) do if not IsValid(target) then continue end if not FAdmin.Access.PlayerHasPrivilege(ply, "Jail", target) then FAdmin.Messages.SendMessage(ply, 5, "No access!") return false end local jailDistance ply:ExitVehicle() local JailProps = {} if JailType == "unjail" or string.lower(cmd) == "unjail" then if target.FAdminJailProps then for k in pairs(target.FAdminJailProps) do if not IsValid(k) then continue end k:SetCanRemove(true) k:Remove() end end target.FAdminJailProps = nil timer.Remove("FAdmin_jail" .. target:UserID()) timer.Remove("FAdmin_jail_watch" .. target:UserID()) target:FAdmin_SetGlobal("fadmin_jailed", false) elseif JailType == "small" then jailDistance = 70 table.insert(JailProps, {pos = Vector(0,0,-4), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) table.insert(JailProps, {pos = Vector(0,0,0), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_curve360x2.mdl"}) table.insert(JailProps, {pos = Vector(0,0,92), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) elseif JailType == "normal" then jailDistance = 70 table.insert(JailProps, {pos = Vector(0,0,-4), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) table.insert(JailProps, {pos = Vector(0,0,0), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_curve360x2.mdl"}) table.insert(JailProps, {pos = Vector(0,0,92), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) elseif JailType == "big" then jailDistance = 100 table.insert(JailProps, {pos = Vector(0,0,-4), ang = Angle(0,0,0), model = "models/hunter/tubes/circle4x4.mdl"}) table.insert(JailProps, {pos = Vector(0,0,46), ang = Angle(0,0,0), model = "models/hunter/tubes/tube4x4x2.mdl"}) table.insert(JailProps, {pos = Vector(0,0,92), ang = Angle(0,0,0), model = "models/hunter/tubes/circle4x4.mdl"}) else FAdmin.Messages.SendMessage(ply, 5, "Bad arguments") return end if not target:FAdmin_GetGlobal("fadmin_jailed") and JailType ~= "unjail" and string.lower(cmd) ~= "unjail" then target:SetMoveType(MOVETYPE_WALK) target:FAdmin_SetGlobal("fadmin_jailed", true) target.FAdminJailPos = target:GetPos() target.FAdminJailProps = {} for _, v in pairs(JailProps) do local JailProp = ents.Create("fadmin_jail") JailProp:SetPos(target.FAdminJailPos + v.pos) JailProp:SetAngles(v.ang) JailProp:SetModel(v.model) JailProp:Spawn() JailProp:Activate() JailProp.target = target JailProp.targetPos = target.FAdminJailPos target.FAdminJailProps[JailProp] = true end if JailTime ~= 0 then timer.Create("FAdmin_jail" .. target:UserID(), JailTime, 1, function() if not IsValid(target) then return end if not target:FAdmin_GetGlobal("fadmin_jailed") then return end timer.Remove("FAdmin_jail_watch" .. target:UserID()) target:FAdmin_SetGlobal("fadmin_jailed", false) for k in pairs(target.FAdminJailProps) do if not IsValid(k) then continue end k:SetCanRemove(true) k:Remove() end target.FAdminJailProps = nil end) end jailDistance = jailDistance * jailDistance local userid = target:UserID() timer.Create("FAdmin_jail_watch" .. target:UserID(), 1, 0, function() if not IsValid(target) then timer.Remove("FAdmin_jail_watch" .. userid) return end if target:GetPos():DistToSqr(target.FAdminJailPos) > jailDistance then target:SetPos(target.FAdminJailPos) end end) time = "for " .. JailTime .. " seconds" if JailTime == 0 then time = "indefinitely" end end end if JailType == "unjail" or string.lower(cmd) == "unjail" then FAdmin.Messages.FireNotification("unjail", ply, targets) else FAdmin.Messages.FireNotification("jail", ply, targets, {JailTime}) end return true, targets, JailType, time
end
FAdmin.StartHooks["Jail"] = function() FAdmin.Commands.AddCommand("Jail", Jail) FAdmin.Commands.AddCommand("UnJail", Jail) FAdmin.Access.AddPrivilege("Jail", 2)
end
hook.Add("PlayerSpawn", "FAdmin_jail", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then timer.Simple(0.1, function() if IsValid(ply) then ply:SetPos(ply.FAdminJailPos) end end) end
end)
hook.Add("PlayerSpawnObject", "FAdmin_jailed", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then return false end
end)
hook.Add("CanPlayerEnterVehicle", "FAdmin_jailed", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then return false end
end)
--Kill stupid addons that does not call CanPlayerEnterVehicle (like Sit Anywhere script)
hook.Add("PlayerEnteredVehicle", "FAdmin_jailed", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then ply:ExitVehicle() end
end)
Étape 3
- Enregistrer & Profitez !
- les models de la jail est de la ligne (37 à 57)
- Je vous ai mis mon dossier perso car vous devez faire gaffe avec les 'jailDistance'


Question
- Postez vos avis ou question en commentaire

Support
- Support Steam: MYSTY
- Support Discord: MYSTY#5413
tres bon tutoriel + 1 like poto (ps ; il manque un truc c'est comment faire pour que ca mette un son quand on jail une personne voila un exemple a 4:31 :
)
 
  • Initiateur de la discussion
MYSTY

MYSTY

Geek suprême
Messages
98
Score réaction
17
Points
120
Merci et oui j'en ai pas mis pour que sa ne soit pas trop similaire à NxServ mais pour te faire plaisir, ajoute après la ligne 137:
"ply:EmitSound("le son que tu veut", 100, 100)" le son que tu veut choisis le son sur un site hl2 sound
 
  • Initiateur de la discussion
MYSTY

MYSTY

Geek suprême
Messages
98
Score réaction
17
Points
120
Excusez-moi si j'ai mis jusqu'à ligne 13 veuillez ne pas prendre en compte la première ligne de code
Code v2(Je me suis inspiré de la jail nxserv):
local function Jail(ply, cmd, args) if not args[1] then return false end local targets = FAdmin.FindPlayer(args[1]) if not targets or #targets == 1 and not IsValid(targets[1]) then FAdmin.Messages.SendMessage(ply, 1, "Player not found") return false end local JailType = FAdmin.PlayerActions.JailTypes[tonumber(args[2])] or args[2] or FAdmin.PlayerActions.JailTypes[2] JailType = string.lower(JailType) local JailTime = tonumber(args[3]) or 0 local time = "" for _, target in pairs(targets) do if not IsValid(target) then continue end if not FAdmin.Access.PlayerHasPrivilege(ply, "Jail", target) then FAdmin.Messages.SendMessage(ply, 5, "No access!") return false end local jailDistance ply:ExitVehicle() local JailProps = {} if JailType == "unjail" or string.lower(cmd) == "unjail" then if target.FAdminJailProps then for k in pairs(target.FAdminJailProps) do if not IsValid(k) then continue end k:SetCanRemove(true) k:Remove() end end target.FAdminJailProps = nil timer.Remove("FAdmin_jail" .. target:UserID()) timer.Remove("FAdmin_jail_watch" .. target:UserID()) target:FAdmin_SetGlobal("fadmin_jailed", false) elseif JailType == "small" then jailDistance = 70 table.insert(JailProps, {pos = Vector(0,0,-4), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) table.insert(JailProps, {pos = Vector(0,0,0), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_curve360x2.mdl"}) table.insert(JailProps, {pos = Vector(0,0,92), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) elseif JailType == "normal" then jailDistance = 70 table.insert(JailProps, {pos = Vector(0,0,-4), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) table.insert(JailProps, {pos = Vector(0,0,0), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_curve360x2.mdl"}) table.insert(JailProps, {pos = Vector(0,0,92), ang = Angle(0,0,0), model = "models/props_phx/construct/windows/window_angle360.mdl"}) elseif JailType == "big" then jailDistance = 100 table.insert(JailProps, {pos = Vector(0,0,-4), ang = Angle(0,0,0), model = "models/hunter/tubes/circle4x4.mdl"}) table.insert(JailProps, {pos = Vector(0,0,46), ang = Angle(0,0,0), model = "models/hunter/tubes/tube4x4x2.mdl"}) table.insert(JailProps, {pos = Vector(0,0,92), ang = Angle(0,0,0), model = "models/hunter/tubes/circle4x4.mdl"}) else FAdmin.Messages.SendMessage(ply, 5, "Bad arguments") return end if not target:FAdmin_GetGlobal("fadmin_jailed") and JailType ~= "unjail" and string.lower(cmd) ~= "unjail" then target:SetMoveType(MOVETYPE_WALK) target:FAdmin_SetGlobal("fadmin_jailed", true) target.FAdminJailPos = target:GetPos() target.FAdminJailProps = {} for _, v in pairs(JailProps) do local JailProp = ents.Create("fadmin_jail") JailProp:SetPos(target.FAdminJailPos + v.pos) JailProp:SetAngles(v.ang) JailProp:SetModel(v.model) JailProp:Spawn() JailProp:Activate() JailProp.target = target JailProp.targetPos = target.FAdminJailPos target.FAdminJailProps[JailProp] = true end if JailTime ~= 0 then timer.Create("FAdmin_jail" .. target:UserID(), JailTime, 1, function() if not IsValid(target) then return end if not target:FAdmin_GetGlobal("fadmin_jailed") then return end timer.Remove("FAdmin_jail_watch" .. target:UserID()) target:FAdmin_SetGlobal("fadmin_jailed", false) for k in pairs(target.FAdminJailProps) do if not IsValid(k) then continue end k:SetCanRemove(true) k:Remove() end target.FAdminJailProps = nil end) end jailDistance = jailDistance * jailDistance local userid = target:UserID() timer.Create("FAdmin_jail_watch" .. target:UserID(), 1, 0, function() if not IsValid(target) then timer.Remove("FAdmin_jail_watch" .. userid) return end if target:GetPos():DistToSqr(target.FAdminJailPos) > jailDistance then target:SetPos(target.FAdminJailPos) end end) time = "for " .. JailTime .. " seconds" if JailTime == 0 then time = "indefinitely" end end end if JailType == "unjail" or string.lower(cmd) == "unjail" then FAdmin.Messages.FireNotification("unjail", ply, targets) else FAdmin.Messages.FireNotification("jail", ply, targets, {JailTime}) end return true, targets, JailType, time
end
FAdmin.StartHooks["Jail"] = function() FAdmin.Commands.AddCommand("Jail", Jail) FAdmin.Commands.AddCommand("UnJail", Jail) FAdmin.Access.AddPrivilege("Jail", 2)
end
hook.Add("PlayerSpawn", "FAdmin_jail", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then timer.Simple(0.1, function() if IsValid(ply) then ply:SetPos(ply.FAdminJailPos) end end) end
end)
hook.Add("PlayerSpawnObject", "FAdmin_jailed", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then return false end
end)
hook.Add("CanPlayerEnterVehicle", "FAdmin_jailed", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then return false end
end)
--Kill stupid addons that does not call CanPlayerEnterVehicle (like Sit Anywhere script)
hook.Add("PlayerEnteredVehicle", "FAdmin_jailed", function(ply) if ply:FAdmin_GetGlobal("fadmin_jailed") then ply:ExitVehicle() end
end)
 
  • Initiateur de la discussion
MYSTY

MYSTY

Geek suprême
Messages
98
Score réaction
17
Points
120
Pour ce voudrais utiliser la jail sur ulx:
- Veuillez vous dirigez vers (srcds\garrysmod\addons\ulx\lua\ulx\modules\sh)
et ouvrez 'fun.lua'
- Remplacer la ligne de code de 361 à 598 par:
Jail Ulx:
------------------------------ Jail ------------------------------
local doJail
local jailableArea
function ulx.jail( calling_ply, target_plys, seconds, should_unjail ) local affected_plys = {} for i=1, #target_plys do local v = target_plys[ i ] if not should_unjail then if ulx.getExclusive( v, calling_ply ) then ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true ) elseif not jailableArea( v:GetPos() ) then ULib.tsayError( calling_ply, v:Nick() .. " is not in an area where a jail can be placed!", true ) else doJail( v, seconds ) table.insert( affected_plys, v ) end elseif v.jail then v.jail.unjail() v.jail = nil table.insert( affected_plys, v ) end end if not should_unjail then local str = "#A jailed #T" if seconds > 0 then str = str .. " for #i seconds" end else end
end
local jail = ulx.command( CATEGORY_NAME, "ulx jail", ulx.jail, "!jail" )
jail:addParam{ type=ULib.cmds.PlayersArg }
jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
jail:defaultAccess( ULib.ACCESS_ADMIN )
jail:help( "Jails target(s)." )
jail:setOpposite( "ulx unjail", {_, _, _, true}, "!unjail" )
------------------------------ Jail TP ------------------------------
function ulx.jailtp( calling_ply, target_ply, seconds ) local t = {} t.start = calling_ply:GetPos() + Vector( 0, 0, 32 ) -- Move them up a bit so they can travel across the ground t.endpos = calling_ply:GetPos() + calling_ply:EyeAngles():Forward() * 16384 t.filter = target_ply if target_ply ~= calling_ply then t.filter = { target_ply, calling_ply } end local tr = util.TraceEntity( t, target_ply ) local pos = tr.HitPos if ulx.getExclusive( target_ply, calling_ply ) then return elseif not target_ply:Alive() then return elseif not jailableArea( pos ) then return else target_ply.ulx_prevpos = target_ply:GetPos() target_ply.ulx_prevang = target_ply:EyeAngles() if target_ply:InVehicle() then target_ply:ExitVehicle() end target_ply:SetPos( pos ) target_ply:SetLocalVelocity( Vector( 0, 0, 0 ) ) -- Stop! doJail( target_ply, seconds ) end local str = "#A teleported and jailed #T" if seconds > 0 then str = str .. " for #i seconds" end
end
local jailtp = ulx.command( CATEGORY_NAME, "ulx jailtp", ulx.jailtp, "!jailtp" )
jailtp:addParam{ type=ULib.cmds.PlayerArg }
jailtp:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
jailtp:defaultAccess( ULib.ACCESS_ADMIN )
jailtp:help( "Teleports, then jails target(s)." )
local function jailCheck() local remove_timer = true local players = player.GetAll() for i=1, #players do local ply = players[ i ] if ply.jail then remove_timer = false end if ply.jail and (ply.jail.pos-ply:GetPos()):LengthSqr() >= 6500 then ply:SetPos( ply.jail.pos ) if ply.jail.jail_until then doJail( ply, ply.jail.jail_until - CurTime() ) else doJail( ply, 0 ) end end end if remove_timer then timer.Remove( "ULXJail" ) end
end
jailableArea = function( pos ) entList = ents.FindInBox( pos - Vector( 35, 35, 5 ), pos + Vector( 35, 35, 110 ) ) for i=1, #entList do if entList[ i ]:GetClass() == "trigger_remove" then return false end end return true
end
local mdl1 = Model( "models/props_phx/construct/windows/window_angle360.mdl" )
local mdl1l = Model( "models/props_phx/construct/windows/window_curve360x2.mdl" )
local jail = { { pos = Vector(0,0,-4), ang = Angle(0,0,0), mdl=mdl1 }, { pos = Vector(0,0,0), ang = Angle(0,0,0), mdl=mdl1l }, { pos = Vector(0,0,92), ang = Angle(0,0,0), mdl=mdl1 }
}
doJail = function( v, seconds ) if v.jail then -- They're already jailed v.jail.unjail() end if v:InVehicle() then local vehicle = v:GetParent() v:ExitVehicle() vehicle:Remove() end -- Force other players to let go of this player if v.physgunned_by then for ply, v in pairs( v.physgunned_by ) do if ply:IsValid() and ply:GetActiveWeapon():IsValid() and ply:GetActiveWeapon():GetClass() == "weapon_physgun" then ply:ConCommand( "-attack" ) end end end if v:GetMoveType() == MOVETYPE_NOCLIP then -- Take them out of noclip v:SetMoveType( MOVETYPE_WALK ) end local pos = v:GetPos() local walls = {} for _, info in ipairs( jail ) do local ent = ents.Create( "prop_physics" ) ent:SetModel( info.mdl ) ent:SetPos( pos + info.pos ) ent:SetAngles( info.ang ) ent:Spawn() ent:GetPhysicsObject():EnableMotion( false ) ent:SetMoveType( MOVETYPE_NONE ) ent.jailWall = true table.insert( walls, ent ) end local key = {} local function unjail() if not v:IsValid() or not v.jail or v.jail.key ~= key then -- Nope return end for _, ent in ipairs( walls ) do if ent:IsValid() then ent:DisallowDeleting( false ) ent:Remove() end end if not v:IsValid() then return end -- Make sure they're still connected v:DisallowNoclip( false ) v:DisallowMoving( false ) v:DisallowSpawning( false ) v:DisallowVehicles( false ) ulx.clearExclusive( v ) ulx.setNoDie( v, false ) v.jail = nil end if seconds > 0 then timer.Simple( seconds, unjail ) end local function newWall( old, new ) table.insert( walls, new ) end for _, ent in ipairs( walls ) do ent:DisallowDeleting( true, newWall ) ent:DisallowMoving( true ) end v:DisallowNoclip( true ) v:DisallowMoving( true ) v:DisallowSpawning( true ) v:DisallowVehicles( true ) v.jail = { pos=pos, unjail=unjail, key=key } if seconds > 0 then v.jail.jail_until = CurTime() + seconds end ulx.setExclusive( v, "in jail" ) ulx.setNoDie( v, true ) timer.Create( "ULXJail", 1, 0, jailCheck )
end
local function jailDisconnectedCheck( ply ) if ply.jail then ply.jail.unjail() end
end
hook.Add( "PlayerDisconnected", "ULXJailDisconnectedCheck", jailDisconnectedCheck, HOOK_MONITOR_HIGH )
local function playerPickup( ply, ent ) if CLIENT then return end if ent:IsPlayer() then ent.physgunned_by = ent.physgunned_by or {} ent.physgunned_by[ ply ] = true end
end
hook.Add( "PhysgunPickup", "ulxPlayerPickupJailCheck", playerPickup, HOOK_MONITOR_HIGH )
local function playerDrop( ply, ent ) if CLIENT then return end if ent:IsPlayer() and ent.physgunned_by then ent.physgunned_by[ ply ] = nil end
end
hook.Add( "PhysgunDrop", "ulxPlayerDropJailCheck", playerDrop )
 
atox tm

atox tm

Geek suprême
Messages
666
Score réaction
26
Points
130
MYSTY à dit:
Merci et oui j'en ai pas mis pour que sa ne soit pas trop similaire à NxServ mais pour te faire plaisir, ajoute après la ligne 137:
"ply:EmitSound("le son que tu veut", 100, 100)" le son que tu veut choisis le son sur un site hl2 sound
ca marche merci et tu ne connais pas le son du personnage dans cette video ?
(oui j'aimerai refaire la meme jail que eux je la trouve stylééé)
 
  • Initiateur de la discussion
MYSTY

MYSTY

Geek suprême
Messages
98
Score réaction
17
Points
120
J'essaye de la retrouvé et je la poste
 
atox tm

atox tm

Geek suprême
Messages
666
Score réaction
26
Points
130
Discord d'entraide
Rejoignz-nous sur Discord