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

Private Message


Post New Thread Reply   
 
Thread Tools Display Modes
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-12-2017 , 19:24   Re: Private Message
Reply With Quote #11

Dude, thats what I am using on my Furien Mod

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new bool:pmon[33], bool:pmsound[33],gidPlayer[33]

new const 
ON_OFF[][] = 

    
"\y[\rdisabled\y]","\y[\wenabled\y]" 
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /private""cmd_privatemessage")
    
register_clcmd("say_team /private""cmd_privatemessage")
    
    
register_clcmd("Private""cmd_player")
}
public 
plugin_precache()
{
    
precache_sound("misc/sent.wav")
    
precache_sound("misc/incaa.wav")
}
public 
client_putinserver(id)
{
    
pmon[id] = false
    pmsound
[id] = true
}
public 
pm_menu(id)
{
    new 
sztittle menu_create("Private Message \w( \r/private\w )","cmd_pm_menu_handler")
    
menu_additem(sztittle,"Send PM")
    
menu_additem(sztittle,"Settings^n")
    
    
menu_display(id,sztittle)
}
public 
cmd_pm_menu_handler(idmenuitem)
{
    switch(
item)
    {
        case 
0cmd_privatemessage(id)
        case 
1pm_config(id)
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}
public 
pm_config(id)
{
    new 
menu_text[128]
    new 
menu3 menu_create("PM Settings \w( \r/private\w )""menupm_menu_handle")
    
    
formatex(menu_text,charsmax(menu_text),"Receive PM  ^t%s^n\d- Turn on/off the PM"ON_OFF[pmon[id]])
    
menu_additem(menu3,menu_text);
    
    
formatex(menu_text,charsmax(menu_text),"PM Sounds  ^t^t^t^t^t^t^t^t^t%s^n\d- Turn on/off the PM sound"ON_OFF[pmsound[id]])
    
menu_additem(menu3,menu_text);
    
    
menu_display(idmenu3)
    
menu_setprop(menu3MPROP_NUMBER_COLOR"\r")
}
public 
menupm_menu_handle(idmenuitem)
{
    switch(
item)
    {
        case 
0:
        {
            switch(
pmon[id])
            {
                case 
false:
                {
                    
pmon[id] = true
                    ChatColor
(id,"!gPrivate Messages !tenabled!g.")
                    
pm_menu(id)
                    
client_cmd(id,"spk buttons/lightswitch2")
                }
                case 
true:
                {
                    
pmon[id] = false
                    ChatColor
(id,"!gPrivate Messages !tdisabled!g.")
                    
pm_menu(id)
                    
client_cmd(id,"spk buttons/lightswitch2")
                }
            }
        }
        case 
1:
        {
            switch(
pmsound[id])
            {
                case 
false:
                {
                    
pmsound[id] = true
                    ChatColor
(id,"!gPrivate Messages sound !tenabled!g.")
                    
pm_menu(id)
                    
client_cmd(id,"spk buttons/lightswitch2")
                }
                case 
true:
                {
                    
pmsound[id] = false
                    ChatColor
(id,"!gPrivate Messages sound !tdisabledo!g.")
                    
pm_menu(id)
                    
client_cmd(id,"spk buttons/lightswitch2")
                }
            }
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}
public 
cmd_privatemessage(id)
{
    new 
iMenu menu_create("Private Message \w (\r /private \w)","cmd_pm")
    
    static 
opcion[64]
    new 
players[32], pnumtempid
    
new szName[32], szTempid[10]
    
    
get_players(playerspnum"h")
    
    for( new 
ii<pnumi++ )
    {
        
tempid players[i]
        
        
get_user_name(tempidszName31)
        
num_to_str(tempidszTempid9)
        
        
formatex(opcioncharsmax(opcion), "\w%s"szName)
        
menu_additem(iMenuopcionszTempid0)
    }
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
cmd_pm(idmenuitem)
{
    new 
Data[6], Name[64]
    new 
AccessCallback
    menu_item_getinfo
(menuitemAccessData,5Name63Callback)
    
    new 
tempid str_to_num(Data)
    
    
gidPlayer[id] = tempid
    client_cmd
(id"messagemode Private")
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

public 
cmd_player(id)
{
    new 
say[300]
    
read_args(saycharsmax(say))
    
    
remove_quotes(say)
    
    if(
equal(say""))
        return 
PLUGIN_HANDLED
        
    
cmd_send_pm(idsay)   
    return 
PLUGIN_CONTINUE;
}

public 
cmd_send_pm(idsay[])
{
    new 
player gidPlayer[id];
    
    
printMessage(playeridsay)
    return 
PLUGIN_HANDLED;
}
stock printMessage(recieversender, const message[])
{
    new 
name[32];
    
get_user_name(sendernamecharsmax(name))
    new 
szname[32];
    
get_user_name(reciever,szname,31)
    if(!
pmon[reciever])
    {
        if(
pmsound[sender])
            
client_cmd(sender,"spk misc/sent.wav")
            
        if(
pmsound[reciever])
            
client_cmd(reciever,"spk misc/incaa.wav")
            
        
ChatColor(sender,"!g[!yPrivate!g]!y To: !t%s!y message:!t %s"sznamemessage)
        
ChatColor(reciever,"!g[!yPrivate!g]!y Player !t %s!y: !t %s"namemessage)
    }
    else
    {
        
ChatColor(reciever,"!g[!yPrivate!g]!y !t%s!y want not receive private messages."name)
    }
    return 
PLUGIN_HANDLED
}
stock ChatColor(const id, const input[], any:...) 
{
    new 
count 1players32 ]
    static 
msg191 ]
    
vformatmsg190input)
   
    
replace_allmsg190"!g""^4" )
    
replace_allmsg190"!y""^1" )
    
replace_allmsg190"!t""^3" )

   
    if(
idplayers] = id; else get_playersplayerscount"ch" )
    {
        for(new 
0counti++)
        {
                 if( 
is_user_connectedplayers] ) )
                 {
                
message_beginMSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players] )  
                
write_byteplayers] )
                
write_stringmsg )
                
message_end( )
            }
        }
    }

Yea, the code is horrible but it works. You can try it if you want.
Attached Files
File Type: zip misc.zip (5.8 KB, 26 views)
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 01-12-2017 at 19:25.
EFFx is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-13-2017 , 06:43   Re: Private Message
Reply With Quote #12

Lol, some plugins never die, especially its made from exolent.
__________________
Relaxing is offline
Reply



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 05:48.


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