I can't seem to find the problem.. People have been saying they've been getting "bad loads" with it:
Code:
#include <amxmodx>
#define PLUGIN "Connect Announce"
#define VERSION "0.2b"
#define AUTHOR "v3x"
new g_iMsgSayText, g_szSoundFile[] = "buttons/blip1.wav";
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_cvar("announce_mode","3");
register_cvar("announce_sound","1");
g_iMsgSayText = get_user_msgid("SayText");
}
/*
announce_mode <0|1|2|3>
0 - Off
1 - Connect announce only
2 - Disconnect announce only
3 - Both
announce_sound <0|1>
0 - No sound
1 - Sound
*/
public plugin_precache()
{
precache_sound(g_szSoundFile);
}
public client_authorized(id)
{
new iMode = get_cvar_num("announce_mode");
if(is_user_bot(id) || iMode == 0 || iMode == 2)
return PLUGIN_CONTINUE;
new szUserName[33];
get_user_name(id, szUserName, 32);
new iPlayers[32], iNum, i;
get_players(iPlayers, iNum);
for(i = 0; i <= iNum; i++)
{
new x = iPlayers[i];
if(!is_user_connected(x) || is_user_bot(x)) continue;
if(get_cvar_num("announce_sound") == 1)
client_cmd(x, "spk %s", g_szSoundFile);
new szMessage[164];
format(szMessage, 163, "^x04%s connected", szUserName);
message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x );
write_byte ( x );
write_string( szMessage );
message_end ();
}
return PLUGIN_CONTINUE;
}
public client_disconnect(id)
{
new iMode = get_cvar_num("announce_mode");
if(is_user_bot(id) || iMode == 0 || iMode == 1)
return PLUGIN_CONTINUE;
new szUserName[33];
get_user_name(id, szUserName, 32);
new iPlayers[32], iNum, i;
get_players(iPlayers, iNum);
for(i = 0; i <= iNum; i++)
{
new x = iPlayers[i];
if(!is_user_connected(x) || is_user_bot(x)) continue;
if(get_cvar_num("connect_sound") == 1)
client_cmd(x, "spk %s", g_szSoundFile);
new szMessage[164];
format(szMessage, 163, "^x04%s disconnected", szUserName);
message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x );
write_byte ( x );
write_string( szMessage );
message_end ();
}
return PLUGIN_CONTINUE;
}
v0.1 is in the Approved Plugins section if you need to see it.