Ulysses

General => Developers Corner => Topic started by: aaron on June 29, 2013, 04:52:49 PM

Title: Displaying damagelogs?
Post by: aaron 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.
Title: Re: Displaying damagelogs?
Post by: MrPresident on June 29, 2013, 07:55:36 PM
Not hard at all. Use the PlayerHurt (http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index36f5.html) 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.
Title: Re: Displaying damagelogs?
Post by: aaron 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!
Title: Re: Displaying damagelogs?
Post by: aaron 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?
Title: Re: Displaying damagelogs?
Post by: MrPresident 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) (http://ulyssesmod.net/docs/files/lua/ulib/shared/messages-lua.html#console)

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.
Title: Re: Displaying damagelogs?
Post by: MrPresident 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.
Title: Re: Displaying damagelogs?
Post by: aaron 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) (http://ulyssesmod.net/docs/files/lua/ulib/shared/messages-lua.html#console)

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.