AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [Any] Private Messager (v1.0.4, 07/07/15) (https://forums.alliedmods.net/showthread.php?t=221096)

Marcus_Brown001 07-18-2013 01:47

[Any] Private Messager (v1.0.4, 07/07/15)
 
1 Attachment(s)
[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

Sreaper 07-18-2013 01:55

Re: [Any] Private Messager (v1.0.0, 07/18/13)
 
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.

Marcus_Brown001 07-18-2013 02:01

Re: [Any] Private Messager (v1.0.0, 07/18/13)
 
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.

Bubka3 07-18-2013 02:26

Re: [Any] Private Messager (v1.0.0, 07/18/13)
 
You would use the admin flag chat (J).

ilga80 07-18-2013 05:49

Re: [Any] Private Messager (v1.0.0, 07/18/13)
 
This is lite version of this https://forums.alliedmods.net/showthread.php?t=123978
Yes?

Marcus_Brown001 07-23-2013 19:35

Re: [Any] Private Messager (v1.1.2, 07/23/13)
 
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).

Nikkii 07-23-2013 21:49

Re: [Any] Private Messager (v1.1.2, 07/23/13)
 
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 :(

Marcus_Brown001 07-24-2013 03:11

Re: [Any] Private Messager (v1.1.2, 07/23/13)
 
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!

Nikkii 07-24-2013 06:47

Re: [Any] Private Messager (v1.1.2, 07/23/13)
 
Quote:

Originally Posted by Marcus_Brown001 (Post 1997556)
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

thetwistedpanda 07-24-2013 10:11

Re: [Any] Private Messager (v1.1.2, 07/23/13)
 
You should be using CheckCommandAccess, not manually getting flags.


All times are GMT -4. The time now is 11:01.

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