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

Private Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 10-14-2016 , 16:51   Private Message
Reply With Quote #1

I already know how to do this.
__________________

Last edited by Relaxing; 03-30-2018 at 18:52.
Relaxing is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-14-2016 , 18:14   Re: Private Message
Reply With Quote #2

Could you accept this simple plugin and tell me to add something?

Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>

#pragma semicolon 1

new bool:Spy[33], NoPM[33], Blocked[33][33];

new SpyVault;

public plugin_init()
{
	register_plugin("Private MSG", "1.0", "RegonizE");
	
	register_clcmd( "say", "CmdSay" );
	register_clcmd("say /spy", "CmdSpy");
	register_clcmd("say /block", "CmdBlock");
	register_clcmd("say /nopm", "CmdNoPM");
}

public plugin_cfg()
{
	SpyVault = nvault_open("PrivateMessageSpy");
}

public plugin_end()
{
	nvault_close(SpyVault);
}

public CmdNoPM(id)
{
	NoPM[id] = true;
}

public CmdBlock(id)
{
	new Message[100];
	read_args(Message, charsmax(Message));
	
	new Target = cmd_target(id, Message); // I am immune, obey me!
	
	Blocked[id][Target] = true;
}

public CmdSpy(id)
{
	if(get_user_flags(id) & ADMIN_KICK)
	{
		Spy[id] = !Spy[id];
		ColorChat(id, "^4You are no%s spying Private Messages.", Spy[id] ? "w" : " longer");
		
		SaveSpy(id);
		return 1;
	}
	return 0;
}

public client_putinserver(id)
{
	if(get_user_flags(id) & ADMIN_KICK)
		LoadSpy(id);
		
	NoPM[id] = false;
}

public client_disconnect(id)
{
	if(get_user_flags(id) & ADMIN_KICK)
		SaveSpy(id);
		
	for(new i;i < get_maxplayers();i++)
	{
		Blocked[id][i] = false;
	}
}

public CmdSay( iPlayer )
{
	new szMessage[128], szCommand[32], szName[32], szPrivateMessage[64], RepFormat[100];
	read_argv( 1, szMessage, sizeof( szMessage ) -1 );
	parse( szMessage, szCommand, charsmax( szCommand ), szName, charsmax( szName ), szPrivateMessage, charsmax( szPrivateMessage ) );
	if( equali( "/pm", szCommand ) )
	{
		new iTarget = cmd_target( iPlayer, szName, 0 );
		if(iTarget) 
		{
			if(!NoPM[iTarget])
			{
				if(!Blocked[iTarget][iPlayer])
				{
					if(iTarget != iPlayer)
					{
						new Name[17]; // Meh, ain't messing with a damn spy issue.
						get_user_name(iPlayer, Name, 16);
						formatex(RepFormat, charsmax(RepFormat), "/pm %s ", szName); // This one is to keep only the message.
						replace(szMessage, sizeof( szMessage ), RepFormat, "");
						
						ColorChat(iPlayer, "^1PM To^3 %s:^4 %s", szName, szMessage[containi(szMessage, szPrivateMessage)]);
						ColorChat(iTarget, "^1PM From^3 %s:^4 %s", Name, szMessage[containi(szMessage, szPrivateMessage)]);
						new players[32], num;
						get_players(players, num);
						for(new id;id < num;id++)
						{	
							new i = players[id];
							
							if(!Spy[i] || i == iPlayer || i == iTarget)
								continue;
							
							formatex(szName, 15, szName);
							formatex(Name, 15, Name);
							
							
							ColorChat(i, "[PM Spy]^4 Sender:^3 %s,^4 Receiver^3 %s:^4 %s", Name, szName, szMessage[containi(szMessage, szPrivateMessage)]);
						}	
					}
					else
					{
						ColorChat(iPlayer, "^4You can't send a message to yourself.");
					}
				}
				else
				{
					ColorChat(iPlayer, "^4This user has blocked you!");
				}
			}	
			else
			{
				ColorChat(iPlayer, "^4This user has blocked PMs");
			}
		}
		else
		{
			ColorChat(iPlayer, "^4Syntax:^3 /pm <name> <message>");
		}
		
		return 1;
	}
	
	return 0;
}

