SA-MP Forums Archive
All hear music. - 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: All hear music. (/showthread.php?tid=304654)



All hear music. - TouhGear - 19.12.2011

How make system, when all login in my server and they hear music in background when they play?


Re: All hear music. - Max_Coldheart - 19.12.2011

PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0) might help you.


Re: All hear music. - demonarn - 19.12.2011

https://sampwiki.blast.hk/wiki/PlayerPlaySound .
and if you want to make it dissapear just add 1 to the sound id
EXAMPLE
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    PlayerPlaySound(playerid, 1097, -2146.9839,-90.9392,41.5966);

    return 1;
}
public OnPlayerSpawn(playerid)
{
    PlayerPlaySound(playerid, 1098, -2146.9839,-90.9392,41.5966);
       return 1;
}



Re: All hear music. - TouhGear - 19.12.2011

Thanks, but how make system, when i write the command /playmusicforall and all server people hear for example real life radio?


Respuesta: All hear music. - [DOG]irinel1996 - 19.12.2011

It's easy bro.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //---    
    if(strcmp(cmdtext, "/playmusicforall", true) == 0)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
             PlayAudioStreamForPlayer(i, "http://somafm.com/tags.pls"); //Example.
        }
        return 1;
    }
    if(strcmp(cmdtext, "/stopmusicforall", true) == 0)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            StopAudioStreamForPlayer(i); //Example.
        }
        return 1;
    }
    //---
    return 0;
}



Re: Respuesta: All hear music. - LiamM - 19.12.2011

Quote:
Originally Posted by irinel1996
Посмотреть сообщение
It's easy bro.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //---    
    if(strcmp(cmdtext, "/playmusicforall", true) == 0)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
             PlayAudioStreamForPlayer(i, "http://somafm.com/tags.pls"); //Example.
        }
        return 1;
    }
    if(strcmp(cmdtext, "/stopmusicforall", true) == 0)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            StopAudioStreamForPlayer(i); //Example.
        }
        return 1;
    }
    //---
    return 0;
}
I'm probably wrong dude but shouldn't it check If(IsPlayerConnected(i))