Play music
#7

ok go to your position where you want the music to play and type/ save pos [name]
then get your saved position
and you can do something like this
pawn Код:
//make a new timer
new PlayerTimer[MAX_PLAYERS];

OnPlayerSpawn(playerid)
{
     PlayerTimer[playerid] = SetTimerEx("EnterArea", 2000, true, "i", 1337);//Start the timer when the player spawns
     return 1;
}

OnPlayerDeath(playerid, killerid, reason)
{
     KillTimer(PlayerTimer[playerid]);//Kill it so it wouldnt creat lagg after many spawns!
     return 1;
}

forward EnterArea(playerid);
public EnterArea(playerid)//This will chech if the player is near the pos and play it if they are.
{
     if(IsPlayerInRangeOfPoint(playerid, Distance, X,Y,Z)) PlayAudioStreamForPlayer(playerid, "http://", X, Y, Z, Distance, 1);//cahnge the "URL,X,Y,Z & Distace"
     else StopAudioStreamForPlayer(playerid);
     return 1;
}
Why we need the timer ?
becosue you want the music to play for everyone on the server.
and the PlayAudioStreamForPlayer only playes it for 1 player
Reply


Messages In This Thread
Play music - by DannySnoopy - 07.04.2012, 11:11
Re: Play music - by Harish - 07.04.2012, 11:19
Re: Play music - by Reklez - 07.04.2012, 11:21
Re: Play music - by TzAkS. - 07.04.2012, 11:33
Re: Play music - by DannySnoopy - 07.04.2012, 11:43
Re: Play music - by DannySnoopy - 07.04.2012, 17:01
Re: Play music - by park4bmx - 07.04.2012, 17:12
Re: Play music - by Nicholas. - 07.04.2012, 17:17

Forum Jump:


Users browsing this thread: 1 Guest(s)