mirror of
https://github.com/WillMartin03/ulx-custom-commands.git
synced 2025-03-04 03:03:14 -05:00
Bug Fixes & Changes
Changes/Fixes: - Fix bug with fbring not working / using wrong play to determine force teleport or not. Fix playerSend function logic (incorrectly used || instead of &&) - Fix fteleport not working - Remove vision change from scale command - Fix IP command not working
This commit is contained in:
parent
d26dc8790f
commit
8d82c70dcc
@ -190,18 +190,9 @@ ammo:help("Set a player's ammo");
|
||||
ammo:setOpposite("ulx setammo", {_, _, _, true}, "!setammo");
|
||||
|
||||
function ulx.scale(calling_ply, target_plys, scale)
|
||||
if (scale > 65535) then scale = 65535; end // 65535 is the max a 16 bit int can hold. Removing this and using something higher than 65535 will result in a lua error / !scale comamnd not working properly.
|
||||
for k, v in ipairs(target_plys) do
|
||||
if (SERVER && IsValid(v)) then
|
||||
if (IsValid(v)) then
|
||||
v:SetModelScale(scale, 1);
|
||||
net.Start("SendViewModelCalc");
|
||||
net.WriteInt(scale, 16);
|
||||
if (scale == 1) then
|
||||
net.WriteBool(true); // We're setting them back to normal.
|
||||
else
|
||||
net.WriteBool(false);
|
||||
end
|
||||
net.Send(v);
|
||||
end
|
||||
end
|
||||
ulx.fancyLogAdmin(calling_ply, "#A set the scale for #T to #i", target_plys, scale);
|
||||
@ -221,7 +212,6 @@ local zaptable = {
|
||||
|
||||
if (SERVER) then
|
||||
util.AddNetworkString("ulxcc_blur");
|
||||
util.AddNetworkString("SendViewModelCalc");
|
||||
elseif (CLIENT) then
|
||||
net.Receive("ulxcc_blur", function ()
|
||||
local n = 10;
|
||||
@ -240,23 +230,6 @@ elseif (CLIENT) then
|
||||
end);
|
||||
end
|
||||
end);
|
||||
net.Receive("SendViewModelCalc", function ()
|
||||
local pScale = net.ReadInt(16);
|
||||
local normal = net.ReadBool();
|
||||
if (normal) then
|
||||
hook.Remove("CalcView", "ScaleCalcView");
|
||||
else
|
||||
hook.Add("CalcView", "ScaleCalcView", function (ply, pos, angles, fov)
|
||||
local view = {
|
||||
origin = pos + Vector(0, 0, pScale * 55),
|
||||
angles = angles,
|
||||
fov = fov,
|
||||
drawviewer = false
|
||||
};
|
||||
return view;
|
||||
end);
|
||||
end
|
||||
end);
|
||||
end
|
||||
|
||||
function ulx.shock(calling_ply, target_plys, damage)
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
--This local function is required for ULX Bring to work--
|
||||
------------------------------------------------------------------------------------
|
||||
local function playerSend(from, to, force)
|
||||
if (!to:IsInWorld() || !force) then return false; end
|
||||
local function playerSend(from, to, bForce)
|
||||
if (!to:IsInWorld() && !bForce) then return false; end
|
||||
local yawF = to:EyeAngles().yaw;
|
||||
local directions = {
|
||||
math.NormalizeAngle(yawF - 180), // Behind
|
||||
@ -21,7 +21,7 @@ local function playerSend(from, to, force)
|
||||
local tr = util.TraceEntity(t, from);
|
||||
while tr.Hit do
|
||||
i = i + 1;
|
||||
if ((i > #directions) && force) then
|
||||
if ((i > #directions) && bForce) then
|
||||
from.ulx_prevpos = from:GetPos();
|
||||
from.ulx_prevang = from:EyeAngles();
|
||||
return to:GetPos() + Angle(0, directions[1], 0):Forward() * 47;
|
||||
@ -58,10 +58,9 @@ function ulx.fbring(calling_ply, target_ply)
|
||||
return;
|
||||
end
|
||||
if (calling_ply:InVehicle()) then
|
||||
ULib.tsayError(calling_ply, "Please leave the vehicle first!", true);
|
||||
return;
|
||||
calling_ply:ExitVehicle()
|
||||
end
|
||||
local newPos = playerSend(target_ply, calling_ply, target_ply:GetMoveAngles() == MOVETYPE_NOCLIP);
|
||||
local newPos = playerSend(target_ply, calling_ply, calling_ply:GetMoveType() == MOVETYPE_NOCLIP);
|
||||
if (!newPos) then
|
||||
ULib.tsayError(calling_ply, "Can't find a place to put the target!", true);
|
||||
return;
|
||||
@ -72,14 +71,13 @@ function ulx.fbring(calling_ply, target_ply)
|
||||
local newAng = (calling_ply:GetPos() - newPos):Angle();
|
||||
target_ply:SetPos(newPos);
|
||||
target_ply:SetEyeAngles(newAng);
|
||||
target_ply:SetLocalVelocity(Vector(0, 0, 0));
|
||||
target_ply:Lock();
|
||||
target_ply:Lock()
|
||||
target_ply.frozen = true;
|
||||
ulx.setExclusive(target_ply, "frozen");
|
||||
ulx.fancyLogAdmin(calling_ply, "#A brought and froze #T", target_ply);
|
||||
end
|
||||
local fbring = ulx.command("Teleport", "ulx fbring", ulx.fbring, "!fbring");
|
||||
fbring:addParam{type = ULib.cmds.PlayerArg, target = "!^"};
|
||||
fbring:addParam{type = ULib.cmds.PlayerArg};
|
||||
fbring:defaultAccess(ULib.ACCESS_ADMIN);
|
||||
fbring:help("Brings target to you and freezes them.");
|
||||
|
||||
@ -114,7 +112,7 @@ function ulx.fteleport(calling_ply, target_ply)
|
||||
target_ply:ExitVehicle();
|
||||
end
|
||||
target_ply:SetPos(pos);
|
||||
target_ply:SetLocalVelocity(Vector(0, 0, 0));
|
||||
target_ply:Lock()
|
||||
target_ply.frozen = true;
|
||||
ulx.setExclusive(target_ply, "frozen");
|
||||
ulx.fancyLogAdmin(calling_ply, "#A teleported and froze #T", target_ply);
|
||||
|
@ -529,7 +529,8 @@ function ulx.ip(calling_ply, target_ply)
|
||||
ULib.tsayError(calling_ply, "This command can only be used by admins or higher.");
|
||||
return;
|
||||
end
|
||||
calling_ply:SendLua([[SetClipboardText("]] .. tostring(string.sub(tostring(target_ply:IPAddress())), 1, string.len(tostring(target_ply:IPAddress()) - 6)) .. [[")]]);
|
||||
local ip = tostring(target_ply:IPAddress())
|
||||
calling_ply:SendLua([[SetClipboardText("]] .. tostring(string.sub(ip, 1, string.len(ip) - 6)) .. [[")]]);
|
||||
ulx.fancyLogAdmin(calling_ply, true, "#A copied the IP of #T", target_ply);
|
||||
end
|
||||
local ip = ulx.command("Utility", "ulx ip", ulx.ip, "!copyip", true);
|
||||
|
Loading…
Reference in New Issue
Block a user