AudioStream listem random ?
#1

Queria hacer una emisora, la cual elegis una y empiezan a correr los temas, osea que no se esuche solo uno que se termine uno y que comienze el sigiente y asi random :P

Esto es lo que hize.

pawn Код:
CMD:emisora(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_DRIVER){
        return SendClientMessageEx(playerid, COLOR_GRAD2, "Necesitas estar en un vehiculo y ser el conductor.");
    }
    else if(isnull(params)){
        SendClientMessageEx(playerid, COLOR_GRAD2, "{ffff00}Emisoras disponibles:");
        SendClientMessageEx(playerid, COLOR_GRAD2, "{ffff00}Emisora 1: {ffffff}Electronica FM");
        return 1;
    }
    new string[84], station[64, randomize;
    switch(strval(params)){
        case 0:{
            format(string, sizeof(string), "%s apaga la radio del vehiculo.",GetPlayerNameEx(playerid));
            foreach(Player, i) if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
            {
                StopAudioStreamForPlayer(playerid);
                estacionp[i] = 0;
                estacionveh[GetPlayerVehicleID(playerid)] = 0;
            }
        }
        case 1:{
            format(string, sizeof(string), "%s cambia la emisora a Electronica FM.",GetPlayerNameEx(playerid));
            randomize = random(sizeof(Electronica));
            estacionveh[GetPlayerVehicleID(playerid)] = 1;
        }
        default: return SendClientMessageEx(playerid, COLOR_GRAD2, "Estб estaciуn es invбlida.");
    }
    ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    foreach(Player, i) if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
    {
        StopAudioStreamForPlayer(playerid);
        estacionp[i] = PlayAudioStreamForPlayer(playerid, station, 1, 1, 1, 1, 0);
    }
    return 1;
}

pawn Код:
new Float:Electronica[2][2] = {
        {www.zonaroja.com.nu/radio/sebastian%20ingrosso%20&%20alesso%20feat%20ryan%20tedder%20-%20calling%20(lose%20my%20mind)%20(radio%20edit).mp3},
        {www.zonaroja.com.nu/radio/will.i.am%20-%20Scream%20&%20Shout%20ft.%20Britney%20Spears.mp3}
};
(Solo son 2 temas xD, estaba probando aver si funciona y no funciono ):


Errores

pawn Код:
(537) : error 001: expected token: ";", but found "."
(539) : error 010: invalid function or declaration
(42720) : error 001: expected token: "]", but found ","
(42733) : warning 204: symbol is assigned a value that is never used: "randomize"
(53328) : warning 203: symbol is never used: "Electronica"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
Que esta mal?
Reply
#2

Код:
new string[84], station[64, randomize;
Код:
new string[84], station[64], randomize;
Reply
#3

Quote:
Originally Posted by OTACON
Посмотреть сообщение
Код:
new string[84], station[64, randomize;
Код:
new string[84], station[64], randomize;
Quote:

(537) : error 001: expected token: ";", but found "."
(539) : error 010: invalid function or declaration
(42733) : warning 204: symbol is assigned a value that is never used: "randomize"
(5332 : warning 203: symbol is never used: "Electronica"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Como lo arreglo?
Reply
#4

pawn Код:
COMMAND:emisora(playerid, params[]) {
    if(sscanf(params, "d", params[0])) return SendClientMessage(playerid, -1, "Escribe: /emisora (1-2)");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "Usted no se encuentra en un vehiculo!.");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "Usted no se encuentra como conductor del vehiculo!.");
    if(params[0]==1 || params[0]==2) return SendClientMessage(playerid, -1, "las opciones permitidas son 1 o 2!.");

    switch(params[0]){
        case 1:{
            //LA FUNCION PARA LA OPCION 1
            SendClientMessage(playerid, -1, "seleccionaste la opcion 1");
        }
        case 2:{
            //LA FUNCION PARA LA OPCION 2
            SendClientMessage(playerid, -1, "seleccionaste la opcion 2");
        }
        default:{
            //LA FUNCION PARA NINGUNA OPCION
            SendClientMessage(playerid, -1, "seleccionaste la opcion incorrecta");
        }
    }
    return true;
}
Reply
#5

Oh, ademбs, tienes el array "Electronica" malo.

pawn Код:
new Electronica[][] = {
        {"www.zonaroja.com.nu/radio/sebastian%20ingrosso%20&%20alesso%20feat%20ryan%20tedder%20-%20calling%20(lose%20my%20mind)%20(radio%20edit).mp3"},
        {"www.zonaroja.com.nu/radio/will.i.am%20-%20Scream%20&%20Shout%20ft.%20Britney%20Spears.mp3"}
};
Ejemplo (Para que la selecciуn sea aleatoria):

pawn Код:
main()
{
    new Electronica[][] =
    {
        {"www.zonaroja.com.nu/radio/sebastian%20ingrosso%20&%20alesso%20feat%20ryan%20tedder%20-%20calling%20(lose%20my%20mind)%20(radio%20edit).mp3"},
        {"www.zonaroja.com.nu/radio/will.i.am%20-%20Scream%20&%20Shout%20ft.%20Britney%20Spears.mp3"}
    };

    printf("%s", Electronica[random(2)]);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)