Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] How to add music to skin selection menu?

 
  • 0 Vote(s) - 0 Average
Pawn How to add music to skin selection menu?
CrypticSin
Offline

Burgershot Member
Posts: 24
Threads: 9
Joined: Mar 2021
Reputation: 0
#1
2021-03-25, 08:35 PM (This post was last modified: 2021-03-25, 09:11 PM by CrypticSin.)
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;
}
DandoRYx
Offline

Burgershot Member
Posts: 20
Threads: 0
Joined: Feb 2021
Reputation: 2
Location: Slovakia
#2
2021-03-25, 09:12 PM
PHP Code:
public OnPlayerRequestClass(playerid, classid)
{
    
// your skin code...
    
if(GetPVarInt(playerid, "playedSong") == 0)
    {
        
SetPVarInt(playerid, "playedSong", 1);
        
PlayAudioStreamForPlayer(playerid, YOUR_AUDIO_STREAM);
    }
}

public 
OnPlayerSpawn(playerid)
{
    
// your spawn code...
    
StopAudioStreamForPlayer(playerid);
    
SetPVarInt(playerid, "playedSong", 0);
    return 
1;
} 
Snow
Offline

Burgershot Member
Posts: 48
Threads: 5
Joined: Oct 2020
Reputation: 2
Location: Pakistan
#3
2021-03-25, 09:31 PM (This post was last modified: 2021-03-25, 09:32 PM by Snow.)
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.
[Image: QIDa2vB.png]
CrypticSin
Offline

Burgershot Member
Posts: 24
Threads: 9
Joined: Mar 2021
Reputation: 0
#4
2021-03-25, 09:53 PM
(2021-03-25, 09:12 PM)DandoRYx Wrote:
PHP Code:
public OnPlayerRequestClass(playerid, classid)
{
// your skin code...
if(GetPVarInt(playerid, "playedSong") == 0)
{
SetPVarInt(playerid, "playedSong", 1);
PlayAudioStreamForPlayer(playerid, YOUR_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(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); 


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?
DandoRYx
Offline

Burgershot Member
Posts: 20
Threads: 0
Joined: Feb 2021
Reputation: 2
Location: Slovakia
#5
2021-03-25, 10:20 PM (This post was last modified: 2021-03-25, 10:21 PM by DandoRYx.)
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
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode