SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 21/06/2019, 08:43 PM   #1
Redizim
Little Clucker
 
Join Date: Jun 2019
Posts: 10
Reputation: 0
Default [Ajuda] error 014: invalid statement; not in switch

Este é o code:

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        case DIALOG_BANCO: { // LINHA 617 (LINHA DO ERRO)
            switch(listitem) {
                case 0: { // Saldo
                    if(response) {
                        new aname[MAX_PLAYER_NAME], file[80], string[200], Hora, Minuto, Segundo, Dia, Mes, Ano;
                        gettime(Hora, Minuto, Segundo);
                        getdate(Ano, Mes, Dia);
                        GetPlayerName(playerid, aname, sizeof(aname));
                        format(file, sizeof(file), PASTA_CONTAS, aname);
                        format(string, sizeof(string), "{FFFFFF}Banco {0fbefe}\n\n\n{FFFFFF}Saldo em conta {2fcc38}$%d \n\n{FFFFFF}Hora: {8de990}%02d:%02d:%02d \n\n{FFFFFF}Data: {8de990}%02d/%02d/%d", DOF2_GetInt(file, "Saldo"), Hora, Minuto, Segundo, Dia, Mes, Ano);
                        ShowPlayerDialog(playerid, DIALOG_BANCO_SALDO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Extrato", string, "Sair", "");
                        return 1;
                    }
                }
Erros:

Code:
(617) : error 014: invalid statement; not in switch
G(617) : warning 215: expression has no effect
G(617) : error 001: expected token: ";", but found ":"
G(617) : error 029: invalid expression, assumed zero
G(617) : fatal error 107: too many error messages on one line
Qualquer duvida sobre a code pode perguntar.
Redizim is offline   Reply With Quote
Old 21/06/2019, 09:22 PM   #2
SnakePit
Little Clucker
 
SnakePit's Avatar
 
Join Date: Jun 2019
Location: Rio de Janeiro
Posts: 38
Reputation: 0
Default Re: [Ajuda] error 014: invalid statement; not in switch

Você precisa adicionar o termo da linha 617 dentro de uma switch.
__________________
BOTAFOGO DE FUTEBOL E REGATAS


Last edited by SnakePit; 21/06/2019 at 09:58 PM.
SnakePit is offline   Reply With Quote
Old 21/06/2019, 09:43 PM   #3
Redizim
Little Clucker
 
Join Date: Jun 2019
Posts: 10
Reputation: 0
Default Re: [Ajuda] error 014: invalid statement; not in switch

Quote:
Originally Posted by SnakePit View Post
Você precisa adicionar o termo da linha 617 dentro do "switch(listitem)"
Me explique melhor, por favor. Sou iniciante no pawno, peguei uma Gm e estou fazendo algumas mudanças, para tentar aprender mais...
Redizim is offline   Reply With Quote
Old 21/06/2019, 09:52 PM   #4
PedroH
Huge Clucker
 
Join Date: Jul 2017
Posts: 337
Reputation: 5
Default Re: [Ajuda] error 014: invalid statement; not in switch

case DIALOG_BANCO nao esta dentro de nenhum switch!

solução:

PHP Code:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_BANCO:
        {
            switch(
listitem)
            {
                case 
0:
                {
                    if(
response)
                    {
                        new 
aname[MAX_PLAYER_NAME], file[80], string[200], HoraMinutoSegundoDiaMesAno;
                        
gettime(HoraMinutoSegundo);
                        
getdate(AnoMesDia);
                        
GetPlayerName(playeridanamesizeof(aname));
                        
format(filesizeof(file), PASTA_CONTASaname);
                        
format(stringsizeof(string), "{FFFFFF}Banco {0fbefe}\n\n\n{FFFFFF}Saldo em conta {2fcc38}$%d \n\n{FFFFFF}Hora: {8de990}%02d:%02d:%02d \n\n{FFFFFF}Data: {8de990}%02d/%02d/%d"DOF2_GetInt(file"Saldo"), HoraMinutoSegundoDiaMesAno);
                        
ShowPlayerDialog(playeridDIALOG_BANCO_SALDODIALOG_STYLE_MSGBOX"{FFFFFF}Extrato"string"Sair""");
                        return 
1;
                    }
                }
            }
        }
    }

PedroH is offline   Reply With Quote
Old 21/06/2019, 11:49 PM   #5
Miqueias Barros
Gangsta
 
Miqueias Barros's Avatar
 
Join Date: May 2010
Location: Brazil 🇧🇷
Posts: 725
Reputation: 31
Default Re: [Ajuda] error 014: invalid statement; not in switch

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_BANCO:
        {
            switch(listitem)
            {
                case 0:
                {
                    if(response) { }
                    new aname[MAX_PLAYER_NAME], file[80], string[200], Hora, Minuto, Segundo, Dia, Mes, Ano;
                    gettime(Hora, Minuto, Segundo);
                    getdate(Ano, Mes, Dia);
                    GetPlayerName(playerid, aname, sizeof(aname));
                    format(file, sizeof(file), PASTA_CONTAS, aname);
                    format(string, sizeof(string), "{FFFFFF}Banco {0fbefe}\n\n\n{FFFFFF}Saldo em conta {2fcc38}$%d \n\n{FFFFFF}Hora: {8de990}%02d:%02d:%02d \n\n{FFFFFF}Data: {8de990}%02d/%02d/%d", DOF2_GetInt(file, "Saldo"), Hora, Minuto, Segundo, Dia, Mes, Ano);
                    ShowPlayerDialog(playerid, DIALOG_BANCO_SALDO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Extrato", string, "Sair", "");
                }
            }
        }
    }
    return 1;
}
__________________
Gamemode está no substantivo masculino que traduzido quer dizer "modo de jogo", portanto a expressão não é: "essa gamemode, a gamemode..." e sim: "esse gamemode, o gamemode...".
Miqueias Barros is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 014: invalid statement; not in switch enzulikeS Scripting Help 6 06/03/2018 10:30 AM
error 014: invalid statement; not in switch N0FeaR Scripting Help 4 26/10/2015 06:54 AM
error 014: invalid statement; not in switch Mikkel_RE Scripting Help 3 12/10/2015 03:09 PM
error 014: invalid statement; not in switch AlirezaG Scripting Help 5 31/12/2014 06:00 PM
error 014: invalid statement; not in switch Yves Scripting Help 3 05/09/2013 10:30 PM


All times are GMT. The time now is 07:40 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.