I currently have the plugin >> playersounds.amxx and it works great!! Everyone can hear it. Only one thing, the players entering do not hear their own joining music/sound WAVE. Below is the script. What needs to be modified so that players can hear their own joining wave. Any help is greatly appreciated.
#include <amxmodx>
#include <amxmisc>
/////////////////////////////////////////////////////////////////////////////////////////
// Version Control
//
new AUTH[] = "|BW|.Zor"
new PLUGIN_NAME[] = "amxx_playersounds.amxx"
new VERSION[] = "0.3b"
//
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// Defines
#define MAX_PLAYERS_SAYS 64
//
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// Globals
//
// Files that will be used
new fileName[64] = "joinleave.txt"
new playerArrayLen
new playerPosition[33]
new identification[MAX_PLAYERS_SAYS][128]
new joinsays[MAX_PLAYERS_SAYS][128]
new joinsounds[MAX_PLAYERS_SAYS][128]
new leavesays[MAX_PLAYERS_SAYS][128]
new leavesounds[MAX_PLAYERS_SAYS][128]
//
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// This is where the plugin is initialized
//
public plugin_init()
{
// Register this plugin
register_plugin(PLUGIN_NAME, VERSION, AUTH)
}
/////////////////////////////////////////////////////////////////////////////////////////
// This is where the plugin precaches all data that will be needed to be prcached...
// models, sounds etx
//
public plugin_precache()
{
// Get the placement of the joinleave file
new folderName[64]
get_configsdir(folderName, 63)
format(fileName, 63, "%s/%s", folderName, fileName)
// Loop through the join leave text to precache all the soundsup to max lines
new a = 0, pos = 0, readLine[1024]
playerArrayLen = 0
while( (read_file(fileName, pos, readLine, 1023, a)) && (playerArrayLen < MAX_PLAYERS_SAYS) )
{
// Check to see if a comment
if(!equal(readLine, "//", 2) && strlen(readLine) > 0)
{
// Not comments carry on
// Split the lines up and get all the needed data
parse(readLine, identification[playerArrayLen], 127, joinsays[playerArrayLen], 127, joinsounds[playerArrayLen], 127, leavesays[playerArrayLen], 127, leavesounds[playerArrayLen], 127)
playerArrayLen++
}
pos++
}
for(new x = 0; x < playerArrayLen; x++)
{
if(strlen(joinsounds[x]) > 0 && strlen(leavesounds[x]) > 0)
{
precache_sound(joinsounds[x])
precache_sound(leavesounds[x])
}
else
{
log_amx("[Player Sounds] Error loading sound: Position: %d", (x + 1))
}
}
return PLUGIN_CONTINUE
}
/////////////////////////////////////////////////////////////////////////////////////////
// When players are put in the server this part is called. So we want to find them and
// say their say and play their sound
//
public client_putinserver(id)
{
playerPosition[id] = findPlayerStuff(id)
// Ok we found someone
if( playerPosition[id] > -1 )
{
set_hudmessage()
if(strlen(joinsays[playerPosition[id]]) > 0)
show_hudmessage(0, "%s", joinsays[playerPosition[id]])
if(strlen(joinsounds[playerPosition[id]]) > 0)
emit_sound(0, CHAN_VOICE, joinsounds[playerPosition[id]], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
return PLUGIN_CONTINUE
}
/////////////////////////////////////////////////////////////////////////////////////////
// When players disconnect this part is called. So we want to find them and say their say
// and play their sound
//
public client_disconnect(id)
{
// Ok we found someone
if( playerPosition[id] > -1 )
{
set_hudmessage()
if(strlen(leavesays[playerPosition[id]]) > 0)
show_hudmessage(0, "%s", leavesays[playerPosition[id]])
if(strlen(leavesounds[playerPosition[id]]) > 0)
emit_sound(0, CHAN_VOICE, leavesounds[playerPosition[id]], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
playerPosition[id] = -1
}
return PLUGIN_CONTINUE
}
/////////////////////////////////////////////////////////////////////////////////////////
// We try to find the player joining in our list, if not there we return a -1 to say not
// there to calling functions
//
findPlayerStuff(id)
{
new authid[32], ip[32], count = 0
get_user_authid(id, authid, 32)
get_user_ip(id, ip, 32, 1)
while(count < playerArrayLen)
{
if(equal(authid, identification[count]) || equal(ip, identification[count]))
{
return count
}
count++
}
return -1
}
|