SA-MP Forums Archive
ayuda ... arrays,index,SetObjectMaterial.... - 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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: ayuda ... arrays,index,SetObjectMaterial.... (/showthread.php?tid=547948)



ayuda ... arrays,index,SetObjectMaterial.... - OTACON - 26.11.2014

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.



Respuesta: ayuda ... arrays,index,SetObjectMaterial.... - adri1 - 26.11.2014

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

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


Respuesta: ayuda ... arrays,index,SetObjectMaterial.... - OTACON - 26.11.2014

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


Re: ayuda ... arrays,index,SetObjectMaterial.... - Mr.GeEk - 26.11.2014

los index creo que van de 0 - 9


Re: ayuda ... arrays,index,SetObjectMaterial.... - spell - 26.11.2014

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], ...);
}



Respuesta: ayuda ... arrays,index,SetObjectMaterial.... - OTACON - 26.11.2014

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;



Respuesta: ayuda ... arrays,index,SetObjectMaterial.... - Lunnatiicz - 26.11.2014

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


Respuesta: ayuda ... arrays,index,SetObjectMaterial.... - OTACON - 27.11.2014

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.