ULX

Author Topic: ULX Clear Decals Command  (Read 18348 times)

0 Members and 1 Guest are viewing this topic.

Offline strategos

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 2
  • I wanna be the guy
    • Community
ULX Clear Decals Command
« on: December 27, 2011, 02:48:24 AM »
I am trying to make a command that clears decals and also shows up as $user has ran the command in chat. However, it doesn't work and there are no errors in console :(

Code: [Select]
-- ULX Cleanup by Strategos

local function ClearDecals(ply, cmd, args)

for k,v in pairs(player.GetAll()) do
v:ConCommand("r_cleardecals")
end

ulx.fancyLogAdmin( ply, true, "#A has cleared all the decals" )

end

local ClearDecals = ulx.command( "Utility", "Clear Decals", ClearDecals, "!clear" )
ClearDecals:defaultAccess( ULib.ACCESS_ADMIN )
ClearDecals:help( "Clears Decals." )

Offline JackYack13

  • Newbie
  • *
  • Posts: 28
  • Karma: -1
Re: ULX Clear Decals Command
« Reply #1 on: December 27, 2011, 02:30:01 PM »
Code: [Select]
local function ClearDecals(ply)
  for k, v in pairs(player.GetAll()) do
    v:ConCommand("r_cleardecals")
  end
  ulx.fancyLogAdmin(ply, "#A has cleared all the decals.")
end
local cmd_ClearDecals= ulx.command("Utility", "clear decals", ClearDecals, "!clear")
cmd_ClearDecals:defaultAccess(ULib.ACCESS_ADMIN)
cmd_ClearDecals:help("Clears decals.")

This should work.

Your function and variable containing the command info had the same name. Also, you had some unneeded arguments in the function.
« Last Edit: December 27, 2011, 02:32:33 PM by JackYack13 »

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: ULX Clear Decals Command
« Reply #2 on: December 27, 2011, 02:56:54 PM »
If it still doesn't work, try taking the local out ("local function" to "function").  If it still doesn't work, try renaming the function to "ulx.cleardecals".  I'm not sure if they matter, but just some tips if it doesn't.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: ULX Clear Decals Command
« Reply #3 on: December 27, 2011, 09:39:09 PM »
The command has already been made, and is included in...

http://forums.ulyssesmod.net/index.php/topic,5427.0.html
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Clear Decals Command
« Reply #4 on: December 29, 2011, 07:17:11 AM »
Re: It being included in UPS Menu - but don't let that stop anyone from experimenting/learning how to do it through the Glua and the ULX command structure of this discussion.
Though Hellfox's release is great and allows for addition to UPS settings, and includes a few bonus features such as the cleardecal function...sometimes, something as simple as this one command may be all you want, without the addition of UPS and Hellfox's UPS Menu. (You may use another prop protector..your choice (but why would you not use the best?! :P)
« Last Edit: December 29, 2011, 01:21:30 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: ULX Clear Decals Command
« Reply #5 on: December 29, 2011, 12:48:22 PM »
Re: It being included in UPS Menu - but don't let that stop anyone from experimenting/learning how to do it through the Glua and the ULX command structure of this discussion.
Though Hellboy's release is great and allows for addition to UPS settings, and includes a few bonus features such as the cleardecal function...sometimes, something as simple as this one command may be all you want, without the addition of UPS and Hellboy's UPS Menu. (You may use another prop protector..your choice (but why would you not use the best?! :P)

Sorry, that I made it seem like I was trying to stop people.

I was just saying that there is an existing script for people to improve on, and or learn from.

Also there is another UPS menu?

----

The above script looks like it should work, I wounder if there is a different way of doing it rather then running a console command on every one.
« Last Edit: December 29, 2011, 12:55:39 PM by HeLLFox_15 »
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Clear Decals Command
« Reply #6 on: December 29, 2011, 01:21:03 PM »
Not to my knowledge. Messed up your screen name (boy instead of fox). Now corrected.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline strategos

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 2
  • I wanna be the guy
    • Community
Re: ULX Clear Decals Command
« Reply #7 on: January 04, 2012, 02:31:35 PM »
ok this

Code: [Select]
local function ClearDecals(ply)
  for k, v in pairs(player.GetAll()) do
    v:ConCommand("r_cleardecals")
  end
  ulx.fancyLogAdmin(ply, "#A has cleared all the decals.")
end
local cmd_ClearDecals= ulx.command("Utility", "clear decals", ClearDecals, "!clear")
cmd_ClearDecals:defaultAccess(ULib.ACCESS_ADMIN)
cmd_ClearDecals:help("Clears decals.")

returns this in console when I try to use it.

[ulx\xgui\commands.lua:259] RunConsoleCommand: Command is blocked! (clear)

Also, you cant configure which usergroups can use it like I can with the Sban module.

Offline Assault_Trooper

  • Newbie
  • *
  • Posts: 20
  • Karma: 1
    • Trooper's Gaming Servers
Re: ULX Clear Decals Command
« Reply #8 on: January 05, 2012, 05:39:18 AM »
Code: [Select]
function ulx.cleardecals( ply )

for k,v in pairs ( player.GetAll() ) do

v:ConCommand( "r_cleardecals" )
v:SendLua( "game.RemoveRagdolls()" )

end

ulx.fancyLogAdmin( ply, "#A cleared all decals" )

end

local cleardecals = ulx.command( "Trooper's Additions", "ulx cleardecals", ulx.cleardecals, "!cleardecals" )
cleardecals:defaultAccess( ULib.ACCESS_ADMIN )
cleardecals:help( "Clears all decals, and removes client ragdolls." )

This is what I use, it removes the dead NPC's too. And it works definently, been using it for ages.

Offline strategos

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 2
  • I wanna be the guy
    • Community
Re: ULX Clear Decals Command
« Reply #9 on: January 06, 2012, 11:57:18 AM »
Code: [Select]
function ulx.cleardecals( ply )

for k,v in pairs ( player.GetAll() ) do

v:ConCommand( "r_cleardecals" )
v:SendLua( "game.RemoveRagdolls()" )

end

ulx.fancyLogAdmin( ply, "#A cleared all decals" )

end

local cleardecals = ulx.command( "Trooper's Additions", "ulx cleardecals", ulx.cleardecals, "!cleardecals" )
cleardecals:defaultAccess( ULib.ACCESS_ADMIN )
cleardecals:help( "Clears all decals, and removes client ragdolls." )

This is what I use, it removes the dead NPC's too. And it works definently, been using it for ages.

I bestow 1000 blessings upon you. Thanks!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Clear Decals Command
« Reply #10 on: January 06, 2012, 04:05:28 PM »
Ah, looking at the comparisons, I see now why one would and one not work.
The command setup in non-working, "clear decals", gets spit back by Gmod.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming