[Ajuda] BUG NA CONTAGEM DE PLAYERS OUVINDO RADIO!!
#3

Nгo deu tempo para testar, estou saindo para trabalhar.

PHP Code:
enum r_RADIO_INFO
{
    
Nome[30],
    
Url[50],
}
new const 
Radios[][r_RADIO_INFO] =
{
    {
"Radio Hunter""url da rбdio"},
    {
"Radio Funk""url da rбdio"},
    {
"Radio Brasil""url da rбdio"}
};
new 
    
OuvintesRadio[sizeof(Radios)], pRadio[MAX_PLAYERS] = -1;
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp("/radio"cmdtexttrue) == || strcmp("/radios"cmdtexttrue) == 0)
    {
        new 
str[512];
        
format(strsizeof(str), "Rбdios\tOuvintes\n");
        for(new 
rsizeof(Radios); r++)
        {
            
format(strsizeof(str), "%s%s\t%i\n"strRadios[r][Nome], OuvintesRadio[r]);
        }
        
strcat(str"Desligar");
        
ShowPlayerDialog(playerid9603DIALOG_STYLE_TABLIST_HEADERS"{00FF00}Rбdios:"str"Ok""X");
        return 
1;
    }
    return 
0;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
pRadio[playerid] != -1)
    {
        
OuvintesRadio[pRadio[playerid]]--;
        
pRadio[playerid]=-1;
    }
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
9603:
        {
            if(
response)
            {
                switch(
listitem)
                {
                    case 
.. sizeof(Radios):
                    {
                        new 
str[70];
                        
format(strsizeof(str),  "Vocк estб sinonizado na rбdio {00bbff}%s"Radios[listitem][Nome]);
                        
SendClientMessage(playerid, -1str);
                        
PlayAudioStreamForPlayer(playeridRadios[listitem][Url]);
                        if(
pRadio[playerid] != -1){
                            
OuvintesRadio[pRadio[playerid]]++;
                        }
                        
pRadio[playerid] = listitem;
                        
OuvintesRadio[listitem]++;                        
                    }
                    default:
                    {
                        if(
pRadio[playerid] != -1)
                        {
                            --
OuvintesRadio[pRadio[playerid]];
                            
pRadio[playerid] = -1;
                            
StopAudioStreamForPlayer(playerid);
                            
SendClientMessage(playerid, -1"rбdio desligada");
                        }
                    }
                }                
                return 
true;
            }
            return 
true;
        }
    }
    return 
true;

Reply


Messages In This Thread
BUG NA CONTAGEM DE PLAYERS OUVINDO RADIO!! - by Gleidson - 21.11.2017, 02:33
Re: BUG NA CONTAGEM DE PLAYERS OUVINDO RADIO!! - by Coringa_Vilao - 21.11.2017, 04:05
Re: BUG NA CONTAGEM DE PLAYERS OUVINDO RADIO!! - by SammyJ - 21.11.2017, 10:53

Forum Jump:


Users browsing this thread: 1 Guest(s)