How to add music to your Skin Selection. -
GNewZ - 21.07.2013
This is a simple, brief tutorial on how to add music to your skin selection.
Okay, so first you want to you want the music to start playing as soon as the player has connected and is viewing your skin selection, so you put it under OnPlayerConnect. So what you need to do is:
Put this under: public OnPlayerConnect(playerid)
Code:
PlayAudioStreamForPlayer(playerid, "http://ivyleaguespins.files.wordpress.com/2011/10/05-hood-gone-love-it-ft-kendrick-lemar-dopehood-com.mp3");
if(playerid == 0) GameTextForPlayer(playerid,"~r~What ever you want here, could be your server name etc, this is just an addon in theory, I dont think it is needed.",5000,5);
The url there, is just the music I use, you can change it to whatever. This code is pretty much self explanatory, and simple to use, and does not really need explaining. the ~r~ is to symbolise the colour red of the text you may want to add, you can for example change it to green by putting ~g~.
But, you want the music to stop after they have picked your skin, so, add this under: public OnPlayerSpawn(playerid)
Code:
StopAudioStreamForPlayer(playerid);
If you get errors, tell me as you may have done something wrong.
Re: How to add music to your Skin Selection. -
Rufio - 21.07.2013
So we should copy and paste ? Where is the explanation ? Plus why OnPlayerConnect but not OnPlayerRequestClass ?? Sorry pal 1/10.
Re: How to add music to your Skin Selection. -
Nines - 22.07.2013
this is absolutely brilliant I think this could be the most outstanding tutorial on SAMP! 10/10 good sir!
Re: How to add music to your Skin Selection. -
[ABK]Antonio - 22.07.2013
Quote:
Originally Posted by Rufio
So we should copy and paste ? Where is the explanation ? Plus why OnPlayerConnect but not OnPlayerRequestClass ?? Sorry pal 1/10.
|
OnPlayerRequestClass will call it multiple times (every time they switch skins). You should really create a variable to track if the player is in class selection, if they are...act accordingly. That way EVERY time they're in skin selection it'll play the music.
Re: How to add music to your Skin Selection. -
GNewZ - 22.07.2013
Quote:
Originally Posted by Rufio
So we should copy and paste ? Where is the explanation ? Plus why OnPlayerConnect but not OnPlayerRequestClass ?? Sorry pal 1/10.
|
This is simple, i'm not exactly an amazing scripter and I figured out how to work this code. Plus there is enough explanation to get this working. You want to make a tutorial describing every word? Be my guest, then I will happily remove this. But this is here for if people want to use it. Not everyone scripts stuff from scratch.
Re: How to add music to your Skin Selection. -
Aliassassin123456 - 22.07.2013
pawn Code:
new music[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
music[playerid] = 0;
return 1;
}
public OnPlayerRequestClass(playerid,classid)
{
if(!music[playerid]) { PlayAudioStreamForPlayer(playerid, "http://ivyleaguespins.files.wordpress.com/2011/10/05-hood-gone-love-it-ft-kendrick-lemar-dopehood-com.mp3");
if(playerid == 0) { GameTextForPlayer(playerid,"~r~What ever you want here, could be your server name etc, this is just an addon in theory, I dont think it is needed.",5000,5); } music[playerid] = 1; }
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
music[playerid] = 0;
StopAudioStreamForPlayer(playerid);
return 1;
}
Re: How to add music to your Skin Selection. -
Rufio - 22.07.2013
Quote:
Originally Posted by [ABK]Antonio
OnPlayerRequestClass will call it multiple times (every time they switch skins). You should really create a variable to track if the player is in class selection, if they are...act accordingly. That way EVERY time they're in skin selection it'll play the music.
|
Absolutely, but still with keeping track of player with variables, you could make this script better. Just like AliAssassin did. And what if a player hits f4 and dies ? It wont play any music. So basically(or whatever that is) i am saying this tutorial is nice for people who can't write things from scratch but bad for people who wants everything as its' best level. But still, people like them wouldn't search for a tutorial here. Anyway, i appreciate your work. Make a little more explaining and it will be fine.
Re: How to add music to your Skin Selection. -
Nahin - 23.07.2013
Thanks. Helped me very much.