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
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);
*/
}
}
}
/*
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.
*/
AHORA COMO AHORA PARA ASIGNARLE DE NUEVO A LOS INDEX DE LOS ARRAYS ANTERIORES?.
Analiza un poco la frase, a ver si tiene sentido. |
for(new i; i<contarIndex; i++) {
SetObjectMaterialText(object, indexTXD[i], ...);
}
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;
Ni yo entendн bien la estructuraciуn de este cуdigo, їquй quieres lograr?, si es un ciclo estб bien como spell lo dijo.
|