ayuda ... arrays,index,SetObjectMaterial....
#1

Buenas a todos, necesito ayuda con lo siguiente...
pawn Код:
new
        indexTXD[50],
        ContarIndex
    ;

    // asigno el index para el SetObjectMaterial
    indexTXD[ContarIndex] = 15;
    ContarIndex++; //sumo un array

    // asigno el index para el SetObjectMaterial
    indexTXD[ContarIndex] = 46;
    ContarIndex++; //sumo un array

    // asigno el index para el SetObjectMaterial
    indexTXD[ContarIndex] = 2;
    ContarIndex++; //sumo un array

    // asigno el index para el SetObjectMaterial
    indexTXD[ContarIndex] = 6;
    ContarIndex++; //sumo un array
pawn Код:
for(new index=0; index < ContarIndex; index++)
    {
        for(new idx=0; idx < sizeof(indexTXD); idx++)
        {
            if( idx == indexTXD[index] )
            {
                printf( " SetObjectMaterial(objeto, %d, -1, \"none\", \"none\", -1); " , idx);
                /*
                    RESULTADO:
                        SetObjectMaterial(objeto, 15, -1, \"none\", \"none\", -1);
                        SetObjectMaterial(objeto, 46, -1, \"none\", \"none\", -1);
                        SetObjectMaterial(objeto, 2, -1, \"none\", \"none\", -1);
                        SetObjectMaterial(objeto, 6, -1, \"none\", \"none\", -1);
                */

            }
        }
    }
pawn Код:
/*
        hasta acб todo bien. pero  ...
         
        AHORA COMO HAGO PARA ASIGNARLE DE NUEVO A LOS INDEX DE LOS ARRAYS ANTERIORES?.
        y los objetos (la variable 'objeto') los tengo con arrays tambiйn.
    */
desde ya muchas gracias.
Reply
#2

AHORA COMO AHORA PARA ASIGNARLE DE NUEVO A LOS INDEX DE LOS ARRAYS ANTERIORES?.

Analiza un poco la frase, a ver si tiene sentido.
Reply
#3

Quote:
Originally Posted by adri1
Посмотреть сообщение
AHORA COMO AHORA PARA ASIGNARLE DE NUEVO A LOS INDEX DE LOS ARRAYS ANTERIORES?.

Analiza un poco la frase, a ver si tiene sentido.
ya lo corregн.. :S
Reply
#4

los index creo que van de 0 - 9
Reply
#5

No termino de entender que querйs hacer. Creo que tu cуdigo no tiene sentido, porque no hacerlo asн:

pawn Код:
for(new i; i<contarIndex; i++) {
    SetObjectMaterialText(object, indexTXD[i], ...);
}
Reply
#6

SOLUCIONADO, CREO.

Код:
	new
        indexTXD[50],
        ContarIndex,
        IndexUsado[MAX_PLAYERS]
    ;

    // asigno el index para el SetObjectMaterial
    indexTXD[ContarIndex] = 15;
    IndexUsado[playerid] = ContarIndex;
    ContarIndex++; //sumo un array
    
	for(new index=0; index < ContarIndex; index++)
    {
        for(new idx=0; idx < sizeof(indexTXD); idx++)
        {
            if( idx == indexTXD[index] )
            {
                printf( " SetObjectMaterial(objeto, %d, -1, \"none\", \"none\", -1); " , idx);
                /*
                    RESULTADO:
                        SetObjectMaterial(objeto, 15, -1, \"none\", \"none\", -1);
                        SetObjectMaterial(objeto, 46, -1, \"none\", \"none\", -1);
                        SetObjectMaterial(objeto, 2, -1, \"none\", \"none\", -1);
                        SetObjectMaterial(objeto, 6, -1, \"none\", \"none\", -1);
                */
            }
        }
    }
    
    // asigno el index para el SetObjectMaterial al array nuevamente
    new array = IndexUsado[playerid];
    indexTXD[array] = 15;
Reply
#7

Ni yo entendн bien la estructuraciуn de este cуdigo, їquй quieres lograr?, si es un ciclo estб bien como spell lo dijo.
Reply
#8

Quote:
Originally Posted by Lunnatiicz
Посмотреть сообщение
Ni yo entendн bien la estructuraciуn de este cуdigo, їquй quieres lograr?, si es un ciclo estб bien como spell lo dijo.
no es eso lo que quiero lograr, pero gracias ya lo solucione.
saludos.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)