AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Private Message (Messages history) (https://forums.alliedmods.net/showthread.php?t=342259)

bigdaddy424 03-22-2023 18:19

Private Message (Messages history)
 
2 Attachment(s)
  • Description
    Have a private conversation with another player, engage in a private channel and browser older conversations.
  • Modules
    1. nVault - database module
    2. JSON - value of key entry
  • Cvars
    pm_history (default: 35) how many messages to show at once when using /pmread
  • Commands
    <tags> = parameters
    1. say /pm <player> <message> - sends a private message to a player
    2. say /r <message> - quick reply to player you sent a pm unless its your first time getting a pm since you joined the server
    3. say !<message> - quick reply but faster
    4. say /ignore <player> - ignores messages from a person, will stop ignoring if you decide to send a pm to him/her/they/them again
    5. say /sounds - toggle notifications
    6. say /togglepm - toggle pm
    7. say /enter <player> - start a private channel with a player, type the command without specifying a player and it will go to the person you last messaged in a private chat
    8. say /leave - leaves a private channel
    9. say /pmread <number> - read older message
    10. say_team <message> - if you're on a private channel all messages sent here will be viewed only by the recipient
  • Notes
    At the current state it is not possible to delete specific messages.
    Messages sent via PM are permanently saved and cannot be modified.
  • Credits
    Bugsy - bit macros
  • Image
    https://i.ibb.co/VJg0Sc3/img.png
    https://i.ibb.co/8jZqtvB/chat.png
    https://i.ibb.co/N6BM3w8/Untitled2.png
    Messages sorted from newest to oldest
    Supports word-wrap

fysiks 03-22-2023 19:07

Re: Private Message
 
Because chat commands can be send relatively fast and most of them won't be relevant to this plugin, I would probably implement a couple optimizations.

The first I would do is to exit the function as soon as you know it's definitely not a relevant message with this after remove_quotes():

PHP Code:

    if( message[0] != '/' && message != '!' )
        return 
PLUGIN_CONTINUE 

Then, while I'm not sure it will actually be significant, you can create variables as static variables so that they don't need to be re-allocated for every chat message.

bigdaddy424 03-25-2023 22:25

Re: Private Message
 
Edited*

bigdaddy424 03-05-2024 20:00

Re: Private Message
 
Updated the source for viewing pleasure and fixed `for` loop condition.

EFFx 03-06-2024 07:00

Re: Private Message
 
Suggestion: A while ago I created a system where you can register messages for admins that are currently offline. As soon as they join back, a notification will alert them that there are messages to be read. Options to answer/delete messages were avaliable too. You can also do something similar in this one.

bigdaddy424 03-06-2024 15:48

Re: Private Message
 
That would work great if I had used MySQL or some sort of database.
I have to squeeze a bunch of code to get it working with just nvault.

bigdaddy424 03-09-2024 14:53

Re: Private Message (Messages history)
 
I've updated the code once it for all and decided to save every message sent and received from/to another player.
If you wish to change the appearance of the motd window you could so to at line #36
There will not be an option to message offline users or admins, there are plenty of other options such as report systems or even texting admins on other platforms, steam etc.
Consider criticizing/improving and updating the source and leaving feedback. Always up to recommendations to a reasonable extent.

JocAnis 03-12-2024 20:29

Re: Private Message (Messages history)
 
Good job for the effort! But I must ask, is there a real need of this plugin nowadays? Because we have a lot of sites or platforms for communication (Discord, whatsapp, FB, VK, telegram, forums), do you think people will use this feature on their servers?

Of course I dont mean to say this is a bad plugin but Im just giving a constructive critic -> for example as EFFx already suggested, to save message for admins...if nvault is a problem - transfer it to mysql? (I know it is easy to say, but you get the point..)

...In case this is just a practicing script/plugin from you, then ignore my reply haha

bigdaddy424 03-13-2024 00:53

Re: Private Message (Messages history)
 
thanks
well to be honest ive only used it for chit-chat. im not planning to make this a chat manager with group chats and so on like texting platforms you've mentioned with the only feature being that i received from this is texting my friends about stuff that its not really important to other players and conversations we just continue from other messaging apps around topics we share interest and whatever.
i tried to avoid mysql in particular because it isnt really that important setting up a database just to get a private message plugin running, assuming the majority of people and that including me want this to work right of the bat ever having to worry about config files etc.

i've learnt a few stuff working on this as usual. the amxx web api is simple to understand and every native is explained in detail although i never work on engine or fakemeta and such modules that need more background knowledge of the game. simply because it needs a lot of research and testing


All times are GMT -4. The time now is 02:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.