Member
Join Date: Jun 2012
Location: Czech Republic
|
03-08-2013
, 17:37
[Help] PM - PRivate Message
|
#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(PLUGIN, VERSION, AUTHOR) 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(opcion, charsmax(opcion),"Vyber Hraca") new iMenu = menu_create(opcion, "cmd_privatemessage_handler") new players[32], pnum, tempid new szName[32], szTempid[10] get_players(players, pnum, "a") for( new i; i<pnum; i++ ) { tempid = players[i] get_user_name(tempid, szName, 31) num_to_str(tempid, szTempid, 9) formatex(opcion, charsmax(opcion), "\w%s", szName) menu_additem(iMenu, opcion, szTempid, 0) } menu_display(id, iMenu) return PLUGIN_HANDLED }
public cmd_privatemessage_handler(id, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu) return PLUGIN_HANDLED } new Data[6], Name[64] new Access, Callback menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback) 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(say, charsmax(say)) remove_quotes(say) if(equal(say, "")) return PLUGIN_HANDLED; cmd_send_pm(id, say) return PLUGIN_CONTINUE; }
public cmd_send_pm(id, say[]) { new player = gidPlayer[id]; printMessage(player, id, say) return PLUGIN_HANDLED; } stock printMessage(reciever, sender, const message[]) { new name[32]; get_user_name(sender, name, charsmax(name))
ColorChat(reciever, "!g%s !t%s !y: !g%s", PREFIX, name, message) client_cmd(reciever, "spk ^"%s^"", pm_sound) }
stock ColorChat(const id, const input[], any:...) { new count = 1, players[ 32 ] static msg[ 191 ] vformat( msg, 190, input, 3 ) replace_all( msg, 190, "!g", "^4" ) replace_all( msg, 190, "!y", "^1" ) replace_all( msg, 190, "!t", "^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( ) } } } }
public plugin_precache() { precache_sound(pm_sound) }
|
|