open.mp forum
[Pawn] How to add music to skin selection menu? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] How to add music to skin selection menu? (/showthread.php?tid=1809)



How to add music to skin selection menu? - CrypticSin - 2021-03-25

Hi i'm trying to figure out how i can add music to a skin selection menu, i would appreciate it if someone can help thanks.



Code:
public OnPlayerRequestClass(playerid, classid)

{

SetPlayerPos(playerid, 2014.6443,1077.2521,48.8207);

SetPlayerFacingAngle(playerid, 357.1971);

SetPlayerCameraPos(playerid,? 2014.9019, 1083.7701, 49.8680);

SetPlayerCameraLookAt(playerid, 2014.8658, 1082.7725, 49.7031);?

return 1;

}



RE: How to add music to skin selection menu? - DandoRYx - 2021-03-25

PHP Code:
public OnPlayerRequestClass(playeridclassid)

{

    
// your skin code...

    
if(GetPVarInt(playerid"playedSong") == 0)

    {

        
SetPVarInt(playerid"playedSong"1);

        
PlayAudioStreamForPlayer(playeridYOUR_AUDIO_STREAM);

    }

}



public 
OnPlayerSpawn(playerid)

{

    
// your spawn code...

    
StopAudioStreamForPlayer(playerid);

    
SetPVarInt(playerid"playedSong"0);

    return 
1;





RE: How to add music to skin selection menu? - Snow - 2021-03-25

Audio stream won't work if a player has set his radio volume to 0. I'd suggest you to use an default sound using PlayerPlaySound.


RE: How to add music to skin selection menu? - CrypticSin - 2021-03-25

(2021-03-25, 09:12 PM)DandoRYx Wrote:
PHP Code:
public OnPlayerRequestClass(playeridclassid)

{

// your skin code...

if(GetPVarInt(playerid"playedSong") == 0)

{

SetPVarInt(playerid"playedSong"1);

PlayAudioStreamForPlayer(playeridYOUR_AUDIO_STREAM);

}

}



public 
OnPlayerSpawn(playerid)

{

// your spawn code...

StopAudioStreamForPlayer(playerid);

SetPVarInt(playerid"playedSong"0);

return 
1;





hi im not sure if im doing it right but, is it something like this?



PHP Code:
public OnPlayerRequestClass(playeridclassid)

{

SetPlayerPos(playerid2014.6443,1077.2521,48.8207);?

SetPlayerFacingAngle(playerid357.1971);

SetPlayerCameraPos(playerid,? 2014.90191083.770149.8680);?

SetPlayerCameraLookAt(playerid2014.86581082.772549.7031);?





if(
GetPVarInt(playerid"playedSong") == 0)

? ? {

? ? ? ? 
SetPVarInt(playerid"playedSong"1);

? ? ? ? 
PlayAudioStreamForPlayer(playerid"https://www.youtube.com/watch?v=y6120QOlsfU");

? ? }

? ? 

? return 
1;





I want to stream the audio from youtube?if possible, or if i do download it how do i stream it during skin selection?


RE: How to add music to skin selection menu? - DandoRYx - 2021-03-25

What I did was I downloaded it as mp3, uploaded it on web and then used it like this:
PHP Code:
PlayAudioStreamForPlayer(playerid"http://yourwebsite.com/file.mp3"); 

btw your code is right, just don't forget OnPlayerSpawn