public SaveSpy(id)
{
	new Key[64], Data[256];
	
	formatex(Key, charsmax(Key), "%s-ID", GetUserSteamid(id));
	
	formatex(Data, charsmax(Data), "%i#^n", Spy[id] ? 1 : 0);
	
	nvault_set(SpyVault, Key, Data);
}

public LoadSpy(id)
{
	new Key[64], Data[256];
	formatex(Key, charsmax(Key), "%s-ID", GetUserSteamid(id));

	formatex(Data, charsmax(Data), "%i#", Spy[id] ? 1 : 0);
		
	nvault_get(SpyVault, Key, Data, charsmax(Data));
	replace_all(Data, charsmax(Data), "#", " ");
	
	Spy[id] = str_to_num(Data) == 1 ? true : false;
}
stock GetUserSteamid(index)
{
	new Authid[35];
	get_user_authid(index, Authid, charsmax(Authid));
	return Authid;
}
stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
    new msg[191], players[32], count = 1;
    
    static len; len = formatex(msg, charsmax(msg), "");
    vformat(msg[len], charsmax(msg) - len, string, 3);
    
    if(id)  players[0] = id;
    else    get_players(players,count,"ch");
    
    for (new i = 0; i < count; i++)
    {
        if(is_user_connected(players[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]);
            write_byte(players[i]);
            write_string(msg);
            message_end();
        }
    }
}
eyal282 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-14-2016 , 18:32   Re: Private Message
Reply With Quote #3

What is wrong with Exolent's plugin? We easily fix something if you don't tell us what is broken.
__________________
fysiks is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-12-2017 , 12:20   Re: Private Message
Reply With Quote #4

I needed the translator for the exolent's plugin, @ Translator.inc thread
It's was made at an older version of Amx Mod X (2006.4 RC1), so even that I got the translator it won't complie. Can someone fix it? Original Simple Private Message Thread
__________________
Relaxing is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-12-2017 , 12:37   Re: Private Message
Reply With Quote #5

Quote:
Originally Posted by Relaxing View Post
I needed the translator for the exolent's plugin, @ Translator.inc thread
It's was made at an older version of Amx Mod X (2006.4 RC1), so even that I got the translator it won't complie. Can someone fix it? Original Simple Private Message Thread
Well, you should not expect that plugins ported to amxmod will work on amxmodx.
__________________
HamletEagle is online now
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-12-2017 , 13:50   Re: Private Message
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
Well, you should not expect that plugins ported to amxmod will work on amxmodx.
Means that it can't be back on track?
__________________
Relaxing is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-12-2017 , 15:19   Re: Private Message
Reply With Quote #7

You should just search for the original plugins in this forums. If it was made by exolent, I'm sure it was for amxmodx originally. But yes, it can be ported back.
__________________

Last edited by HamletEagle; 01-12-2017 at 15:19.
HamletEagle is online now
Amine Belokda
Senior Member
Join Date: Oct 2015
Location: ML_NOT_FOUND
Old 01-12-2017 , 16:58   Re: Private Message
Reply With Quote #8

Use This
__________________
Amine Belokda is offline
Send a message via MSN to Amine Belokda
Amine Belokda
Senior Member
Join Date: Oct 2015
Location: ML_NOT_FOUND
Old 01-12-2017 , 16:59   Re: Private Message
Reply With Quote #9

PHP Code:
#include <amxmodx>
#include <colorchat>

new g_iTarget[33]

public 
plugin_init() 
{
    
register_plugin("PM - Private Message""1.0""EaGle/Flicker-rewriten")
    
    
register_clcmd("say /pm""cmdPMMenu")
    
register_clcmd("say_team /pm""cmdPMMenu")
    
    
register_clcmd("PrivateMessage""cmd_player");
}

