General > Developers Corner
Setting a reason for a command
xXBryanXx:
Ok so i've wanted to make certain commands that currently do not have a reason, like when you do !kick player reason it shows the reason like You've kicked player for minge. I have a command that is called !decals that removes decals, and i've got it to show this: You cleared all decals because nil
I'm making progress since it shows nil, but I would like it to actually show what I put for the reason. Here is my current code:
http://pastebin.com/nwT7zrCu
JamminR:
You have too many variables in the fancylogAdmin command.
You pass your function calling player and reason. But in your log command, you have calling player, command, target players, and reason.
Command and target player are nil in that instance.
There may be other errors too, but, that's the most glaring, and will get you on right track to seeing/fixing others if exist.
xXBryanXx:
How would I fix this without removing the variables? I think if I remove any it will break the command.
Decicus:
Target_plys isn't necessary. First of all you're not defining it (normally this would be one/multiple specified target players), since this is a "cleardecals" command, there wouldn't be any need of it (you don't target any specific players, your code is automatically targetting everyone). That can be removed. "Command" can also be removed, since that too isn't defined anywhere inside your code.
Basically, your ulx.fancyLogAdmin should look like this:
--- Code: ---ulx.fancyLogAdmin( calling_ply, "#A cleared all decals because #s", reason )
--- End code ---
.
xXBryanXx:
Thanks, it worked. I was just using the decals command as a test, but, will it work the same for other commands?
Navigation
[0] Message Index
[#] Next page
Go to full version