error 021: symbol already defined: "n_index"
#1

I have an error and I do not know why it happens.

I have this command:

PHP код:
CMD:negocios(playeridparams[])
{
    new 
sz_Type[10];
    if(
PData[playerid][p_Admin] < 7) return 0;
    if(
sscanf(ParamsSectionD(params1), "s[10]"sz_Type))
    {
        
MsgUError0:
        
SendClientMessage(playeridWHITE"/uniformes <Opciуn>");
        
SendClientMessage(playeridGREY"Crear  -  Borrar  -  Editar");
        return 
1;
    }
    if(!
strcmp(sz_Type"Crear"true))
    {
        new
            
n_Id = -1,
            
Floatf_PosPlayer[4],
            
n_index strfind(params"Crear"true),
            
n_Type
        
;
        
strdel(params0, (n_index+(strlen("Crear"))));
        if(
sscanf(ParamsSectionD(params1), "i"n_Type))
        {
            
MensajeError(playerid"/uniformes Crear <Tipo de Negocio>");
            return 
1;
        }
        if(
n_Type || n_Type >= 3)
             return 
MensajeError(playerid"Ese tipo es invбlido. Rango vбlido: (0-2)");
        for(new 
iMAX_NEGOCIOSi++)
            if((
Business[i][n_Type][buss_Id]) == -1)
            {
                
n_Id i;
                break;
            }
        if(
n_Id == -1) return MensajeError(playerid"<Error>: Ya no hay mбs espacio para crear mбs negocios de este tipo");
        
GetPlayerPos(playeridf_PosPlayer[0], f_PosPlayer[1], f_PosPlayer[2]);
        
GetPlayerFacingAngle(playeridf_PosPlayer[3]);
        
        
Business[n_Id][n_Type][buss_Id] = n_Id;
        
Buss_TransValues2(n_Idn_Typeint_PosEn4_:f_PosPlayer);
        
CreateVisibleNegocios(n_Idn_Type"A");
        
CreateDBNegocios(n_Idn_Type);
    }
    else if(!
strcmp(sz_Type"Editar"true))
    {
        new
            
n_index strfind(params"Editar"true),
            
n_Id,
            
n_Type,
            
sz_Opcion[10]
        ;
        
strdel(params0, (n_index+(strlen("Editar"))));
        if(
sscanf(ParamsSectionD(params2), "iis[10]"n_Idn_Typesz_Opcion))
        {
            
MsgUError1:
            
MensajeError(playerid"/uniformes Editar <id><tipo><opcion>");
            
MensajeError(playerid">> Ejemplo: ESCRIBE /unfiromes Editar <id> <tipo> A, para editar la posiciуn de la Entrada, y las mбs opciones aparte de A son:");
            
MensajeError(playerid">> A: Posiciуn de la entrada, B: Posiciуn de la salida, C: Posiciуn del actor, D: Posiciуn del lugar de venta");
            
MensajeError(playerid">> O solamente, Interior: Que es para editar el Interior virtual del negocio");
            return 
1;
        }
        
enum e_Options
        
{
            
n_MAX,
            
InteriorDatainteriorData_G,
            
sz_AKA[2]
        };
        new 
g_Options[][e_Options] =
        {
            {
4int_PosEn"A"}, // "A" tiene 4 entradas en su variable
            
{4int_PosEx"B"}, // "B" tiene 4 entradas en su variable
            
{4int_PosAct"C"}, // "C" tiene 4 entradas en su variable
            
{3int_PosInfo"D"// "D" tiene 4 entradas en su variable
        
};
        if(!
strcmp(sz_Opcion"A"true) || !strcmp(sz_Opcion"B"true) || !strcmp(sz_Opcion"C"true) || !strcmp(sz_Opcion"D"true))
        {
            new
                
n_ID = -1,
                
Floatf_PosPlayer[4]
            ;
            for(new 
k&& n_ID == -1k++)
                if(!
strcmp(g_Options[k][sz_AKA], sz_Opciontrue))
                    
n_ID k;
            if(
n_ID != -1)
            {
                
GetPlayerPos(playeridf_PosPlayer[0], f_PosPlayer[1], f_PosPlayer[2]);
                
GetPlayerFacingAngle(playeridf_PosPlayer[3]);
                for(new 
InteriorDatag_Options[n_ID][interiorData_G], 0< (__i01f(g_Options[n_ID][interiorData_G], g_Options[n_ID][n_MAX])); k++, z++)
                    
BusinessVarMagic(0n_Idn_Typek_f_PosPlayer[z]);
                
CreateVisibleNegocios(n_Idn_Typesz_Opcion);
                
SendClientMessage(playeridWHITE"Cambiado correctamente");
            }
        }
        else if(!
strcmp(sz_Opcion"Interior"true))
        {
            new
                
n_InteriorSelect
            
;
            
n_index strfind(params"Interior"true);
            
strdel(params0, (n_index+(strlen("Interior"))));
            if(
sscanf(ParamsSectionD(params1), "i"n_InteriorSelect)) return SendClientMessageFormat(playeridGris">> Uso: /negocios Editar %i %i Interior <ID del interior>"n_Idn_Type);
            
BusinessVarMagic(0n_Idn_Typeint_InteriorIDn_InteriorSelect);
            
SendClientMessage(playeridWHITE"Cambiado correctamente");
        }
        else
            goto 
MsgUError1;
    }
    else if(!
strcmp(sz_Type"Borrar"true))
    {
        
//#undef n_index
        
        
new
            
n_index strfind(params"Borrar"true),
            
n_Id,
            
n_Type
        
;
        
strdel(params0, (n_index+(strlen("Borrar"))));
        if(
sscanf(ParamsSectionD(params2), "ii"n_Idn_Type)) return MensajeError(playerid"/negocios Borrar <id><type>");
        if(
n_Id || n_Id >= MAX_NEGOCIOS) return MensajeError(playerid"<Error>: Id invбlido.");
        if(
n_Type || n_Type >= 3) return MensajeError(playerid"<Error>: Id de tipo invбlido (0-2)");
        if(
Business[n_Id][n_Type][buss_Id] == -1) return MensajeError(playerid"<Error>: Ese id de negocios no existe.");
        for(new 
i3i++)
        {
            new 
Text3DText3D: (BusinessVarMagic(1n_Idn_Type, (__i01f(int_TXT3Di))));
            new 
= (BusinessVarMagic(1n_Idn_Type, (__i01f(int_PickupIDi))));
        
            
DestroyDynamic3DTextLabel    (h);
            
DestroyDynamicPickup        (p);
          }
          
          new 
BusinessVarMagic(1n_Idn_Typeint_ActorID);
        
FCNPC_Destroy(l);
        for(new 
InteriorData:iInteriorDatai++)
            
BusinessVarMagic(0n_Idn_Typei0);
        for(new 
EBusiness:iEBusinessi++)
            
Business[n_Id][n_Type][i] = 0;
        
Business[n_Id][n_Type][buss_Id] = -1;
        
SendClientMessage(playeridWHITE"Negocio eliminado");
        
DeleteDBNegocios(n_Idn_Type);
    }
    else
        goto 
MsgUError0;
    return 
1;

And when I compile this error throws me:

Код:
(8928) : error 021: symbol already defined: "n_index"
Line 8928 is this:

PHP код:
else if(!strcmp(sz_Type"Borrar"true))
    {
        new
            
n_index strfind(params"Borrar"true), // <----- this
            
n_Id,
            
n_Type
        
;
        
strdel(params0, (n_index+(strlen("Borrar"))));
        if(
sscanf(ParamsSectionD(params2), "ii"n_Idn_Type)) return MensajeError(playerid"/negocios Borrar <id><type>");
        if(
n_Id || n_Id >= MAX_NEGOCIOS) return MensajeError(playerid"<Error>: Id invбlido.");
        if(
n_Type || n_Type >= 3) return MensajeError(playerid"<Error>: Id de tipo invбlido (0-2)");
        if(
Business[n_Id][n_Type][buss_Id] == -1) return MensajeError(playerid"<Error>: Ese id de negocios no existe.");
        for(new 
i3i++)
        {
            new 
Text3DText3D: (BusinessVarMagic(1n_Idn_Type, (__i01f(int_TXT3Di))));
            new 
= (BusinessVarMagic(1n_Idn_Type, (__i01f(int_PickupIDi))));
        
            
DestroyDynamic3DTextLabel    (h);
            
DestroyDynamicPickup        (p);
          }
          
          new 
BusinessVarMagic(1n_Idn_Typeint_ActorID);
        
FCNPC_Destroy(l);
        for(new 
InteriorData:iInteriorDatai++)
            
BusinessVarMagic(0n_Idn_Typei0);
        for(new 
EBusiness:iEBusinessi++)
            
Business[n_Id][n_Type][i] = 0;
        
Business[n_Id][n_Type][buss_Id] = -1;
        
SendClientMessage(playeridWHITE"Negocio eliminado");
        
DeleteDBNegocios(n_Idn_Type);
    } 
Which does not make any sense, since I have not defined anything before.
But when I mention this, the error is eliminated:

PHP код:
else if(!strcmp(sz_Type"Editar"true))
    {
        new
            
n_index strfind(params"Editar"true),
            
n_Id,
            
n_Type,
            
sz_Opcion[10]
        ;
        
strdel(params0, (n_index+(strlen("Editar"))));
        if(
sscanf(ParamsSectionD(params2), "iis[10]"n_Idn_Typesz_Opcion))
        {
            
MsgUError1:
            
MensajeError(playerid"/uniformes Editar <id><tipo><opcion>");
            
MensajeError(playerid">> Ejemplo: ESCRIBE /unfiromes Editar <id> <tipo> A, para editar la posiciуn de la Entrada, y las mбs opciones aparte de A son:");
            
MensajeError(playerid">> A: Posiciуn de la entrada, B: Posiciуn de la salida, C: Posiciуn del actor, D: Posiciуn del lugar de venta");
            
MensajeError(playerid">> O solamente, Interior: Que es para editar el Interior virtual del negocio");
            return 
1;
        }
                
// This shit
        /*enum e_Options
        {
            n_MAX,
            InteriorData: interiorData_G,
            sz_AKA[2]
        };
        new g_Options[][e_Options] =
        {
            {4, int_PosEn, "A"}, // "A" tiene 4 entradas en su variable
            {4, int_PosEx, "B"}, // "B" tiene 4 entradas en su variable
            {4, int_PosAct, "C"}, // "C" tiene 4 entradas en su variable
            {3, int_PosInfo, "D"} // "D" tiene 4 entradas en su variable
        };*/
        
if(!strcmp(sz_Opcion"A"true) || !strcmp(sz_Opcion"B"true) || !strcmp(sz_Opcion"C"true) || !strcmp(sz_Opcion"D"true))
        {
            
/*new
                n_ID = -1,
                Float: f_PosPlayer[4]
            ;
            for(new k; k < 4 && n_ID == -1; k++)
                if(!strcmp(g_Options[k][sz_AKA], sz_Opcion, true))
                    n_ID = k;
            if(n_ID != -1)
            {
                GetPlayerPos(playerid, f_PosPlayer[0], f_PosPlayer[1], f_PosPlayer[2]);
                GetPlayerFacingAngle(playerid, f_PosPlayer[3]);
                for(new InteriorData: k = g_Options[n_ID][interiorData_G], z = 0; k < (__i01f(g_Options[n_ID][interiorData_G], g_Options[n_ID][n_MAX])); k++, z++)
                    BusinessVarMagic(0, n_Id, n_Type, k, _: f_PosPlayer[z]);
                CreateVisibleNegocios(n_Id, n_Type, sz_Opcion);
                SendClientMessage(playerid, WHITE, "Cambiado correctamente");
            }*/
        
}
        else if(!
strcmp(sz_Opcion"Interior"true))
        {
            new
                
n_InteriorSelect
            
;
            
n_index strfind(params"Interior"true);
            
strdel(params0, (n_index+(strlen("Interior"))));
            if(
sscanf(ParamsSectionD(params1), "i"n_InteriorSelect)) return SendClientMessageFormat(playeridGris">> Uso: /negocios Editar %i %i Interior <ID del interior>"n_Idn_Type);
            
BusinessVarMagic(0n_Idn_Typeint_InteriorIDn_InteriorSelect);
            
SendClientMessage(playeridWHITE"Cambiado correctamente");
        }
        else
            goto 
MsgUError1;
    } 
Complete command without the error:

PHP код:
CMD:negocios(playeridparams[])
{
    new 
sz_Type[10];
    if(
PData[playerid][p_Admin] < 7) return 0;
    if(
sscanf(ParamsSectionD(params1), "s[10]"sz_Type))
    {
        
MsgUError0:
        
SendClientMessage(playeridWHITE"/uniformes <Opciуn>");
        
SendClientMessage(playeridGREY"Crear  -  Borrar  -  Editar");
        return 
1;
    }
    if(!
strcmp(sz_Type"Crear"true))
    {
        new
            
n_Id = -1,
            
Floatf_PosPlayer[4],
            
n_index strfind(params"Crear"true),
            
n_Type
        
;
        
strdel(params0, (n_index+(strlen("Crear"))));
        if(
sscanf(ParamsSectionD(params1), "i"n_Type))
        {
            
MensajeError(playerid"/uniformes Crear <Tipo de Negocio>");
            return 
1;
        }
        if(
n_Type || n_Type >= 3)
             return 
MensajeError(playerid"Ese tipo es invбlido. Rango vбlido: (0-2)");
        for(new 
iMAX_NEGOCIOSi++)
            if((
Business[i][n_Type][buss_Id]) == -1)
            {
                
n_Id i;
                break;
            }
        if(
n_Id == -1) return MensajeError(playerid"<Error>: Ya no hay mбs espacio para crear mбs negocios de este tipo");
        
GetPlayerPos(playeridf_PosPlayer[0], f_PosPlayer[1], f_PosPlayer[2]);
        
GetPlayerFacingAngle(playeridf_PosPlayer[3]);
        
        
Business[n_Id][n_Type][buss_Id] = n_Id;
        
Buss_TransValues2(n_Idn_Typeint_PosEn4_:f_PosPlayer);
        
CreateVisibleNegocios(n_Idn_Type"A");
        
CreateDBNegocios(n_Idn_Type);
    }
    else if(!
strcmp(sz_Type"Editar"true))
    {
        new
            
n_index strfind(params"Editar"true),
            
n_Id,
            
n_Type,
            
sz_Opcion[10]
        ;
        
strdel(params0, (n_index+(strlen("Editar"))));
        if(
sscanf(ParamsSectionD(params2), "iis[10]"n_Idn_Typesz_Opcion))
        {
            
MsgUError1:
            
MensajeError(playerid"/uniformes Editar <id><tipo><opcion>");
            
MensajeError(playerid">> Ejemplo: ESCRIBE /unfiromes Editar <id> <tipo> A, para editar la posiciуn de la Entrada, y las mбs opciones aparte de A son:");
            
MensajeError(playerid">> A: Posiciуn de la entrada, B: Posiciуn de la salida, C: Posiciуn del actor, D: Posiciуn del lugar de venta");
            
MensajeError(playerid">> O solamente, Interior: Que es para editar el Interior virtual del negocio");
            return 
1;
        }
        
/*enum e_Options
        {
            n_MAX,
            InteriorData: interiorData_G,
            sz_AKA[2]
        };
        new g_Options[][e_Options] =
        {
            {4, int_PosEn, "A"}, // "A" tiene 4 entradas en su variable
            {4, int_PosEx, "B"}, // "B" tiene 4 entradas en su variable
            {4, int_PosAct, "C"}, // "C" tiene 4 entradas en su variable
            {3, int_PosInfo, "D"} // "D" tiene 4 entradas en su variable
        };*/
        
if(!strcmp(sz_Opcion"A"true) || !strcmp(sz_Opcion"B"true) || !strcmp(sz_Opcion"C"true) || !strcmp(sz_Opcion"D"true))
        {
            
/*new
                n_ID = -1,
                Float: f_PosPlayer[4]
            ;
            for(new k; k < 4 && n_ID == -1; k++)
                if(!strcmp(g_Options[k][sz_AKA], sz_Opcion, true))
                    n_ID = k;
            if(n_ID != -1)
            {
                GetPlayerPos(playerid, f_PosPlayer[0], f_PosPlayer[1], f_PosPlayer[2]);
                GetPlayerFacingAngle(playerid, f_PosPlayer[3]);
                for(new InteriorData: k = g_Options[n_ID][interiorData_G], z = 0; k < (__i01f(g_Options[n_ID][interiorData_G], g_Options[n_ID][n_MAX])); k++, z++)
                    BusinessVarMagic(0, n_Id, n_Type, k, _: f_PosPlayer[z]);
                CreateVisibleNegocios(n_Id, n_Type, sz_Opcion);
                SendClientMessage(playerid, WHITE, "Cambiado correctamente");
            }*/
        
}
        else if(!
strcmp(sz_Opcion"Interior"true))
        {
            new
                
n_InteriorSelect
            
;
            
n_index strfind(params"Interior"true);
            
strdel(params0, (n_index+(strlen("Interior"))));
            if(
sscanf(ParamsSectionD(params1), "i"n_InteriorSelect)) return SendClientMessageFormat(playeridGris">> Uso: /negocios Editar %i %i Interior <ID del interior>"n_Idn_Type);
            
BusinessVarMagic(0n_Idn_Typeint_InteriorIDn_InteriorSelect);
            
SendClientMessage(playeridWHITE"Cambiado correctamente");
        }
        else
            goto 
MsgUError1;
    }
    else if(!
strcmp(sz_Type"Borrar"true))
    {
        
//#undef n_index
        
        
new
            
n_index strfind(params"Borrar"true),
            
n_Id,
            
n_Type
        
;
        
strdel(params0, (n_index+(strlen("Borrar"))));
        if(
sscanf(ParamsSectionD(params2), "ii"n_Idn_Type)) return MensajeError(playerid"/negocios Borrar <id><type>");
        if(
n_Id || n_Id >= MAX_NEGOCIOS) return MensajeError(playerid"<Error>: Id invбlido.");
        if(
n_Type || n_Type >= 3) return MensajeError(playerid"<Error>: Id de tipo invбlido (0-2)");
        if(
Business[n_Id][n_Type][buss_Id] == -1) return MensajeError(playerid"<Error>: Ese id de negocios no existe.");
        for(new 
i3i++)
        {
            new 
Text3DText3D: (BusinessVarMagic(1n_Idn_Type, (__i01f(int_TXT3Di))));
            new 
= (BusinessVarMagic(1n_Idn_Type, (__i01f(int_PickupIDi))));
        
            
DestroyDynamic3DTextLabel    (h);
            
DestroyDynamicPickup        (p);
          }
          
          new 
BusinessVarMagic(1n_Idn_Typeint_ActorID);
        
FCNPC_Destroy(l);
        for(new 
InteriorData:iInteriorDatai++)
            
BusinessVarMagic(0n_Idn_Typei0);
        for(new 
EBusiness:iEBusinessi++)
            
Business[n_Id][n_Type][i] = 0;
        
Business[n_Id][n_Type][buss_Id] = -1;
        
SendClientMessage(playeridWHITE"Negocio eliminado");
        
DeleteDBNegocios(n_Idn_Type);
    }
    else
        goto 
MsgUError0;
    return 
1;

I hope you help me, I have no idea why this happens, I have a few hours trying to solve it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)