SA-MP Forums Archive
[Ajuda] Com este cуdigo - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Com este cуdigo (/showthread.php?tid=356746)



Com este cуdigo - Oscar[A] - 04.07.2012

Eu tenho OnGameModeInit() assim:
pawn Код:
public OnGameModeInit(){
    SetGameModeText("Servidor");
    ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
    DisableInteriorEnterExits();
    EnableStuntBonusForAll(true);
    CargarEstatico("Grupo1"); //Aquн esta o problema
    CarregarObjetos(); //Este nгo й executado.
    return 1;
}
Este callback [CargarEstatico("Grupo1"); ] impede a execuзгo do restante do cуdigo de OnGameModeInit.
Vocк pode me ajudar a encontrar a parte do cуdigo errado ( que impede a execuзгo do cуdigo restante de OnGameModeInit )?

Aquн o callback:
pawn Код:
#define MAX_STACK ( 20 )
new MAX_L_S[MAX_STACK][1];
public CargarEstatico(Tipo[])
{
    if( strcmp ( Tipo , "Grupo1" , true ) == 0 && strlen( Tipo ) == 6 ) {
        CountAssStatic( Tipo );
        new i, v;
        do {
            i++;
            do {
                v++;
                if ( MAX_L_S[i][0] == 0 ) break;
                switch ( v ) {
                    case 0: continue;
                    default: {
                        new string[49];
                        format(string, sizeof(string), "/Stacks/Grupos/Grupo %i/Stack%i.tmp", i, v);
                        if ( fexist ( string ) ) {
                            INI_ParseFile(  _Archivo, "CarregarGrupo_%s", .bExtra = true, .extra = v);
                        }
                    }
                }
            } while( v<MAX_L_S[i][0] );
        } while( i<MAX_STACK );
        return true;
    }
    return true;
}



Re: Com este cуdigo - leonardo1434 - 04.07.2012

Muito provavelmente porque este arquivo
pawn Код:
format(string, sizeof(string), "/Stacks/Grupos/Grupo %i/Stack%i.tmp", i, v);
nгo estб sendo criado.

Pelo o que pude ver vai sempre dar 1 & 1 e tambйm nгo lembro como o parsefile funciona e tenho preguiзa de ler o gigantesco tutorial do ******, Enfim, Vocк nгo criou isto nгo й ?


Respuesta: Com este cуdigo - Oscar[A] - 04.07.2012

@leonardo 1434: El arquivo йsta criado, Nгo й um problema de leitura.
@Elias.G8B:
pawn Код:
public OnGameModeInit(){
    SetGameModeText("Servidor");
    ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
    DisableInteriorEnterExits();
    EnableStuntBonusForAll(true);
    CarregarObjetos();
    CargarEstatico("Grupo1"); //Tudo OK.
    return 1;
}
Novo problema: se eu colocar assim:
pawn Код:
public OnGameModeInit(){
    SetGameModeText("Servidor");
    ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
    DisableInteriorEnterExits();
    EnableStuntBonusForAll(true);
    CarregarObjetos();
    CargarEstatico("Grupo1"); //Tudo OK.
    CargarEstatico("Grupo2"); //Este nгo й executado.
    return 1;
}
E eu preciso carregar grupos diferentes.


Re: Com este cуdigo - ipsBruno - 04.07.2012

Й que vocк estб dando STRCMP:

Quote:

#define MAX_STACK ( 20 )
new MAX_L_S[MAX_STACK][1];
public CargarEstatico(Tipo[])
{
if( strcmp ( Tipo , "Grupo1" , true ) == 0 && strlen( Tipo ) == 6 ) {
CountAssStatic( Tipo );
new i, v;
do {
i++;
do {
v++;
if ( MAX_L_S[i][0] == 0 ) break;
switch ( v ) {
case 0: continue;
default: {
new string[49];
format(string, sizeof(string), "/Stacks/Grupos/Grupo %i/Stack%i.tmp", i, v);
if ( fexist ( string ) ) {
INI_ParseFile( _Archivo, "CarregarGrupo_%s", .bExtra = true, .extra = v);
}
}
}
} while( v<MAX_L_S[i][0] );
} while( i<MAX_STACK );
return true;
}
return true;
}

Por isto sу executa o GRUPO 1

pawn Код:
#define MAX_STACK ( 20 )
new MAX_L_S[MAX_STACK][1];
public CargarEstatico(Tipo[])
{
    //if( strcmp ( Tipo , "Grupo1" , true ) == 0 && strlen( Tipo ) == 6 ) {
        CountAssStatic( Tipo );
        new i, v;
        do {
            i++;
            do {
                v++;
                if ( MAX_L_S[i][0] == 0 ) break;
                switch ( v ) {
                    case 0: continue;
                    default: {
                        new string[49];
                        format(string, sizeof(string), "/Stacks/Grupos/Grupo %i/Stack%i.tmp", i, v);
                        if ( fexist ( string ) ) {
                            INI_ParseFile(  _Archivo, "CarregarGrupo_%s", .bExtra = true, .extra = v);
                        }
                    }
                }
            } while( v<MAX_L_S[i][0] );
        } while( i<MAX_STACK );
        return true;
    //}
    return true;
}
Isto deve funcionar (sу arrume a tabulaзгo)


