txAdmin icon indicating copy to clipboard operation
txAdmin copied to clipboard

[Feature]: Add duration to txAdmin:events:playerBanned

Open PC1up opened this issue 3 years ago • 2 comments

Scope

Developer API

Feature Description

Simple thing (I guess), if I ban someone for 2 days and I want to display it ingame, I can't show these 2 days. I'm just able to show when the player will be unbanned.

Use Case

I wanted to show bans of online players for the users (just because of transparency) and wanted to display the actual duration of the ban as well but was only able to display the date the ban will end.

Proposed Solution

No response

Additional Info

No response

PC1up avatar Apr 22 '22 14:04 PC1up

what should be returned, duration in seconds or the input duration string (like 1 day, 2 week)?
Maybe the input should be like an object {multiplier: 2, unit: 'week'}? Should this duration string be the english input or should we translate it?

There's plenty of things or ways we can return it, let me know what you think would be best.

tabarra avatar Apr 22 '22 14:04 tabarra

Okay, so it should return it the way the banned player sees it which is (I think) translated and like "1 day".

PC1up avatar Apr 22 '22 14:04 PC1up

Okay, for update v5.0 in the playerBanned event I'll likely:

  • remove target param in favor of targetNetId and targetIds (array);
  • add durationInput which will contain something like permanent or 2 days;
  • add durationTranslated which will contain the translated duration or permanent or maybe false idk, since we don't actually have a way to translate "permanent" into other languages.

tabarra avatar Oct 16 '22 10:10 tabarra

Done, this is what the event data will look like (for banning an online player when locale = german): image

tabarra avatar Oct 16 '22 14:10 tabarra