Author Topic: Displaying damagelogs?  (Read 3397 times)

0 Members and 1 Guest are viewing this topic.

Offline aaron

  • Newbie
  • *
  • Posts: 14
  • Karma: 1
Displaying damagelogs?
« on: June 29, 2013, 04:52:49 PM »
How difficult would this be to code into the server to display damagelogs in the console, for only certain ranks aswell if possible?

This would be on a jailbreak server.
« Last Edit: June 29, 2013, 04:55:09 PM by aaron »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Displaying damagelogs?
« Reply #1 on: June 29, 2013, 07:55:36 PM »
Not hard at all. Use the PlayerHurt with ULX's FancyLog function.

Add a couple checks for which groups you want it to report on.

All in all, this addon function would only take about 10-15 lines of code and no time at all to do if you know how to write lua. If you do not, I suggest you start by taking a look at some of the other uses of FancyLog and the example function(s) on the wiki that I linked.

Offline aaron

  • Newbie
  • *
  • Posts: 14
  • Karma: 1
Re: Displaying damagelogs?
« Reply #2 on: June 30, 2013, 05:55:11 AM »
Thank you very much for your reply. I am new the LUA but there is no harm in me trying!

Offline aaron

  • Newbie
  • *
  • Posts: 14
  • Karma: 1
Re: Displaying damagelogs?
« Reply #3 on: June 30, 2013, 08:25:56 AM »
We can't seem to figure out ULX fancylog.

So far we've got damagelogs displaying in the console for the user that was damaged like "You were damaged by ____ for ___ health"


Now we're trying to get all damagelogs to show for all admins like "____ was damaged by ___ for ___ health" but we're having trouble.


Edit:

We've got it showing for admins & superadmins but obviously as we have no idea how to get it working with fancylog, trialmods, mods and any other group from ULX can't see the logs.

Could anybody help?
« Last Edit: June 30, 2013, 09:24:38 AM by aaron »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Displaying damagelogs?
« Reply #4 on: June 30, 2013, 11:37:06 AM »
So are you wanting it to show in the console for your admins/mods as well as being logged in the servers ULX logs? If so, you'll need to send it as a message to the players. Use something like:

ULib.console(ply, message)

this would print a message to all admins console:
Code: [Select]
for k, v in pairs (player.GetAll()) do
    if v:IsAdmin() or v:IsUserGroup("moderator") then
        ULib.console(v, "This message will show up in the console")
    end
end

Let me know if this helps.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Displaying damagelogs?
« Reply #5 on: June 30, 2013, 11:45:20 AM »
Or.. There is this function:

ulx.fancyLogAdmin( ply, "#A was damaged by #T for INSERTCODE damage", target_ply )

where ply is the player damaged and target_ply is the player who did the damage. This would then show in the console and on the chat of admins.

Offline aaron

  • Newbie
  • *
  • Posts: 14
  • Karma: 1
Re: Displaying damagelogs?
« Reply #6 on: June 30, 2013, 03:15:09 PM »
So are you wanting it to show in the console for your admins/mods as well as being logged in the servers ULX logs? If so, you'll need to send it as a message to the players. Use something like:

ULib.console(ply, message)

this would print a message to all admins console:
Code: [Select]
for k, v in pairs (player.GetAll()) do
    if v:IsAdmin() or v:IsUserGroup("moderator") then
        ULib.console(v, "This message will show up in the console")
    end
end

Let me know if this helps.

I wasn't looking for the logs to be logged but it's only a bonus if they are.  Thank you for your help.