Audio Stream Looping and Start
#1

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!
Reply
#2

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;
}
Reply
#3

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.
Reply
#4

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

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.
Reply
#6

Then use OnPlayerStateChange lol !
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)