music for server
#1

Hi guys,

i'm trying to create a code that players can play music for server by paying with score.. it looks like this.. i need to know how can i do that if music is stopped like it's finished it makes musicstarted= false;

my code looks like this:

Quote:

new boolarkibasladi;

Quote:

if(!strcmp(cmdtext,"/svsarki",true))
{
if(sarkibasladi != true)return Dilmesaji(playerid,-1,"{0077FF}<!>{FFFFFF} Юuanda зalan bir юarkэ var!","{0077FF}<!>{FFFFFF} Some music is still played!");
if(GetPlayerScore(playerid) < 25)return Hatamesaj(playerid,-1,"Servere юarkэ aзmak iзin {00FF7F}`25`{FFFFFF} skorunuz olmalэdэr!","To play music for all players in server cost {00FF7F}`50`{FFFFFF} score!");
ShowPlayerDialog(playerid,DIALOG_Music,DIALOG_STYL E_INPUT,"Servere юarkэ aз","Bu iюlemi yapmak hesabэnэzdan 25 skor siler!","Seз","Эptal");
return 1;
}

Quote:

if(dialogid == DIALOG_Music)
{
if(response) // If they clicked 'Yes' or pressed enter
{
foreach(new i: Player){
PlayAudioStreamForPlayer(i,cmdtext[7]);
SetPlayerScore(i,GetPlayerScore(i)-25);
sarkibasladi = true;
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}

Reply
#2

Well, if you want the whole audio thing to go on it'll be quite impossible. You can limit it to 60 seconds or somewhat.
Reply
#3

how can i do that?
Reply
#4

up...?
Reply
#5

First write your code like this:

PHP код:
if(dialogid == DIALOG_Music)
{
    if(!
response) return 1;
    
SetPlayerScore(playerid,GetPlayerScore(playerid)-25);
    
sarkibasladi true;
    
SetTimer(!"@endMusic",1000*60*3+1000*30,0); //Then this is called after 3:30min (a song is ~3:30min)
    
foreach(new iPlayer){
        
PlayAudioStreamForPlayer(i,inputtext);
    }
    return 
1// We handled a dialog, so return 1. Just like OnPlayerCommandText.

You should do it static...

PHP код:
@endMusic();@endMusic()
{
    foreach(new 
PlayerStopAudioStreamForPlayer(i);
    return 
sarkibasladi false,1;

Greekz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)