Author Topic: Setting a reason for a command  (Read 2674 times)

0 Members and 2 Guests are viewing this topic.

Offline xXBryanXx

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Setting a reason for a command
« 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

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Setting a reason for a command
« Reply #1 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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline xXBryanXx

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Re: Setting a reason for a command
« Reply #2 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.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Setting a reason for a command
« Reply #3 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 ).
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline xXBryanXx

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Re: Setting a reason for a command
« Reply #4 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?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Setting a reason for a command
« Reply #5 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.
Experiencing God's grace one day at a time.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Setting a reason for a command
« Reply #6 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.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.