Ulysses

General => Developers Corner => Topic started by: xXBryanXx on December 01, 2013, 06:17:59 PM

Title: Setting a reason for a command
Post by: xXBryanXx on December 01, 2013, 06:17:59 PM
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 (http://pastebin.com/nwT7zrCu)
Title: Re: Setting a reason for a command
Post by: JamminR on December 01, 2013, 08:33:23 PM
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.
Title: Re: Setting a reason for a command
Post by: xXBryanXx on December 02, 2013, 12:38:50 PM
How would I fix this without removing the variables? I think if I remove any it will break the command.
Title: Re: Setting a reason for a command
Post by: Decicus on December 02, 2013, 01:14:41 PM
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: [Select]
ulx.fancyLogAdmin( calling_ply, "#A cleared all decals because #s", reason ).
Title: Re: Setting a reason for a command
Post by: xXBryanXx on December 02, 2013, 05:20:35 PM
Thanks, it worked. I was just using the decals command as a test, but, will it work the same for other commands?
Title: Re: Setting a reason for a command
Post by: Megiddo on December 02, 2013, 05:27:40 PM
It depends on the parameters. If there are target players involved, you'll need to specify them.
Title: Re: Setting a reason for a command
Post by: Decicus on December 02, 2013, 11:50:49 PM
It depends on the parameters. If there are target players involved, you'll need to specify them.

This.
If you're actually planning to create a command that requires to do v:ConCommand on specific players, then you need to specify them. I was just making my other post related to the code you put up.