Raised This Month: $ Target: $400
 0% 

[Help] PM - PRivate Message


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
bloody806
Member
Join Date: Jun 2012
Location: Czech Republic
Old 03-08-2013 , 17:37   [Help] PM - PRivate Message
Reply With Quote #1

HI I have a plugin, but doent work.
Shows no error in log and console can normal compile.

PRoblem:
When I want to send a message, so the message doesnt comes a given player.
Please help

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

#define PLUGIN "PM - Private Message"
#define VERSION "1.0"
#define AUTHOR "85filip58"

static const PREFIX[] = "[PM]"

new gidPlayer[33]; 

new const 
pm_sound[] = { "pm/pm_sound.wav" }

public 
plugin_init() 
{
   
register_plugin(PLUGINVERSIONAUTHOR)
   
   
register_clcmd("say /pm""cmd_privatemessage")
   
register_clcmd("say_team /pm""cmd_privatemessage")
   
   
register_clcmd("PM""cmd_player");
}

public 
cmd_privatemessage(id)
{
   static 
opcion[64]
   
   
formatex(opcioncharsmax(opcion),"Vyber Hraca")
   new 
iMenu menu_create(opcion"cmd_privatemessage_handler")
   
   new 
players[32], pnumtempid
   
new szName[32], szTempid[10]
   
   
get_players(playerspnum"a")
   
   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_privatemessage_handler(idmenuitem)
{
   if( 
item == MENU_EXIT )
   {
      
menu_destroy(menu)
      return 
PLUGIN_HANDLED
   
}
   
   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 PM")
   
   
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))

   
ColorChat(reciever"!g%s !t%s !y: !g%s"PREFIXnamemessage)
   
client_cmd(reciever"spk ^"%s^""pm_sound)
}

stock ColorChat(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( )
         }
      }
   }


public 
plugin_precache()
{
   
precache_sound(pm_sound)

bloody806 is offline
Send a message via Skype™ to bloody806
 



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 21:45.


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