need help as soon as possible plss..
#1

i wanted to play stream when someone is in interior
i tried to make it , but i dont know where is the bug and when i get inside the interior (The Stream start spaming, and there is to much lag)
Edit: if you gonna help me please explain me what i did wrong i want to teach this .
here is the code
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerInterior(playerid) == 6)
    {
        PlayAudioStreamForPlayer(playerid, "http://www.pamp3.site40.net/quake/doublekill.mp3", 2554.4253, 1417.2795, 7703.7041, 50.0, 1);
    }
    else
    {
        StopAudioStreamForPlayer(playerid);
    }
here are some photos




Reply
#2

The error here is that the stream is played regardless if it's already playing or not.
pawn Код:
new isPlaying[MAX_PLAYERS] = {0,...};

public OnPlayerUpdate(playerid)
{
    if(GetPlayerInterior(playerid) == 6 && !isPlaying[playerid]) {
        PlayAudioStreamForPlayer(playerid, "http://www.pamp3.site40.net/quake/doublekill.mp3", 2554.4253, 1417.2795, 7703.7041, 50.0, 1);
        isPlaying[playerid] = 1;
    }
    else {
        StopAudioStreamForPlayer(playerid);
        isPlaying[playerid] = 0;
   }
   return 1;
}
Reply
#3

still same error
Reply
#4

Don't use OnPlayerUpdate for this! https://sampwiki.blast.hk/wiki/OnPlayerInteriorChange
Reply
#5

thanks its fixed
+rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)