Help with Audio Plugin
#1

How would I be able to make it so that my script would select a random variable according to a timer.

Here are the variables:
pawn Code:
new RadioAd1[MAX_PLAYERS];
new RadioAd2[MAX_PLAYERS];
new RadioAd3[MAX_PLAYERS];
Here is the timer:
pawn Code:
forward Advertisements(playerid);
new Ad1;
new Ad2;
new Ad3;

SetTimer("Advertisements", 180000, true);

public Advertisements(playerid)
{
    if(Listening[playerid] = 1)
    {
        if(RadioAd1[playerid] = 1)
        {
            Audio_Pause(Radio[playerid]);
            Ad1 = SetTimer("RadioAdvert1", 29162, true);
            Audio_PlayForAll(1);
        }
        else if(RadioAd2 = 1)
        {
            Audio_Pause(Radio[playerid]);
            Ad2 = SetTimer("RadioAdvert2", 29833, true);
            Audio_PlayForAll(2);
        }
        else if(RadioAd3 = 1)
        {
            Audio_Pause(Radio[playerid]);
            Ad3 = SetTimer("RadioAdvert3", 33393, true);
            Audio_PlayForAll(3);
        }
    }
    return 1;
}
Here are the other timers' codes:
pawn Code:
public RadioAdvert1(playerid)
{
    Audio_Resume(Radio[playerid]);
    KillTimer(Ad1);
}

public RadioAdvert2(playerid)
{
    Audio_Resume(Radio[playerid]);
    KillTimer(Ad2);
}

public RadioAdvert3(playerid)
{
    Audio_Resume(Radio[playerid]);
    KillTimer(Ad3);
}
What I am doing is making it so whichever variable is selected it will play a sound and start a timer that is equivalent to the length of the sound. When the timer is done it will start playing the Radio Station that the player was listening to.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)