on spawn allowing player to turn on ambient sounds.
#1

Hi there , could anyone help me out with one snippet or a code ? This is realy basic stuff . I need that whenever player spawns it should show a gui with a message if you want to play ambient sounds or no . I just need a code , i will figure out with sounds myself . Thanks
Reply
#2

pawn Код:
#define DIALOG_AMBIENCE 1
new bool: playerAmbience[MAX_PLAYERS];
new bool: ambienceYet[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
      if(ambienceYet[playerid] == false) {
          ShowPlayerDialog(playerid, DIALOG_AMBIENCE, DIALOG_STYLE_MSGBOX, "Ambience Sounds", "Do you want to play ambient sounds?", "Yes", "No");
          ambienceYet[playerid] = true;
       } return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
       if(dialogid == DIALOG_AMBIENCE) {
           if(response) playerAmbience[playerid] = true;
           else playerAmbience[playerid] = false; }
        return 1;
}
Reply
#3

Meh, seems giving a code is better than explaining now.
Reply
#4

Where should i put the stream link if player pressed the "yes" button . Btw thanks for helping out +rep m8
Reply
#5

pawn Код:
if(response)
{
     playerAmbience[playerid] = true;
     PlayAudioStreamForPlayer(playerid, "yoursong.mp3");
     return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)