for(new < bugs!!!!! -
SequenceCuz - 06.12.2014
i define this
#define MAX_FAMILY 1000
and this is my code
PHP код:
CMD:allfam(playerid, params[])
{
new string[512];
SCM(playerid,COLOR_LIGHTBLUE, "-------------------¤ГНє¤ГСЗ·ХиКГйТ§бЕйЗ--------------------");
for(new i=1; i<= MAX_FAMILY; i++)
{
if(FamilyInfo[i][fCreate] == 1)
{
format(string, sizeof(string), "КЕкНµ·Хи %i | ¤ГНє¤ГСЗ: %s | ЛСЗЛ№йТ: %s | КБТЄФЎ %i ¤№ ", i, FamilyInfo[i][fName], FamilyInfo[i][fOwner], count);
SCM(playerid,0x09F797C8, string);
count = 0;
}
}
return 1;
}
Command work fine but it also said unknown command
but when i change this
PHP код:
for(new i=1; i<= MAX_FAMILY; i++)
{
to
PHP код:
for(new i=1; i<= 950; i++)
{
it work fine and don't send the unknown fuckin message
but when i try to redefine
PHP код:
#define MAX_FAMILY 950
and change this
PHP код:
for(new i=1; i<= 950; i++)
{
back to
PHP код:
for(new i=1; i<= MAX_FAMILY; i++)
{
it still fuckin send unknown fuckin messageeeeeee
it happen to all stuff how to fixed it
Re: for(new < bugs!!!!! -
AnthonyTimmers - 06.12.2014
Where did you place the #define? What's the exact error message?
Also, what language is that?
Re: for(new < bugs!!!!! -
SequenceCuz - 06.12.2014
Quote:
Originally Posted by AnthonyTimmers
Where did you place the #define? What's the exact error message?
Also, what language is that?
|
I PLACE THE DEFINE ON TOP OF SCRIPT
and i know it right
but i thinkk you don't understood the point of me
it not send error it send unknown command but the command is workk
i mean when i use i< 1000 i ++ it send the unknown command
but i try to use i< 50 i++ it work fine without unknown meassge
btw language is thai
Re: for(new < bugs!!!!! -
DrumYum - 06.12.2014
Код:
for(new i=0; i < MAX_FAMILY; i++)
Maybe loop goes out of array bounds?
Re: for(new < bugs!!!!! -
SequenceCuz - 06.12.2014
still not fix
Re: for(new < bugs!!!!! -
DrumYum - 06.12.2014
How about that?
Код:
for(new i = 0; i < sizeof(FamilyInfo); i++)
Re: for(new < bugs!!!!! -
SequenceCuz - 06.12.2014
Quote:
Originally Posted by DrumYum
How about that?
Код:
for(new i = 0; i < sizeof(FamilyInfo); i++)
|
still not
Re: for(new < bugs!!!!! -
Kyance - 06.12.2014
Then just keep it as 1000, MAX_FAMILY is just a number '1000'.
MAX_FAMILY = Number
MAX_PLAYERS = Number
MAX_VEHICLES = Number
...
I hope you get the point - Every #define MAX_* Is basically the "last number" for something, it's not something special.
Re: for(new < bugs!!!!! -
SequenceCuz - 06.12.2014
Quote:
Originally Posted by Kyance
Then just keep it as 1000, MAX_FAMILY is just a number '1000'.
MAX_FAMILY = Number
MAX_PLAYERS = Number
MAX_VEHICLES = Number
...
I hope you get the point - Every #define MAX_* Is basically the "last number" for something, it's not something special.
|
i forgot to tell you it work fine on i < 950 but when i< 1000 it also send unknown message
Re: for(new < bugs!!!!! -
PowerPC603 - 06.12.2014
pawn Код:
for(new i=1; i < MAX_FAMILY; i++)
Since you created the array FamilyInfo using something similar as this:
pawn Код:
new FamilyInfo[MAX_FAMILY][EnumFamily];
You're in fact creating an array with 1000 indices, going from index 0 to 999.
Your loop ran from 1 to 1000 because of the "i <= MAX_FAMILY".
You have to run it from 1 to MAX_FAMILY-1, or just use the above code (i < MAX_FAMILY).
That's why your command gave you "Unknown command" because it crashed while accessing the array at index 1000, while the max index is only 999 (index-out-of-bounds error).
And that's also when you set the loop to run from 1 to 950, everything works fine, because you won't go outside the array's lower or upper indices.