General > Developers Corner
ULX Clear Decals Command
strategos:
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: ----- 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." )
--- End code ---
JackYack13:
--- Code: ---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.")
--- End code ---
This should work.
Your function and variable containing the command info had the same name. Also, you had some unneeded arguments in the function.
Aaron113:
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.
LuaTenshi:
The command has already been made, and is included in...
http://forums.ulyssesmod.net/index.php/topic,5427.0.html
JamminR:
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)
Navigation
[0] Message Index
[#] Next page
Go to full version