PDA

View Full Version : All hear music.


TouhGear
19/12/2011, 10:57 AM
How make system, when all login in my server and they hear music in background when they play?

Max_Coldheart
19/12/2011, 10:58 AM
PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0) (http://wiki.sa-mp.com/wiki/PlayAudioStreamForPlayer) might help you.

demonarn
19/12/2011, 01:38 PM
http://wiki.sa-mp.com/wiki/PlayerPlaySound .
and if you want to make it dissapear just add 1 to the sound id
EXAMPLE

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;
}

TouhGear
19/12/2011, 01:45 PM
Thanks, but how make system, when i write the command /playmusicforall and all server people hear for example real life radio?

[DOG]irinel1996
19/12/2011, 02:15 PM
It's easy bro.

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;
}

LiamM
19/12/2011, 07:28 PM
It's easy bro.

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)) ???