16.06.2009, 15:13
(
Last edited by Incognito; 26/06/2013 at 10:30 PM.
)
Tutorial
Client:
Installation and use of the client plugin is simple. Just run the installer and extract the files to the GTA: San Andreas directory. The ASI plugin detects when SA-MP is loaded and obtains the current player name, server address, and server port automatically. It will then attempt to connect to the TCP server (if there is one) some time after the game has started. By default, there will be a total of ten retry attempts with a delay of ten seconds each. To adjust these numbers, along with a few other settings, audio.ini will need to be edited. To locate this file, go to Start, click Run, and type in the following:
An Explorer window should open. This directory contains all downloaded audio packs, audio.ini, and audio.txt. Note that these files will only be created once the audio plugin is loaded for the first time.
Server:
Create a directory called "plugins" inside of the server directory if one does not already exist. Place the plugin file (audio.dll or audio.so) inside of this directory.
Add the following line to server.cfg so that the plugin will load the next time the server starts:
Windows:
Linux:
On Windows, add audio.inc to the pawno\include folder. Include this file in any of the scripts the server is running:
Recompile the scripts with any desired natives and callbacks provided by the include file. Start the server.
The server log should indicate that the TCP server was created successfully on the same port that the SA-MP sever is using.
Ensure that both the audiopacks folder and the audio.ini file are in the root directory of the server. Open audio.ini and add a section for the audio pack name. For demonstration purposes, this will be called "default_pack":
Navigate to the audiopacks directory and create a folder called "default_pack" within it. This is where all of the local audio files will go. Add an audio file to the "default_pack" folder. This will be called "file.wav". Map it under the section that was just created in audio.ini:
The number to the left of the file name (1) is the audio ID. It is completely arbitrary. It can be used in Audio_Play like this:
Remote files that don't need to be in the audiopacks directory can also be mapped. They must start with "http://". Here is an example:
Now the audio pack simply needs to be set when the gamemode loads:
Alternatively, it is possible to completely ignore audio.ini and stream all of the files with the Audio_PlayStreamed native instead. This will consume more client-side bandwidth, however, if the files are played repeatedly.
More detailed examples of nearly every native and callback can be found in the filterscript.
Client:
Installation and use of the client plugin is simple. Just run the installer and extract the files to the GTA: San Andreas directory. The ASI plugin detects when SA-MP is loaded and obtains the current player name, server address, and server port automatically. It will then attempt to connect to the TCP server (if there is one) some time after the game has started. By default, there will be a total of ten retry attempts with a delay of ten seconds each. To adjust these numbers, along with a few other settings, audio.ini will need to be edited. To locate this file, go to Start, click Run, and type in the following:
Code:
%APPDATA%\SA-MP Audio Plugin
Server:
Create a directory called "plugins" inside of the server directory if one does not already exist. Place the plugin file (audio.dll or audio.so) inside of this directory.
Add the following line to server.cfg so that the plugin will load the next time the server starts:
Windows:
Code:
plugins audio.dll
Code:
plugins audio.so
pawn Code:
#include <audio>
The server log should indicate that the TCP server was created successfully on the same port that the SA-MP sever is using.
Ensure that both the audiopacks folder and the audio.ini file are in the root directory of the server. Open audio.ini and add a section for the audio pack name. For demonstration purposes, this will be called "default_pack":
Code:
[default_pack]
Code:
[default_pack] 1 = file.wav
pawn Code:
Audio_Play(playerid, 1);
Code:
[default_pack] 1 = file.wav 2 = http://www.website.com/file.wav
pawn Code:
public OnGameModeInit()
{
Audio_SetPack("default_pack");
}
More detailed examples of nearly every native and callback can be found in the filterscript.