Respuesta: Com este cуdigo - Oscar[A] - 04.07.2012

Nonono DraKiNs, por exemplo; se eu colocar assim:
pawn Код:
public OnGameModeInit(){
    SetGameModeText("Servidor");
    ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
    DisableInteriorEnterExits();
    EnableStuntBonusForAll(true);
    CarregarObjetos();
    CargarEstatico("Grupo1"); //Tudo OK.
    CargarEstatico("Grupo2"); //Este nгo й executado.
    return 1;
}
pawn Код:
#define MAX_STACK ( 20 )
new MAX_L_S[MAX_STACK][1];
public CargarEstatico(Tipo[])
{
    if( strcmp ( Tipo , "Grupo1" , true ) == 0 && strlen( Tipo ) == 6 ) {
        CountAssStatic( Tipo );
        new i, v;
        do {
            i++;
            do {
                v++;
                if ( MAX_L_S[i][0] == 0 ) break;
                switch ( v ) {
                    case 0: continue;
                    default: {
                        new string[49];
                        format(string, sizeof(string), "/Stacks/Grupos/Grupo %i/Stack%i.tmp", i, v);
                        if ( fexist ( string ) ) {
                            INI_ParseFile(  _Archivo, "CarregarGrupo_%s", .bExtra = true, .extra = v);
                        }
                    }
                }
            } while( v<MAX_L_S[i][0] );
        } while( i<MAX_STACK );
        return true;
    }
    else if( strcmp ( Tipo , "Grupo2" , true ) == 0 && strlen( Tipo ) == 6 ) {
        //Cуdigo
        return true;
    }
    return true;
}
nгo funciona 'Grupo2'.
OnGameModeInit termina depois de executar "Grupo1" e nгo executa 'Grupo2'.
Peзo desculpas porque eu sou da seзгo em espanhol, mas nгo ajuda lб.
Entгo, eu uso o tradutor.


Re: Com este cуdigo - ipsBruno - 04.07.2012

pawn Код:
public OnGameModeInit(){
    SetGameModeText("Servidor");
    ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
    DisableInteriorEnterExits();
    EnableStuntBonusForAll(true);
    CarregarObjetos();
    CargarEstatico("Grupo1"); //Tudo OK.
    print("oscar");
    return 1;
}

//  ejecute esto
// "oscar" fue impreso en log?



Respuesta: Com este cуdigo - Oscar[A] - 05.07.2012

No, no fue impreso.
Ese es mi problema, lo que ponga abajo de esa linea; no funciona!


Re: Respuesta: Com este cуdigo - ipsBruno - 05.07.2012

Quote:
Originally Posted by Oscar[A]
Посмотреть сообщение
No, no fue impreso.
Ese es mi problema, lo que ponga abajo de esa linea; no funciona!
Bien, ahora entiendo cuбl es tu problema. Voy a ver el codigo/code y si yo encuentra errores, te lo dire La prуxima vez poner el code en categorнa/area espanol, yo puedo ayudar en su categorнa/area.


Poner el "CountAssStatic" funcion


Respuesta: Com este cуdigo - Oscar[A] - 05.07.2012

pawn Код:
public CountAssStatic(Tipo[]) {
    if( strcmp ( Tipo , "Grupo1" , true ) == 0 && strlen( Tipo ) == 6 ) {
        new i = 1;
        do {
            switch ( i ) {
                case 0: continue;
                default: {
                    new string[56];
                    format(string, 56, "/Stacks/Grupos/Grupo %i/count.cfg", i);
                    MAX_L_S[i][0] = ContandoArquivos( string )+1;
                }
            } i++;
        } while ( i!= MAX_FACCIONES );
        return true;
    }
    else if( strcmp ( Tipo , "Grupo2" , true ) == 0 && strlen( Tipo ) == 6 ) {
    //Codigo
    }
}
Ahн lo tienes.


Re: Com este cуdigo - ipsBruno - 05.07.2012

pawn Код:
#define MAX_STACK ( 20 )
new MAX_L_S[MAX_STACK][1];
public CargarEstatico(Tipo[])
{
    if( strcmp ( Tipo , "Grupo1" , true ) == 0 && strlen( Tipo ) == 6 ) {
        CountAssStatic( Tipo );
        print("DEBUG");
        new i, v;
        do {
            i++;
            do {
                v++;
                if ( MAX_L_S[i][0] == 0 ) break;
                switch ( v ) {
                    case 0: continue;
                    default: {
                        new string[49];
                        format(string, sizeof(string), "/Stacks/Grupos/Grupo %i/Stack%i.tmp", i, v);
                        if ( fexist ( string ) ) {
                            INI_ParseFile(  _Archivo, "CarregarGrupo_%s", .bExtra = true, .extra = v);
                        }
                    }
                }
            } while( v<MAX_L_S[i][0] );
        } while( i<MAX_STACK );
        return true;
    }
    else if( strcmp ( Tipo , "Grupo2" , true ) == 0 && strlen( Tipo ) == 6 ) {
        //Cуdigo
        return true;
    }
    return true;
}
DEBUG fue impreso?