SA-MP Forums Archive
Audio Stream Looping and Start - 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: Audio Stream Looping and Start (/showthread.php?tid=380328)



Audio Stream Looping and Start - GoldenM4 - 24.09.2012

Okay well this is pretty complicated for me so i'm asking for your help!
Okay so Basically i need a Audio stream that starts at a certain point

for example on my vehicle when the health goes >25 I want a audio playback looping till the car explodes or the person gets out. I'm having a little trouble i appreciate the help guys!


Re: Audio Stream Looping and Start - XtremeR - 25.09.2012

Its Easy

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    new Float:health;
    new veh;
    veh = GetPlayerVehicleID(playerid);
    GetVehicleHealth(veh, health);
    if(health >250) return PlayAudioStreamForPlayer(playerid, "link here", X, Y, Z, Distance, 1);
    return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{

StopAudioStreamForPlayer(playerid); // Stop the audio stream
    return 1;
}



Re: Audio Stream Looping and Start - YourLord - 25.09.2012

You're wrong,a car health is betweeen 0 - 1000. But, while it is less than 250 it start to burn and then explode. By the way the "veh" var is useless, the callback itself has that.


Re: Audio Stream Looping and Start - XtremeR - 25.09.2012

oh edited the main and done it to 250 and i tested it its working... for me


Re: Audio Stream Looping and Start - GoldenM4 - 26.09.2012

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
Its Easy

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    new Float:health;
    new veh;
    veh = GetPlayerVehicleID(playerid);
    GetVehicleHealth(veh, health);
    if(health >250) return PlayAudioStreamForPlayer(playerid, "link here", X, Y, Z, Distance, 1);
    return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{

StopAudioStreamForPlayer(playerid); // Stop the audio stream
    return 1;
}
Alright this is great but what if i want it to play for only a certain vehicle and i don't want it to play when a player enters the vehicle i want it to play eg when the health gets low when it's shot by a missile or a gun and when it gets to that health point then it should play like that is that possible to script? Also to loop it the sound too.


Re: Audio Stream Looping and Start - Lilcuete - 26.09.2012

Then use OnPlayerStateChange lol !