SA-MP Forums Archive
a little help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: a little help (/showthread.php?tid=609957)



a little help - Owen007 - 18.06.2016

Hello all once again i need some help.

I wanna know that how can I play sound at time.

I mean for eg:- when a timer ends play this sound playaudiostreamforplayer(playerid,"******.com")

i want to play this stream for all players when timer finish.


Re: a little help - xTURBOx - 18.06.2016

//inside cmd or callback
//note that callback should have the parameter "playerid" as we are going to pass to the timer
SetTimerEx("PlaySound",TIMEINMILISECS,false,"i",pl ayerid);

//NOT inside any cmd or callback
forward PlaySound(playerid);
public PlaySound(playerid)
{
PlayAudioStreamForPlayer(playerid,"******.com");
}


Re: a little help - Owen007 - 18.06.2016

Quote:
Originally Posted by xTURBOx
Посмотреть сообщение
//inside cmd or callback
//note that callback should have the parameter "playerid" as we are going to pass to the timer
SetTimerEx("PlaySound",TIMEINMILISECS,false,"i",pl ayerid);

//NOT inside any cmd or callback
forward PlaySound(playerid);
public PlaySound(playerid)
{
PlayAudioStreamForPlayer(playerid,"******.com");
}
I have already done this but I dont know why the sound is not playing.

edit: Fixed ty very much turbo.


Re: a little help - J4Rr3x - 18.06.2016

Код:
SetTimerEx("PlaySound",TIMEINMILISECS,false,"i",playerid);

//NOT inside any cmd or callback
forward PlaySound(playerid);
public PlaySound(playerid)
{
    for(new i = 0; j = GetPlayerPoolSize(); i <= j; i++) { // For player sound for all players
        PlayAudioStreamForPlayer(i,"******.com");
    }
}
Instead of "******.com" you need to insert a valid mp3, or another sound format, link


Re: a little help - SyS - 18.06.2016

Quote:
Originally Posted by J4Rr3x
Посмотреть сообщение
Код:
SetTimerEx("PlaySound",TIMEINMILISECS,false,"i",playerid);

//NOT inside any cmd or callback
forward PlaySound(playerid);
public PlaySound(playerid)
{
    for(new i = 0; j = GetPlayerPoolSize(); i <= j; i++) { // For player sound for all players
        PlayAudioStreamForPlayer(i,"******.com");
    }
}
Instead of "******.com" you need to insert a valid mp3, or another sound format, link
that was an example man not real one


Re: a little help - Owen007 - 18.06.2016

@J4Rr3x and @sreyas i know ******.com is example i mean that the mesaage of audio played didnt appeared but i fixed it now.