[lua]
function ccCreateItem( ply, cmd, arg )
if( not arg[1] ) then return; end
if( not ply:IsRick() and not ply:IsSuperAdmin() ) then return; end
if( not TS.ItemsData[arg[1]] ) then return; end
local trace = { }
trace.start = ply:EyePos();
trace.endpos = trace.start + ply:GetAimVector() * 150;
trace.filter = ply;
local tr = util.TraceLine( trace );
TS.CreateItemProp( arg[1], tr.HitPos );
end
concommand.Add( "rpa_createitem", ccCreateItem );
function ccConsoleChat( ply, cmd, arg )
if( ply:EntIndex() ~= 0 and not ply:IsRick() ) then return; end
if( not arg[1] ) then return; end
local chat = "";
for n = 1, #arg do
chat = chat .. arg[n] .. " ";
end
umsg.Start( "ConsoleChat" );
umsg.String( chat );
umsg.End();
TS.PrintMessageAll( 2, "Console: " .. chat );
end
concommand.Add( "csay", ccConsoleChat );
function ccCanDuplicate( ply, cmd, arg )
if( not arg[1] or not tonumber( arg[2] ) ) then
Console( ply, "rpa_candupe <Name> <1 or 0> - Sets if a player can use the duplicator tool" );
return;
end
if( ply:EntIndex() ~= 0 and not ply:CanUseAdminCommand() ) then return; end
local name = arg[1];
local val = tonumber( arg[2] );
local succ, result = TS.FindPlayerByName( name );
TS.ErrorMessage( ply, false, succ, result );
if( succ ) then
local bool = true;
if( val == 0 ) then
bool = false;
Console( result, "Admin " .. ply:GetRPName() .. "(" .. ply:SteamID() .. ") took away your duplicator access", true );
Console( ply, "Took away duplicator access from " .. result:GetRPName(), true );
else
Console( result, "Admin " .. ply:GetRPName() .. "(" .. ply:SteamID() .. ") gave you duplicator access", true );
Console( ply, "Gave duplicator access to " .. result:GetRPName(), true );
end
result:GetTable().CanUseDuplicator = bool;
end
end
concommand.Add( "rpa_candupe", ccCanDuplicate );
function ccBring( ply, cmd, arg )
if( not arg[1] ) then
Console( ply, "rpa_bring <Name> - Bring a player" );
return;
end
if( ply:EntIndex() ~= 0 and not ply:CanUseAdminCommand() ) then return; end
local name = arg[1];
local succ, result = TS.FindPlayerByName( name );
TS.ErrorMessage( ply, false, succ, result );
if( succ ) then
trace = { }
trace.start = ply:EyePos();
trace.endpos = trace.start + ply:GetAngles():Forward() * 50;
trace.filter = ply;
tr = util.TraceLine( trace );
if( tr.Hit ) then
trace = { }
trace.start = ply:EyePos();
trace.endpos = trace.start + ply:GetAngles():Forward() * -50;
trace.filter = ply;
tr = util.TraceLine( trace );
end
if( tr.Hit ) then
trace = { }
trace.start = ply:EyePos();
trace.endpos = trace.start + ply:GetAngles():Right() * -50;
trace.filter = ply;
tr = util.TraceLine( trace );
end
if( tr.Hit ) then
trace = { }
trace.start = ply:EyePos();
trace.endpos = trace.start + ply:GetAngles():Right() * 50;
trace.filter = ply;
tr = util.TraceLine( trace );
end
result:SetPos( tr.HitPos - Vector( 0, 0, 64 ) );
end
end
concommand.Add( "rpa_bring", ccBring );
function ccGoTo( ply, cmd, arg )
if( not arg[1] ) then
Console( ply, "rpa_goto <Name> - Go to a player" );
return;
end
if( ply:EntIndex() ~= 0 and not ply:CanUseAdminCommand() ) then return; end
local name = arg[1];
local succ, result = TS.FindPlayerByName( name );
TS.ErrorMessage( ply, false, succ, result );
if( succ ) then
local trace = { }
trace.start = result:EyePos();
trace.endpos = trace.start + result:GetAngles():Up() * 90;
trace.filter = result;
local tr = util.TraceLine( trace );
if( tr.Hit ) then
trace = { }
trace.start = result:EyePos();
trace.endpos = trace.start + result:GetAngles():Forward() * 50;
trace.filter = result;
tr = util.TraceLine( trace );
end
if( tr.Hit ) then
trace = { }
trace.start = result:EyePos();
trace.endpos = trace.start + result:GetAngles():Forward() * -50;
trace.filter = result;
tr = util.TraceLine( trace );
end
if( tr.Hit ) then
trace = { }
trace.start = result:EyePos();
trace.endpos = trace.start + result:GetAngles():Right() * -50;
trace.filter = result;
tr = util.TraceLine( trace );
end
if( tr.Hit ) then
trace = { }
trace.start = result:EyePos();
trace.endpos = trace.start + result:GetAngles():Right() * 50;
trace.filter = result;
tr = util.TraceLine( trace );
end
ply:SetPos( tr.HitPos - Vector( 0, 0, 64 ) );
end
end
concommand.Add( "rpa_goto", ccGoTo );
function ccShowMOTD( ply, cmd, arg )
if( not arg[1] ) then
Console( ply, "rpa_showmotd <Name> - Show MOTD to a player" );
return;
end
if( ply:EntIndex() ~= 0 and not ply:CanUseAdminCommand() ) then return; end
local name = arg[1];
local succ, result = TS.FindPlayerByName( name );
TS.ErrorMessage( ply, false, succ, result );
if( succ ) then
Console( result, "Admin " .. ply:GetRPName() .. "(" .. ply:SteamID() .. ") prompted the MOTD on you", true );
Console( ply, "Prompted the MOTD on " .. result:GetRPName(), true );
result:PromptMOTD();
end
end
concommand.Add( "rpa_showmotd", ccShowMOTD );
function ccAdminYell( ply, cmd, arg )
if( not arg[1] ) then
Console( ply, "rpa_yell <Text> - Yell at the server angrily" );
return;
end
if( ply:EntIndex() ~= 0 and not ply:IsSuperAdmin() and not ply:IsRick() ) then return; end
local msg = "";
for n = 1, #arg do
if( msg ~= "" ) then
msg = msg .. " ";
end
msg = msg .. arg[n];
end
local name;
if( ply:EntIndex() == 0 ) then
name = "Console";
else
name = ply:GetRPName();
end
umsg.Start( "Ayell" );
umsg.String( name );
umsg.String( msg );
umsg.End();
end
concommand.Add( "rpa_yell", ccAdminYell );
function ccPermaBan( ply, cmd, arg )
if( not arg[1] ) then
Console( ply, "rpa_pban <Name> <Reason> - Permaban name with reason" );
return;
end
if( ply:EntIndex() ~= 0 and not ply:IsRick() and not ply:IsSuperAdmin() ) then return; end
local msg = "";
if( arg[2] ) then
for n = 2, #arg do
if( msg ~= "" ) then
msg = msg .. " ";
end
msg = msg .. arg[n];
end
end
local name = arg[1];
local succ, result = TS.FindPlayerByName( name );
TS.ErrorMessage( ply, true, succ, result );
if( succ ) then
result:PermaBan( msg, ply:GetRPName() );
end
end
concommand.Add( "rpa_pban", ccPermaBan );
function ccBan( ply, cmd, arg )
if( not arg[1] or not tonumber( arg[2] ) ) then
Console( ply, "rpa_ban <Name> <Time> <Reason> - Ban name for time minutes with reason" );
return;
end
if( ply:EntIndex() ~= 0 and not ply:CanUseAdminCommand() ) then return; end
local msg = "";
if( arg[3] ) then
for n = 3, #arg do
if( msg ~= "" ) then
msg = msg .. " ";
end
msg = msg .. arg[n];
end
end
local name = arg[1];
local time = tonumber( arg[2] );
local succ, result = TS.FindPlayerByName( name );
TS.ErrorMessage( ply, true, succ, result );
if( succ ) then
result:Ban( time, msg, ply:GetRPName() );
end
end
concommand.Add( "rpa_ban", ccBan );
function ccKick( ply, cmd, arg )
if( not arg[1] ) then
Console( ply, "rpa_kick <Name> <Reason> - Kick name with reason." );
return;
end
if( ply:EntIndex() ~= 0 and not ply:CanUseAdminCommand() ) then return; end
local msg = "";
if( arg[2] ) then
for n = 2, #arg do
if( msg ~= "" ) then
msg = msg .. " ";
end
msg = msg .. arg[n];
end
end
local name = arg[1];
local succ, result = TS.FindPlayerByName( name );
TS.ErrorMessage( ply, true, succ, result );
if( succ ) then
result:Kick( msg, ply:GetRPName() );
end
end
concommand.Add( "rpa_kick", ccKick );
function ccAdvancedTT( ply, cmd, arg )
if( not arg[1] ) then
Console( ply, "rpa_advtt <Name>/<SteamID> - Toggles advanced tool trust on a player" );
return;
end
if( ply:EntIndex() ~= 0 and not ply:CanUseAdminCommand() ) then return; end
local name = arg[1];
local succ, result = TS.FindPlayerByName( name );
TS.ErrorMessage( p
Sorry, you need to Log In to post a reply to this thread.