public 
cmdPMMenu(id)
{
    new 
menu menu_create("\r[PG] \yPrivate Message \wMenu""handlePMMEnu")
    
    new 
players[32], num
    
new szName[32], szTempid[32]
    
    
get_players(playersnum"ach")
    
    for(new 
inumi++)
    {
        
get_user_name(players[i], szNamecharsmax(szName))
        
        
num_to_str(get_user_userid(players[i]), szTempidcharsmax(szTempid))
        
        
menu_additem(menuszNameszTempid0)
    }
    
    
menu_display(idmenu)
}

public 
handlePMMEnu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
szData[6], szName[64], iAccessiCallback
    menu_item_getinfo
(menuitemiAccessszDatacharsmax(szData), szNamecharsmax(szName), iCallback)
    
    
g_iTarget[id] = find_player("k"str_to_num(szData))
    
    
client_cmd(id"messagemode PrivateMessage")
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

public 
cmd_player(id)
{
    new 
say[300]
    
read_args(saycharsmax(say))
    
remove_quotes(say)
    
    if(!
strlen(say))
        return 
PLUGIN_HANDLED
    
    
new szSenderName[32], szReceiverName[32]
    
get_user_name(idszSenderNamecharsmax(szSenderName))
    
get_user_name(g_iTarget[id], szReceiverNamecharsmax(szReceiverName))
    
    
ColorChat(idGREY"[PG]^4 Private Message To^3 %s^1: %s"szReceiverNamesay)
    
ColorChat(g_iTarget[id], GREY"[PG]^4 Private Message From^3 %s^1: %s"szSenderNamesay)
    
    return 
PLUGIN_CONTINUE

__________________
Amine Belokda is offline
Send a message via MSN to Amine Belokda
Amine Belokda
Senior Member
Join Date: Oct 2015
Location: ML_NOT_FOUND
Old 01-12-2017 , 16:59   Re: Private Message
Reply With Quote #10

PHP Code:
#include <amxmodx>
#include <colorchat>

new g_iTarget[33]

public 
plugin_init() 
{
    
register_plugin("PM - Private Message""1.0""EaGle/Flicker-rewriten")
    
    
register_clcmd("say /pm""cmdPMMenu")
    
register_clcmd("say_team /pm""cmdPMMenu")
    
    
register_clcmd("PrivateMessage""cmd_player");
}

public 
cmdPMMenu(id)
{
    new 
menu menu_create("\r[PG] \yPrivate Message \wMenu""handlePMMEnu")
    
    new 
players[32], num
    
new szName[32], szTempid[32]
    
    
get_players(playersnum"ach")
    
    for(new 
inumi++)
    {
        
get_user_name(players[i], szNamecharsmax(szName))
        
        
num_to_str(get_user_userid(players[i]), szTempidcharsmax(szTempid))
        
        
menu_additem(menuszNameszTempid0)
    }
    
    
menu_display(idmenu)
}

public 
handlePMMEnu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
szData[6], szName[64], iAccessiCallback
    menu_item_getinfo
(menuitemiAccessszDatacharsmax(szData), szNamecharsmax(szName), iCallback)
    
    
g_iTarget[id] = find_player("k"str_to_num(szData))
    
    
client_cmd(id"messagemode PrivateMessage")
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

public 
cmd_player(id)
{
    new 
say[300]
    
read_args(saycharsmax(say))
    
remove_quotes(say)
    
    if(!
strlen(say))
        return 
PLUGIN_HANDLED
    
    
new szSenderName[32], szReceiverName[32]
    
get_user_name(idszSenderNamecharsmax(szSenderName))
    
get_user_name(g_iTarget[id], szReceiverNamecharsmax(szReceiverName))
    
    
ColorChat(idGREY"[PG]^4 Private Message To^3 %s^1: %s"szReceiverNamesay)
    
ColorChat(g_iTarget[id], GREY"[PG]^4 Private Message From^3 %s^1: %s"szSenderNamesay)
    
    return 
PLUGIN_CONTINUE

__________________
Amine Belokda is offline
Send a message via MSN to Amine Belokda
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 11:48.


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