31.01.2017, 22:49
Can anyone help me. I want to be aveble to put a music url in my script so when people join they will hear a song. intill they press spawn
PlayAudioStreamForPlayer(playerid, "direct link to your mp3");
StopAudioStreamForPlayer(playerid);
PlayAudioStreamForPlayer(playerid, "Song Link");
StopAudioStreamForPlayer(playerid);
PlayerPlaySound(playerid, soundid, Float:x, Float:y, Float:z); //Just leave the Float parameters put to 0 if you want the song to be heard from any distance, which is what we want in this case, as for the sound ID, there are few that you can use, e.g 1062, 1068 ...etc
PlayerPlaySound(playerid, soundid+1, Float:x, Float:y, Float:z); //Why we used soundid+1? Well, because, if we played the sound id 1062, to stop it, we have to play sound id 1063, the same goes for other sound ids
SOUND_GOGO_TRACK_START 1062 (music) //This plays soundid = 1062 SOUND_GOGO_TRACK_STOP 1063 (music) //This stops soundid = 1062 SOUND_DUAL_TRACK_START 1068 (music) //This plays soundid = 1098 SOUND_DUAL_TRACK_STOP 1069 (music) //This stops soundid = 1098 SOUND_BEE_TRACK_START 1076 (music) //This plays soundid = 1076 SOUND_BEE_TRACK_STOP 1077 (music) //This stops soundid = 7076 SOUND_AWARD_TRACK_START 1097 (music) //This plays soundid = 1097 SOUND_AWARD_TRACK_STOP 1098 (music) //This stops soundid = 1098
Search for the "public OnPlayerConnect(playerid)" callback on your script, under that add following code:
Код:
PlayAudioStreamForPlayer(playerid, "direct link to your mp3"); Код:
StopAudioStreamForPlayer(playerid); |
}
public OnPlayerConnect(playerid)
{
for (new i = 0; i < 4; i ++)
{
DriveThruItems[playerid][i] = 0;
}
if(Security != 0)
{
Here is what i have, tried add but it did not work
PHP код:
|
public OnPlayerConnect(playerid)
{
PlayAudioStreamForPlayer(playerid, "direct link to your mp3");
for (new i = 0; i < 4; i ++)
{
DriveThruItems[playerid][i] = 0;
}
if(Security != 0)
{
public OnPlayerSpawn(playerid)
{
StopAudioStreamForPlayer(playerid);
return 1;
}