Music at Spawn
#1

Help to make with a dialog box
OK - play music
Close - stop music

public OnPlayerSpawn(playerid)
Код:
ShowPlayerDialog(playerid, radio, DIALOG_STYLE_MSGBOX, "Здравствуйте!", "Если Вы хотите,чтобы играла музыка\nНажмите ОК,если нет, ОТМЕНА.", "OK", "Отмена");
PlayAudioStreamForPlayer(playerid,"http://stream.radiohunter.com.br:7070/listen.pls");
Reply
#2

Use this:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case radio://if dialog id = radio
        {//then
            if(response)//if pressed OK
            {
                //playeaudiostream
                PlayAudioStreamForPlayer(playerid,"http://stream.radiohunter.com.br:7070/listen.pls");
            }
            else(!response)//id canceled
            {
                //else nothing
            }
        }
    }
return 1;
}
EDITED: did a mistake :
Reply
#3

Shabi you have a typo on line 7, it's supposed to be: "response" not respose.
Reply
#4

errors =(
Код:
D:\Games\SAMP сервер\SampDM\gamemodes\SampDMv.1.2.pwn(2644 -- 2645) : error 028: invalid subscript (not an array or too many subscripts): "response"
D:\Games\SAMP сервер\SampDM\gamemodes\SampDMv.1.2.pwn(2649) : error 002: only a single statement (or expression) can follow each "case"
D:\Games\SAMP сервер\SampDM\gamemodes\SampDMv.1.2.pwn(2649 -- 2650) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Код:
switch(dialogid)
{
case radio://if dialog id = radio
{//then
if(response)//if pressed OK
{
//playeaudiostream
PlayAudioStreamForPlayer(playerid,"http://stream.radiohunter.com.br:7070/listen.pls");
}
else(!response)//id canceled
{
StopAudioStreamForPlayer(playerid);
return 1;
}
if(dialogid == 100)
{
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,100,DIALOG_STYLE_INPUT,"Авторизация","Здравствуйте.\nВы у нас уже зарегистрированны!\nВведите свой пароль для авторизации.","Принять","Отмена");
return 1;
}
new pass[64];
strmid(pass,inputtext,0,strlen(inputtext),64);
OnPlayerLogin(playerid,pass);
}
else
{
ShowPlayerDialog(playerid,100,DIALOG_STYLE_INPUT,"Авторизация","Здравствуйте.\nВы у нас уже зарегистрированны!\nВведите свой пароль для авторизации.","Принять","Отмена");
}
}
if(dialogid == 101)
{
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,101,DIALOG_STYLE_INPUT,"Регистрация","Здравствуйте.\nВы у нас ещё не зарегистрированны!\nВведите свой пароль для регистрации.","Принять","Отмена");
return 1;
}
new pass[64];
strmid(pass,inputtext,0,strlen(inputtext),64);
OnPlayerRegister(playerid,pass);
}
else
{
ShowPlayerDialog(playerid,101,DIALOG_STYLE_INPUT,"Регистрация","Здравствуйте.\nВы у нас ещё не зарегистрированны!\nВведите свой пароль для регистрации.","Принять","Отмена");
}
}
return 1;
}
Reply
#5

Try this as this may work:

Under OnPlayerConnect or OnPlayerSpawn
pawn Код:
PlayAudioStreamForPlayer(playerid, "PUT THE MUSIC URL HERE");
So here's an example:
pawn Код:
public OnPlayerConnect(playerid)
{
    PlayAudioStreamForPlayer(playerid, "http://MySongURL.com");
    return 1;
}
Reply
#6

In OnPlayerSpawn :

pawn Код:
public OnPlayerSpawn(playerid)
{
     PlayAudioStreamForPlayer(playerid, "Link/URL To MP3");
     // Your Code
     return 1;
}
Reply
#7

inserted into the beginning
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
Код:
D:\Games\SAMP сервер\SampDM\gamemodes\SampDMv.1.2.pwn(1202 -- 1203) : error 028: invalid subscript (not an array or too many subscripts): "response"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#8

AS you are using if statement so :

Is Place of this :
pawn Код:
switch(dialogid)
{
case radio://if dialog id = radio
{//then
if(response)//if pressed OK
{
//playeaudiostream
PlayAudioStreamForPlayer(playerid,"http://stream.radiohunter.com.br:7070/listen.pls");
}
else(!response)//id canceled
{
StopAudioStreamForPlayer(playerid);
return 1;
}
Use this :
pawn Код:
if(dialogid == radio)//if dialog id = radio
{//then
if(response)//if pressed OK
{
//playeaudiostream
PlayAudioStreamForPlayer(playerid,"http://stream.radiohunter.com.br:7070/listen.pls");
}
else(!response)//id canceled
{
StopAudioStreamForPlayer(playerid);
}
Reply
#9

Код:
D:\Games\SAMP сервер\SampDM\gamemodes\SampDMv.1.2.pwn(2421 -- 2422) : error 028: invalid subscript (not an array or too many subscripts): "response"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#10

Quote:
Originally Posted by WarriorEd22
Посмотреть сообщение
Try this as this may work:

Under OnPlayerConnect or OnPlayerSpawn
pawn Код:
PlayAudioStreamForPlayer(playerid, "PUT THE MUSIC URL HERE");
So here's an example:
pawn Код:
public OnPlayerConnect(playerid)
{
    PlayAudioStreamForPlayer(playerid, "http://MySongURL.com");
    return 1;
}
is it possible to put more than one song ?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)