Error with enum - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Error with enum (
/showthread.php?tid=235406)
Error with enum -
Ricop522 - 05.03.2011
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? =\
Re: Error with enum - rjjj - 05.03.2011
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
Re: Error with enum -
alpha500delta - 05.03.2011
You could also try changing
To
Or something, At least that works with me >.<
Re: Error with enum -
Ricop522 - 05.03.2011
Thanks everybody <3