Alarm System with PlayAudioStreamForPlayer.
#1

pawn Код:
forward HouseAlarm();
public HouseAlarm()
{
    foreach(i, Player)
    {
        if(NearAlarm[playerid] > 0 && HouseAlarm[NearAlarm[playerid]] == 1)
        {
            PlayAudioStreamForPlayer(i, "http://yourlisten.com/GrantAlexander/burglar-intruder-alarm-sound-effect", HouseEntX[NearAlarm[playerid]], HouseEntY[NearAlarm[playerid]], HouseEntZ[NearAlarm[playerid]], 50, 1);
        }
        if(NearAlarm[playerid] > 0 && HouseAlarm[NearAlarm[playerid]] == 2)
        {
            PlayAudioStreamForPlayer(i, "http://yourlisten.com/GrantAlexander/burglar-intruder-alarm-sound-effect", HouseEntX[NearAlarm[playerid]], HouseEntY[NearAlarm[playerid]], HouseEntZ[NearAlarm[playerid]], 100, 1);
        }
        if(NearAlarm[playerid] > 0 && HouseAlarm[NearAlarm[playerid]] == 3)
        {
            PlayAudioStreamForPlayer(i, "http://yourlisten.com/GrantAlexander/burglar-intruder-alarm-sound-effect", HouseEntX[NearAlarm[playerid]], HouseEntY[NearAlarm[playerid]], HouseEntZ[NearAlarm[playerid]], 150, 1);
        }
    }
 }
Doing this will cause lag and I want the system for anyone who is near the house to hear, running a loop for each player every 2 or 3 seconds would cause lag.

How can I do it so I can make the sound play for any player when they are near the co-ordinates of the house without looping through all the players?
Reply


Messages In This Thread
Alarm System with PlayAudioStreamForPlayer. - by Dokins - 22.02.2015, 19:52
Re: Alarm System with PlayAudioStreamForPlayer. - by Maximus0 - 22.02.2015, 19:59
Re: Alarm System with PlayAudioStreamForPlayer. - by Dokins - 22.02.2015, 20:10
Re: Alarm System with PlayAudioStreamForPlayer. - by zT KiNgKoNg - 22.02.2015, 20:12
Re: Alarm System with PlayAudioStreamForPlayer. - by Dokins - 22.02.2015, 20:13
Re: Alarm System with PlayAudioStreamForPlayer. - by zT KiNgKoNg - 22.02.2015, 20:20
Re: Alarm System with PlayAudioStreamForPlayer. - by Dokins - 22.02.2015, 20:32
Re: Alarm System with PlayAudioStreamForPlayer. - by Kenway - 22.02.2015, 21:02

Forum Jump:


Users browsing this thread: 1 Guest(s)