
Originally Posted by
nativesith
If ya open the audio files(RPF's) with Open IV dat is where one will find the ivaud files of the PC ED.
I will have another look. Thanks nativesith.
EDIT:
The sound test has crashed the game, it is associated with GET_CHAR_COORDINATES. Don't see whats wrong.
Code:
#include <common.h>
void main(void) {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Sound test script loaded", 1000, 1);
WAIT(3000);
uint soundId = -1;
Ped player = GetPlayerIndex();
int loopTerminating = 0;
float x, y, z;
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Registering script with audio", 1000, 1);
WAIT(3000);
REGISTER_SCRIPT_WITH_AUDIO(0);
if(soundId == -1) {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Getting sound ID", 1000, 1);
WAIT(3000);
soundId = GET_SOUND_ID();
}
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Attempting to load audio bank", 1000, 1);
WAIT(3000);
if(REQUEST_AMBIENT_AUDIO_BANK("SCRIPT_AMBIENT/CAR_WASH")) {
AMBIENT_AUDIO_BANK_NO_LONGER_NEEDED();
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Audio bank loaded", 1000, 1);
WAIT(3000);
}
do {
if(IS_BUTTON_PRESSED(0, BUTTON_L1) && IS_BUTTON_PRESSED(0, BUTTON_R1)) {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Button combination caught", 1000, 1);
WAIT(3000);
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Received request", 1000, 1);
WAIT(3000);
if(HAS_SOUND_FINISHED(soundId)) {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "No sound playing", 1000, 1);
WAIT(3000);
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Getting character coordinates", 1000, 1);
WAIT(3000);
GET_CHAR_COORDINATES(player, &x, &y, &z);
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Playing sound from position", 1000, 1);
WAIT(3000);
PLAY_SOUND_FROM_POSITION(soundId, "CAR_WASH_SPRAY", x, y, z);
}
else {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Sound currently playing", 1000, 1);
WAIT(3000);
}
}
WAIT(100);
}
while(loopTerminating != 1);
UNREGISTER_SCRIPT_WITH_AUDIO();
return;
}
I know why it crashed. I am using GetPlayerIndex() again... I should be using GetPlayerPed().
EDIT:
Okay, no crashes now, and the native is called without failure. The only issue is, I hear no sound associated with a car wash. Any ideas?
Code:
#include <common.h>
void main(void) {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Sound test script loaded", 1000, 1);
WAIT(3000);
uint soundId = -1;
Ped player = GetPlayerPed();
int loopTerminating = 0;
float x, y, z;
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Registering script with audio", 1000, 1);
WAIT(3000);
REGISTER_SCRIPT_WITH_AUDIO(0);
if(soundId == -1) {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Getting sound ID", 1000, 1);
WAIT(3000);
soundId = GET_SOUND_ID();
}
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Attempting to load audio bank", 1000, 1);
WAIT(3000);
if(REQUEST_AMBIENT_AUDIO_BANK("SCRIPT_AMBIENT/CAR_WASH")) {
AMBIENT_AUDIO_BANK_NO_LONGER_NEEDED();
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Audio bank loaded", 1000, 1);
WAIT(3000);
}
do {
if(IS_BUTTON_PRESSED(0, BUTTON_L1) && IS_BUTTON_PRESSED(0, BUTTON_R1)) {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Button combination caught", 1000, 1);
WAIT(3000);
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Received request", 1000, 1);
WAIT(3000);
if(HAS_SOUND_FINISHED(soundId)) {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "No sound playing", 1000, 1);
WAIT(3000);
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Getting character coordinates", 1000, 1);
WAIT(3000);
GET_CHAR_COORDINATES(player, &x, &y, &z);
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Playing sound from position", 1000, 1);
WAIT(3000);
PLAY_SOUND_FROM_POSITION(soundId, "CAR_WASH_SPRAY", x, y, z);
}
else {
PRINT_STRING_WITH_LITERAL_STRING("STRING", "Sound currently playing", 1000, 1);
WAIT(3000);
}
}
WAIT(100);
}
while(loopTerminating != 1);
UNREGISTER_SCRIPT_WITH_AUDIO();
return;
}
Going to try another sound, and if that doesn't work, I am going to leave it to someone else. I am pretty confident this is how you work with audio. The body guard script is coming along nicely. Working online and offline. The formation is fanastic! Had everyones attention. (: