Liberty Unleashed

Scripting => Script Help => Topic started by: Beary on July 22, 2015, 11:03:35 am

Title: Need some help
Post by: Beary on July 22, 2015, 11:03:35 am
Hello everyone, I also encountered some problems in making my server.

I would like to know how to make Sound for all playing together?

There are some servers have the same ring into the mission, how does this make? For example a player enters the circle to send a message

I am very anxious hope you can help me!
Title: Re: Need some help
Post by: Ankris on July 22, 2015, 11:42:25 am
From crazy server:

Code: [Select]
function PlaybackSound(sound, player = null, pos = null) {
local name = sound, sound = FindSound(sound);
if (sound) {
if (typeof player == "integer"){
local radius = player;
for (local i = 0; i < GetMaxPlayers(); i++) {
player = FindPlayer(i);
if (player) {
if (GetDistance(player.Pos, pos) < radius) PlaybackSound(name, player);
}
}
}
else {
if (sound.Open(player)) sound.Play(player);
else {
sound.Close(player);
sound.Open(player);
sound.Play(player);
}
}
}
else throw("PlaybackSound(): No sound file");
}

Example:
- Radius: PlaybackSound("headshot.mp3", 30, player.Pos);
- Everyone: PlaybackSound("headshot.mp3");
- Player: PlaybackSound("headshot.mp3", player);
Title: Re: Need some help
Post by: Beary on July 22, 2015, 12:02:31 pm
From crazy server:

Code: [Select]
function PlaybackSound(sound, player = null, pos = null) {
local name = sound, sound = FindSound(sound);
if (sound) {
if (typeof player == "integer"){
local radius = player;
for (local i = 0; i < GetMaxPlayers(); i++) {
player = FindPlayer(i);
if (player) {
if (GetDistance(player.Pos, pos) < radius) PlaybackSound(name, player);
}
}
}
else {
if (sound.Open(player)) sound.Play(player);
else {
sound.Close(player);
sound.Open(player);
sound.Play(player);
}
}
}
else throw("PlaybackSound(): No sound file");
}

Example:
- Radius: PlaybackSound("headshot.mp3", 30, player.Pos);
- Everyone: PlaybackSound("headshot.mp3");
- Player: PlaybackSound("headshot.mp3", player);

Sorry, I do not know how to use it?
For example, I enter the command / music, everyone playing music gta.mp3, so how do?
Title: Re: Need some help
Post by: Ankris on July 22, 2015, 02:04:58 pm
eeeh, did you add the sound name in XML + sound file in Sounds\ folder?