Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release PM Manager
#1
*Works with .NET 3 versions

Enables private messages between players ingame and supports the player's name or ID shown in 'status.'
Attachment is at the bottom of the post.

Usage:
Code:
!pm <player|ID> <message>
!pm Nukem test message
!pm 0 test message

Image URL

Code:
using System;
using Addon;

namespace pm_manager
{
    public class PMManager : CPlugin
    {
        public ServerClient GetClientByName(string name)
        {
            if (name == null)
                return null;

            ServerClient client = null;

            for(int i = 0; i < 18; i++)
            {
                client = GetClient(i);

                if (client == null)
                    continue;

                if (client.Name.ToLower() == name.ToLower())
                    return client;
            }

            return null;
        }

        public ChatType ManagerError(int ClientNum)
        {
            TellClient(ClientNum, "[^1PM Manager^7]: Invalid player", true);
            TellClient(ClientNum, "[^1PM Manager^7]: Usage: !pm <player|ID> <message>", true);

            return ChatType.ChatNone;
        }

        public override void OnServerLoad()
        {
            ServerPrint("Plugin: PM Manager loaded. Author: Nukem");
        }

        public override ChatType OnSay(string Message, ServerClient Client)
        {
            if (Message.StartsWith("!pm"))
            {
                string[] tokens = Message.Split(' ');

                if (tokens.Length < 3)//Less than three arguments
                    return ManagerError(Client.ClientNum);

                ServerClient ci = null;

                int num = 0;
                if (int.TryParse(tokens[1], out num))
                    ci = GetClient(num);
                else
                    ci = GetClientByName(tokens[1]);

                if (ci == null)
                    return ManagerError(Client.ClientNum);

                string  NewMessage  = null;
                int     iNum        = 0;

                foreach (string part in tokens)
                {
                    if (iNum >= 2)//Quick fix to remove !pm <name> or !pm <ID>
                        NewMessage += part;

                    iNum++;
                }

                TellClient(Client.ClientNum, "[^1PM Manager^7]: Message sent", true);
                TellClient(ci.ClientNum, "[^1" + Client.Name + "^7]: " + NewMessage, true);

                return ChatType.ChatNone;
            }

            return ChatType.ChatContinue;
        }
    }
}


Attached Files
.zip   pm manager.zip (Size: 3.1 KB / Downloads: 203)
[Image: b_560_95_1.png]
Reply

#2
I think you have so much free time these days.

Good job. I'm eager to see more releases from you.
Reply

#3
@Lemon this plugin was as example in the old API, he only converted it from C++ to C# Tongue
But it's a epic plugin though
Reply

#4
Nukem, please add the ability to use part of the name, insensitive.
Reply

#5
hi guys,

got some questions for the PM manager

1. is it legal to use it?
2. where do i have to put the file?
3. is it possible to send massages for example to show my serverrules? i mean the massage repeats all the time!
4. how can i deal with the text i want to send!?
Reply

#6
(01-22-2012, 16:01)HdM|Scorpion Wrote: hi guys,

got some questions for the PM manager

1. is it legal to use it?
2. where do i have to put the file?
3. is it possible to send massages for example to show my serverrules? i mean the massage repeats all the time!
4. how can i deal with the text i want to send!?

1. dont know, but if you run the server from another folder than your steamfolder you'll not get banned
2.read up on nukems server addon
3.same, nukems server addon makes that possible
4. use !pm playername/id message
Reply

#7
thanks for the answer, but

sorry, i dont really know where to find the instructions...

can i have a link for that pls?
Reply

#8
(01-22-2012, 19:54)HdM|Scorpion Wrote: thanks for the answer, but

sorry, i dont really know where to find the instructions...

can i have a link for that pls?

It's in the mw3 server addon forum in the general subforum and has been stickied, i suggest you read the OP there
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Links to the old "Player Manager"? GrossKopf 10 5,459 08-28-2012, 22:34
Last Post: JariZ
Exclamation [News] New manager/updater of the addon Nukem 28 14,716 06-10-2012, 13:52
Last Post: JariZ
  [News] IW gets new community manager Pozzuh 7 3,832 05-28-2012, 00:47
Last Post: House
Thumbs Up [Release] XP Manager V1.75 Fixed & Source Code kokole 17 11,481 03-09-2012, 21:36
Last Post: stillframe
  Help SOLVED - Asset manager: What do with weapon files? gumpo03 8 4,652 11-07-2011, 20:24
Last Post: gumpo03
  [Request] Custom Weapon Texture With Asset Manager Scripts18 10 6,294 08-06-2011, 16:25
Last Post: Scripts18
  Asset Manager Phl3x_ 5 3,050 07-18-2011, 00:16
Last Post: Phl3x_
  [Bug]Asset Manager Nukem 3 2,732 07-09-2011, 12:19
Last Post: Lost4468
  [Release] Steam Achievement Manager 6.1 d0h! 12 49,890 07-01-2011, 09:21
Last Post: d0h!
  New Release - Football Manager 2011 1 1,941 11-05-2010, 12:06
Last Post: SuperNovaAO

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.