need help as soon as possible plss.. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: need help as soon as possible plss.. (
/showthread.php?tid=498477)
need help as soon as possible plss.. -
iThePunisher - 03.03.2014
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
Re: need help as soon as possible plss.. -
[XST]O_x - 03.03.2014
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;
}
Re: need help as soon as possible plss.. -
iThePunisher - 03.03.2014
still same error
Re: need help as soon as possible plss.. -
Scenario - 03.03.2014
Don't use OnPlayerUpdate for this!
https://sampwiki.blast.hk/wiki/OnPlayerInteriorChange
Re: need help as soon as possible plss.. -
iThePunisher - 03.03.2014
thanks its fixed
+rep