SA-MP Forums Archive
PlayAudioStreamForPlayer() - 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: PlayAudioStreamForPlayer() (/showthread.php?tid=390183)



PlayAudioStreamForPlayer() - zDivine - 05.11.2012

Is this function bugged? Because I made a boombox system and when you play the audio stream, it works fine, but then after a few seconds, it just stops playing...

I then created a simple command:
pawn Code:
CMD:playaudio(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /playaudio [music url]");
   
    if(strlen(params) > 0)
    {
        PlayAudioStreamForPlayer(playerid, params, 0.0, 0.0, 0.0, 50.0, 0);
    }
    return 1;
}
To test the audio function to see if it was just the boombox system, and it does the exact same thing.

Any help?

EDIT: Found out it's only me that the audio stops playing for. Is there something I have to download for it to work properly?


Re: PlayAudioStreamForPlayer() - Glad2BeHere - 05.11.2012

use http://kiwi6.com/ what i recommend and u may wanna use sscanf 4 address, likes s[32] if typing address also u may want 2 use isplayernearplayer, and foreach so something like
pawn Code:
stock IsPlayerNearPlayer(playerid, targetid, Float:radius)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(targetid, x, y, z);
    if(IsPlayerInRangeOfPoint(playerid, radius ,x, y, z))
    {
        return 1;
    }
    return 0;
}
pawn Code:
CMD:playaudio(playerid, params[])
{
if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, -1, "USAGE: /playaudio [music url]");
foreach(Player, i)
{
if(IsPlayerNearPlayer(playerid, i, 10))
{
PlayAudioStreamForPlayer(playerid, params);
}
}
return 1;
}
pawn Code:
CMD:playaudio(playerid, params[])
{
new Float:x, Float:y,Float:z;
GetPlayerPos(playerid, x,y,z);
if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, -1, "USAGE: /playaudio [music url]");
foreach(Player, i)
{
PlayAudioStreamForPlayer(i, params,x,y,z,10,1);
}
return 1;
}



Re: PlayAudioStreamForPlayer() - zDivine - 05.11.2012

Quote:
Originally Posted by Glad2BeHere
View Post
use http://kiwi6.com/ what i recommend and u may wanna use sscanf 4 address, likes s[32] if typing address also u may want 2 use isplayernearplayer, and foreach so something like
pawn Code:
stock IsPlayerNearPlayer(playerid, targetid, Float:radius)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(targetid, x, y, z);
    if(IsPlayerInRangeOfPoint(playerid, radius ,x, y, z))
    {
        return 1;
    }
    return 0;
}
pawn Code:
CMD:playaudio(playerid, params[])
{
if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, -1, "USAGE: /playaudio [music url]");
foreach(Player, i)
{
if(IsPlayerNearPlayer(playerid, i, 10))
{
PlayAudioStreamForPlayer(playerid, params);
}
}
return 1;
}
pawn Code:
CMD:playaudio(playerid, params[])
{
new Float:x, Float:y,Float:z;
GetPlayerPos(playerid, x,y,z);
if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, -1, "USAGE: /playaudio [music url]");
foreach(Player, i)
{
PlayAudioStreamForPlayer(i, params,x,y,z,10,1);
}
return 1;
}
I love how every one of your reply's to threads are of no help whatsoever...


Re: PlayAudioStreamForPlayer() - Glad2BeHere - 05.11.2012

u r the worst, i give u the correct cmd 2 use n u shut it down, u make no sense, i show u how 2 do things right and utube gives trouble with playaudiostreamforplayer,

if u didnt make crap for a cmd u wont be here would u?


Re: PlayAudioStreamForPlayer() - Drake_Lopez - 05.11.2012

Glad2BeHere is right.. I tested it, it worked fine..


Re: PlayAudioStreamForPlayer() - Glad2BeHere - 05.11.2012

please he copy n paste it and like damn hes good


Re: PlayAudioStreamForPlayer() - cosbraa - 05.11.2012

Glad2behere, you should start typing normal.