--
-- The noclip command.
--
local command = {}
command.help = "Toggle noclip mode."
command.command = "noclip"
command.permissions = "Noclip";
command.arguments = {"player"};
command.immunity = SERVERGUARD.IMMUNITY.LESSOREQUAL;
command.bDisallowConsole = true;
function command:OnPlayerExecute(player, target, arguments)
if (target:GetMoveType() != MOVETYPE_NOCLIP) then
target:SetMoveType(MOVETYPE_NOCLIP);
/////////////////////////////////////////////////////////////наш код клока
target:SetNoDraw(false);
target:SetNotSolid(false);
target:GodDisable();
target:DrawWorldModel(true);
target.sg_invisible = false;
self:CloakHooks()
/////////////////////////////////////////////////////////////
else
target:SetMoveType(MOVETYPE_WALK);
/////////////////////////////////////////////////////////////тоже код клока
target:SetNoDraw(true);
target:SetNotSolid(true);
target:GodEnable();
target:DrawWorldModel(false);
target.sg_invisible = true;
self:CloakHooks()
/////////////////////////////////////////////////////////////
end;
return true;
end;
function command:OnNotify(player, targets)
return SGPF("command_noclip", serverguard.player:GetName(player), util.GetNotifyListForTargets(targets));
end;
hook.Add("PlayerNoClip", "serverguard.PlayerNoClip", function(player)
if (player.sg_jail or player:GetNetworkedBool("serverguard_jailed", false)) then
return false;
end;
if (serverguard.player:HasPermission(player, "Noclip")) then
return true;
end;
end);
function command:ContextMenu(player, menu, rankData)
local option = menu:AddOption("Toggle Noclip", function()
serverguard.command.Run("noclip", false, player:Name());
end);
option:SetImage("icon16/arrow_up.png");
end;
serverguard.command:Add(command);