Como hacer esto? Array...
#2

Una manera es utilizando una pvar, otra forma seria utilizando inputtext en ondialogresponse ya que inputtext en un dialogo tipo LIST devuelve el texto seleccionado

PHP код:
new ids[256]; //Creamos un array para almacenar las ids
new string[800], fullstr[800];
format(string,sizeof(string), "{FFFFFF}Categoria\n");
strcat(fullstrstring);
new 
bool:detectarcrepetida true;
for (new 
0sizeof(Datamuebles); x++)
{
    for (new 
xx 0xx xxx++)
    {
        if (
strfind(Datamuebles[x][dmCategoria], Datamuebles[xx][dmCategoria]) == 0)
        {
            
detectarcrepetida false;
            break;
        }
    }
    if (
detectarcrepetida == false)
    {
        
detectarcrepetida true;
        continue;
    }
    
format(ids,sizeof(ids),"%s%d ",ids,x); //Almacenamos las ids
    
format(stringsizeof(string), "%s:%d\n",Datamuebles[x][dmCategoria],x);
    
strcat(fullstrstring);
}
SetPVarString(playerid,"CATEGORIA_IDS",ids); //Las guardamos en una Pvar
ShowPlayerDialog(playeridDIALOGO_MOBILIARIO_CATEGORIADIALOG_STYLE_TABLIST_HEADERS"{979A38}Categorias - Mobiliario"fullstr"Seleccionar""Cancelar");
//Donde cargas los datos
new ids_string[256],ids[100];
GetPVarString(playerid,"CATEGORIA_IDS",ids_string,sizeof ids_string); //Recuperamos los datos de la pvar
sscanf(ids_string,"a<i>[100]",ids); //con sscanf recuperamos los datos en un array
printf("Categoria seleccionada: %d",ids[listitem]); 
Reply


Messages In This Thread
Como hacer esto? Array... - by Juand - 21.07.2017, 04:08
Re: Como hacer esto? Array... - by Daniel-92 - 21.07.2017, 06:05
Re: Como hacer esto? Array... - by Juand - 21.07.2017, 07:22
Re: Como hacer esto? Array... - by Daniel-92 - 21.07.2017, 16:30
Re: Como hacer esto? Array... - by Juand - 21.07.2017, 22:45

Forum Jump:


Users browsing this thread: 1 Guest(s)