[Ajuda] Com este cуdigo
#1

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;
}
Reply
#2

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 й ?
Reply
#3

@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.
Reply
#4

Й 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)
Reply
#5

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.
Reply
#6

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?
Reply
#7

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

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
Reply
#9

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.
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: