PDA

View Full Version : What am I doing wrong? I don't get it =/


SamuraiBarbi
08-28-2007, 06:37
Ok, I'm very new to SourceMod and AMX's style of coding things. I'm trying to get some sounds to play during the round_end event that I've hooked but I keep getting compiling errors specifically related to this code. Can someone please tell me what I'm doing incorrectly?


public HookRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
decl String:winningSound[64];
new winningTeam = GetEventInt(event, "winner");

if (winningTeam == 1)
{
new randomSound = GetRandomInt(0,2);
new Handle:WinSoundList[3];
WinSoundList[0] = "bot/well_done.wav";
WinSoundList[1] = "bot/nice_work_team.wav";
WinSoundList[2] = "bot/good_job_team.wav";
winningSound = WinSoundList[randomSound];

}
if (winningTeam == 2)
{
new randomSound = GetRandomInt(0,1);
new Handle:WinSoundList[1];
WinSoundList[0] = "ambient/creatures/town_zombie_call1.wav";
winningSound = WinSoundList[randomSound];
}

new playersconnected;
playersconnected = GetMaxClients();
for (new i = 1; i <= playersconnected; i++)
{

if(IsClientInGame(i))
{


ClientCommand(i,"play %s",winningSound);

}

}

}

^BuGs^
08-28-2007, 08:37
public Action:*

dalto
08-28-2007, 10:31
It is your definition of WinSoundsList. It looks like you want to have an array of Strings to hold sound names.

It should be defined something like this:

decl String:WinSoundList[3][64]

where 3 is the number of sounds and 64 is the maximum length of the string.

SamuraiBarbi
08-28-2007, 11:19
oooo thx! i've give that a try