07.04.2012, 17:12
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
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
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;
}
becosue you want the music to play for everyone on the server.
and the PlayAudioStreamForPlayer only playes it for 1 player

