Random Music in car
#1

Hi can anyone help me with adding random music on player enter car
like playaudiostreamforplayer?
Reply
#2

I put this together extremely quickly, I don't have acsess to a compiler so I don't know if it works. But you will get the general concept on how it works.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    RandomMusic(playerid);
    return 1;
}

public OnPlayerExitVehilce(playerid, vehicleid)
{
    StopAudioStreamForPlayer(playerid);
    return 1;
}

stock RandomMusic(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new rand = random(4);
        switch(rand)
        {
            case 0:
            {
                PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");  
            }
            case 1:
            {
                PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");  
            }
            case 2:
            {
                PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");  
            }
            case 3:
            {
                PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");  
            }
            case 4:
            {
                PlayAudioStreamForPlayer(playerid, "MusicStreamUrl");  
            }
        }
    }
        return 1;
}
Reply
#3

compile good but nothing happend ingame
Reply
#4

That's becuase you need to replace the 'MusicStreamUrl' with the URL of the audio file.
Reply
#5

omg i done that im not such a big noob :P
Reply
#6

Try removing the 'IsPlayerInVehicle' check from the stock function.
Reply
#7

same
Reply
#8

Does the audio stream message appear? Also make sure that your radio is turned on in the settings.
Reply
#9

audio stream doesnt show.....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)