SA-MP Forums Archive
Why is this crashing my game? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why is this crashing my game? (/showthread.php?tid=381945)



Why is this crashing my game? - V1ceC1ty - 01.10.2012

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);
        }
    }
}



Re: Why is this crashing my game? - trapstar2020 - 01.10.2012

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);


Re: Why is this crashing my game? - Dizzle - 01.10.2012

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.


Re: Why is this crashing my game? - trapstar2020 - 01.10.2012

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


Re: Why is this crashing my game? - V1ceC1ty - 01.10.2012

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!