Raised This Month: $12 Target: $400
 3% 

[Any] Private Messager (v1.0.4, 07/07/15)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Plugin ID:
3761
Plugin Version:
1.0.4
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    A simple command to private message other players.
    Old 07-18-2013 , 01:47   [Any] Private Messager (v1.0.4, 07/07/15)
    Reply With Quote #1

    [Any] Private Messager (v1.0.4, 07/07/15)

    Description: This plugin is very simple in design: you can private message someone, you can toggle if someone can private message you, and you can toggle, if you are an admin, if you can see everyone's private messages. To be able to see everyone's private messages you need to have the chat flag inside SourceMod (or root obviously).

    ConVar List:
    • sv_pm_immunity - This toggles whether the pm command checks players' immunity. (0 = Off, 1 = On)

    Command List:
    • sm_pm <player> <message>
    Installation: It is pretty straight forward: just drop the plugin (smx) file into the 'addons/sourcemod/plugins' folder. Once you upload the file, you can change the map, restart the server, or load the plugin manually. After that, you are set to go!

    Change Log:
    Spoiler
    Attached Files
    File Type: sp Get Plugin or Get Source (privatemessage.sp - 336 views - 2.0 KB)

    Last edited by Marcus_Brown001; 07-08-2015 at 00:28.
    Marcus_Brown001 is offline
    Sreaper
    髪を用心
    Join Date: Nov 2009
    Old 07-18-2013 , 01:55   Re: [Any] Private Messager (v1.0.0, 07/18/13)
    Reply With Quote #2

    Since messages are already going to be logged, would you kindly make it so that it also forwards all private messages to admins?

    Nice plugin by the way.

    Last edited by Sreaper; 07-18-2013 at 01:55.
    Sreaper is offline
    Marcus_Brown001
    AlliedModders Donor
    Join Date: Nov 2012
    Location: Illinois, United States
    Old 07-18-2013 , 02:01   Re: [Any] Private Messager (v1.0.0, 07/18/13)
    Reply With Quote #3

    Yeah ... a lot of people have told me to make this send it to admins (this was originally in a different plugin of mine). At current I am working on something else, and was talked into removed this command from a different plugin, and putting it up here as its own plugin.

    The next update I push I will add a convar to enable or disable the display of private messages to all admins, and then a command that admins can use to toggle that feature on or off. The only issue I foresee is what flag should I use to determine which admins can see the messages.
    Marcus_Brown001 is offline
    Bubka3
    Sir Buzz Killington, Esq.
    Join Date: Jan 2010
    Location: New York, NY
    Old 07-18-2013 , 02:26   Re: [Any] Private Messager (v1.0.0, 07/18/13)
    Reply With Quote #4

    You would use the admin flag chat (J).
    Bubka3 is offline
    ilga80
    Senior Member
    Join Date: Nov 2012
    Old 07-18-2013 , 05:49   Re: [Any] Private Messager (v1.0.0, 07/18/13)
    Reply With Quote #5

    This is lite version of this https://forums.alliedmods.net/showthread.php?t=123978
    Yes?
    ilga80 is offline
    Marcus_Brown001
    AlliedModders Donor
    Join Date: Nov 2012
    Location: Illinois, United States
    Old 07-23-2013 , 19:35   Re: [Any] Private Messager (v1.1.2, 07/23/13)
    Reply With Quote #6

    Yes, this can be qualified as a 'lite' version of that plugin. I have been looking for a simple Private Messaging plugin for some time, and could never find one. I new that one existed but at the time I did not want to go through the hassle of using it; I just wanted a simple sm_pm command. When I learned how to code SourcePawn I finally made one, and here we are.

    ** Edit **

    I have released v1.1.2: added the feature for admins to see everyone's private messages (so long as said admin is not the client sending the message, or the target receiving the message). An admin has to have admin chat flag (j) to be able to see the private messages. The last update was that a player can also toggle whether or not they allow others to private message them. If you join the server and these are disabled it will tell you they are disabled to you remind you (they save inside Client Prefs).
    Marcus_Brown001 is offline
    Nikkii
    Member
    Join Date: Feb 2012
    Old 07-23-2013 , 21:49   Re: [Any] Private Messager (v1.1.2, 07/23/13)
    Reply With Quote #7

    A little thing I noticed >.>
    PHP Code:
            StringToInt(sBuffer) == -? (g_bShowMessage[iClient] = false) : (g_bShowMessage[iClient] = true);
            
    StringToInt(sBuffer2) == -? (g_bShowMessageA[iClient] = false) : (g_bShowMessageA[iClient] = true); 
    Could easily be

    PHP Code:
            g_bShowMessage[iClient] = StringToInt(sBuffer) != -1;
            
    g_bShowMessageA[iClient] = StringToInt(sBuffer2) != -1
    This (^) applies to every ternary you used

    PHP Code:
    if (GetUserFlagBits(i) & ADMFLAG_CHAT || ADMFLAG_ROOT <= 0) continue; 
    That likely won't work how you want it to, you might need to do something like this:
    PHP Code:
            new bits GetUserFlagBits(i);
            if (
    bits ADMFLAG_CHAT || bits ADMFLAG_ROOT) continue; 
    Also, why not use FindTarget/ProcessTargetString? I think the only time it won't work is when using like @all as a target , though you could probably set 'admin' to 0 to make it emulate it being able to target everyone

    Anyway, it is a very nice idea, I've always wondered why the built-in SourceMod PM wasn't available to players by default
    __________________
    Owner of ProbablyAServer, a server without game changing mods and donation benefits

    RCON Helper | [TF2] LogUpload | CCC Donator Tags | PHP Steam API Wrapper

    Last edited by Nikkii; 07-23-2013 at 21:50.
    Nikkii is offline
    Marcus_Brown001
    AlliedModders Donor
    Join Date: Nov 2012
    Location: Illinois, United States
    Old 07-24-2013 , 03:11   Re: [Any] Private Messager (v1.1.2, 07/23/13)
    Reply With Quote #8

    Thanks for the suggestions. The GetUserFlagBits works like it is; the reason I have it like that is because if you do a regular admin flag then root users do not return true for said flag. On my Dev Server I only have the root flag, so I put it like that in-case other people had the same problem.

    Also, what you posted could be:
    PHP Code:
    if (GetUserFlagBits(i) & ADMFLAG_CHAT || GetUserFlagBits(i) & ADMFLAG_ROOT) continue; 
    However, I do believe that a return of '0' will be classified as 'true' whereas -1 would be false (or so I am under the impression of). Anywho, it works the way it is inside the plugin right now. I have never used FindTarget or ProcessTargetString even though it is the 'correct' way to do it, I am partial to my method. At the end of the day it works which is what I would be worried about.

    I too have wondered that for some time, but I still would prefer this over the default SM private message system; it seems easier to me I guess, I dunno. Anyways, glad you like it and thanks for the commentary!
    Marcus_Brown001 is offline
    Nikkii
    Member
    Join Date: Feb 2012
    Old 07-24-2013 , 06:47   Re: [Any] Private Messager (v1.1.2, 07/23/13)
    Reply With Quote #9

    Quote:
    Originally Posted by Marcus_Brown001 View Post
    Thanks for the suggestions. The GetUserFlagBits works like it is; the reason I have it like that is because if you do a regular admin flag then root users do not return true for said flag. On my Dev Server I only have the root flag, so I put it like that in-case other people had the same problem.

    Also, what you posted could be:
    PHP Code:
    if (GetUserFlagBits(i) & ADMFLAG_CHAT || GetUserFlagBits(i) & ADMFLAG_ROOT) continue; 
    However, I do believe that a return of '0' will be classified as 'true' whereas -1 would be false (or so I am under the impression of). Anywho, it works the way it is inside the plugin right now. I have never used FindTarget or ProcessTargetString even though it is the 'correct' way to do it, I am partial to my method. At the end of the day it works which is what I would be worried about.

    I too have wondered that for some time, but I still would prefer this over the default SM private message system; it seems easier to me I guess, I dunno. Anyways, glad you like it and thanks for the commentary!
    PHP Code:
    ADMFLAG_ROOT <= 
    Is a part of the if, since ADMFLAG_ROOT isn't <= 0 (Why would it be?) and it's seeing that as a condition. You could also do it like that, but it doubles the cost of the call (Which probably isn't much, but you're calling it 24-32 times). It's too bad that GetUserFlagBits doesn't show the admin as having all flags , at least in GetUserFlagBits
    __________________
    Owner of ProbablyAServer, a server without game changing mods and donation benefits

    RCON Helper | [TF2] LogUpload | CCC Donator Tags | PHP Steam API Wrapper

    Last edited by Nikkii; 07-24-2013 at 06:52.
    Nikkii is offline
    thetwistedpanda
    Good Little Panda
    Join Date: Sep 2008
    Old 07-24-2013 , 10:11   Re: [Any] Private Messager (v1.1.2, 07/23/13)
    Reply With Quote #10

    You should be using CheckCommandAccess, not manually getting flags.
    __________________
    thetwistedpanda is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 09:29.


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