Why is this crashing my game?
#1

Hey guys, I'm trying to stream some sounds when a player enters a specific area but each time I go to the area it crashes my game as soon as the audio file starts to play. What I have is below, any help would be great!

pawn Код:
#include <a_samp>

new MusicCheck;
public OnPlayerConnect(playerid)
{
    MusicCheck = SetTimer("StartMusic", 1000, 1);
    return 1;
}

forward StartMusic();
public StartMusic()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(i, X, Y, Z);
        if(IsPlayerInRangeOfPoint(i, 60, -2805.3826,-1525.0806,139.7182))
        {
            new Float:Distance = 60;
            PlayAudioStreamForPlayer(i, "http://ft.dtupload.com/Uo/Dark_Ambient.mp3", X, Y, Z, Distance, 1);
            KillTimer(MusicCheck);
        }
    }
}
Reply
#2

replace
Код:
PlayAudioStreamForPlayer(i, "http://ft.dtupload.com/Uo/Dark_Ambient.mp3", X, Y, Z, Distance, 1);
with

PlayAudioStreamForPlayer(i, "http://ft.dtupload.com/Uo/Dark_Ambient.mp3");

or

PlayAudioStreamForPlayer(i, "http://ft.dtupload.com/Uo/Dark_Ambient.mp3", -2805.3826,-1525.0806,139.7182, 60, 1);
Reply
#3

Why dont you simply put that in your GM, it will play a song for the player which connects to your server.

Код:
public OnPlayerConnect()

PlayAudioStreamForPlayer(playerid, "http://ft.dtupload.com/Uo/Dark_Ambient.mp3");
Код:
public OnPlayerSpawn(playerid)

StopAudioStreamForPlayer(playerid);
- and this will stop it when he/she spawns.
Reply
#4

he wants it to play when the player is in a area
Reply
#5

Quote:
Originally Posted by trapstar2020
Посмотреть сообщение
replace
Код:
PlayAudioStreamForPlayer(i, "http://ft.dtupload.com/Uo/Dark_Ambient.mp3", X, Y, Z, Distance, 1);
with

PlayAudioStreamForPlayer(i, "http://ft.dtupload.com/Uo/Dark_Ambient.mp3");

or

PlayAudioStreamForPlayer(i, "http://ft.dtupload.com/Uo/Dark_Ambient.mp3", -2805.3826,-1525.0806,139.7182, 60, 1);
Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)