PDA

View Full Version : Audio plugin problem


Ripster
20/02/2016, 12:06 PM
I made a little script, which can help me to play sounds with 3D effect. So when the player gets further away from it, the music gets more and more quiet by the range variable. But the whole thing just doesn't work at all. Do you see any flaws in it?


stock PlaySoundEx(playerid, sound, Float:range)
{
new Float:x, Float:y, Float:z, handle;
GetPlayerPos(playerid, x, y, z);
foreach(Player, i) if(IsPlayerInRangeOfPoint(i, range, x, y, z))
{
handle = Audio_Play(i, sound, false, false, true);
Audio_Set3DPosition(i, handle, x, y, z, range);
}
return 1;
}


use:

#define CAT_SOUND 1

PlaySoundEx(playerid, CAT_SOUND, 10.0);