Author Topic: Need some help  (Read 1078 times)

Beary

  • Newbie
  • *
  • Posts: 39
  • Karma: +2/-5
    • View Profile
Need some help
« on: July 22, 2015, 12:03:35 pm »
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!

Ankris

  • Full Member
  • ***
  • Posts: 110
  • Karma: +29/-44
    • View Profile
Re: Need some help
« Reply #1 on: July 22, 2015, 12:42:25 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);

Beary

  • Newbie
  • *
  • Posts: 39
  • Karma: +2/-5
    • View Profile
Re: Need some help
« Reply #2 on: July 22, 2015, 01: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?

Ankris

  • Full Member
  • ***
  • Posts: 110
  • Karma: +29/-44
    • View Profile
Re: Need some help
« Reply #3 on: July 22, 2015, 03:04:58 pm »
eeeh, did you add the sound name in XML + sound file in Sounds\ folder?

 

© Liberty Unleashed Team.