Error with enum
#1

I trying to save this at the enum but don't work

pawn Код:
enum nInfo
{
    nNome[32],
    nTelefone,
    nLocalizacao[128],
    nSituacao[128],
};
new NoveInfo[nInfo];

//This's to save:
stock NoveNome(string[])
{
    NoveInfo[nNome] = string;
    return 1;
}
stock NoveSituacao(string[])
{
    NoveInfo[nSituacao] = string;
    return 1;
}
stock NoveLocalizacao(string[])
{
    NoveInfo[nLocalizacao] = string;
    return 1;
}

//Using

format(wanted, sizeof(wanted), "%s", GetPlayerNameEx(playerid));
NoveNome(wanted)
But this give errors "array sizes do not match..."
THIS DON'T SAVE TOO!!! : / to read after..
Any help? =\
Reply
#2

You have to use strmid to turn a multidimensional array equal to another text variable (string).

Strmid will extract the content of a string to the string with multidimensional array, and everything without give errors related to the arrays .

Here, i did it for you

pawn Код:
enum nInfo
{
    nNome[32],
    nTelefone,
    nLocalizacao[128],
    nSituacao[128],
};
new NoveInfo[nInfo];


//This's to save:
stock NoveNome(string[])
{
    //NoveInfo[nNome] = string;
    strmid(NoveInfo[nNome],string,false,strlen(string),32);
    return 1;
}
stock NoveSituacao(string[])
{
    //NoveInfo[nSituacao] = string;
    strmid(NoveInfo[nSituacao],string,false,strlen(string),128);
    return 1;
}
stock NoveLocalizacao(string[])
{
    //NoveInfo[nLocalizacao] = string;
    strmid(NoveInfo[nLocalizacao],string,false,strlen(string),128);
    return 1;
}
I hope that i have helped
Reply
#3

You could also try changing

pawn Код:
enum nInfo
To

pawn Код:
enum nInfo[][] =
Or something, At least that works with me >.<
Reply
#4

Thanks everybody <3
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)