mSelection doesn't show all skins? +rep
#1

Quote:

if(listitem == 1)
{
new Skin[312], count = -1;
for(new i = 1; i < sizeof(Skin); i++)
{
if(i != 0 && i != 300 && i != 74 && (i < 274 || i > 28 && (i < 264 || i >267) && i != 149 &&
i != 311 && i != 310 && i != 309 && i != 308 && i != 307 && i != 306 && i != 302 && i != 301 &&
i != 300)
{
count++;
Skin[count] = i;
}
}
if(count != -1) ShowModelSelectionMenuEx(playerid, Skin, count, "Skin Selection", 5, 0.0, 0.0, 0.0);

It does show only one page out of I think 12 that exists in samp, why?
Reply
#2

You shouldn't initialize count with -1, but with zero.

Then, switch these two lines:
pawn Code:
count++;
Skin[count] = i;
Otherwise count will always be 1 less than there are Skins in the Array.

Also replace
pawn Code:
if(count != -1)
with
pawn Code:
if(count != 0)
However that only causes the last Skin to be skipped, not 11 pages. But I didn't notice anything else..
Reply
#3

Quote:
Originally Posted by NaS
View Post
You shouldn't initialize count with -1, but with zero.

Then, switch these two lines:
pawn Code:
count++;
Skin[count] = i;
Otherwise count will always be 1 less than there are Skins in the Array.

Also replace
pawn Code:
if(count != -1)
with
pawn Code:
if(count != 0)
However that only causes the last Skin to be skipped, not 11 pages. But I didn't notice anything else..
switch this
count++;
Skin[count] = i;
with what?,
Reply
#4

Quote:
Originally Posted by DemME
View Post
switch this
count++;
Skin[count] = i;
with what?,
I meant switch the order of those two lines, or make it

pawn Code:
Skin[count ++] = i;
Otherwise "count" will not contain the actual number of elements in the Array, but one less (after the loop).

This shouldn't be the reason for so many entries missing though (I don't see anything else wrong).
Reply
#5

Quote:
Originally Posted by NaS
View Post
I meant switch the order of those two lines, or make it

pawn Code:
Skin[count ++] = i;
Otherwise "count" will not contain the actual number of elements in the Array, but one less (after the loop).

This shouldn't be the reason for so many entries missing though (I don't see anything else wrong).
still not working , supposdly it doesnt show the menu at all.
Reply
#6

What I can see in your code is that you are limiting the skins to be either equal to 0 or 300 or 74 or less than 274 or greater than 28 or less than 264 or greater than 267 or equal to 149 or
equal to 311 or 310 or 309 or 308 or 307 or 306 or 302 or 301 or 300, why don't you remove all of that and make it be either greater than 1 or smaller than 312

Code:
if(listitem == 1)
{
new Skin[312], count = -1;
for(new i = 1; i < sizeof(Skin); i++)
{
if(i>=1 && i=<312);
{
count++;
Skin[count] = i;
}
}
if(count != -1) ShowModelSelectionMenuEx(playerid, Skin, count, "Skin Selection", 5, 0.0, 0.0, 0.0);
This is the code which I guess will make it work..
Reply
#7

Quote:
Originally Posted by JasonRiggs
View Post
What I can see in your code is that you are limiting the skins to be either equal to 0 or 300 or 74 or less than 274 or greater than 28 or less than 264 or greater than 267 or equal to 149 or
equal to 311 or 310 or 309 or 308 or 307 or 306 or 302 or 301 or 300, why don't you remove all of that and make it be either greater than 1 or smaller than 312

Code:
if(listitem == 1)
{
new Skin[312], count = -1;
for(new i = 1; i < sizeof(Skin); i++)
{
if(i>=1 && i=<312);
{
count++;
Skin[count] = i;
}
}
if(count != -1) ShowModelSelectionMenuEx(playerid, Skin, count, "Skin Selection", 5, 0.0, 0.0, 0.0);
This is the code which I guess will make it work..
I have noticed that you changed if it's equal or greater, the problem is these errors/warnings:
Quote:

../gamemodes/core.pwn(5234) : warning 211: possibly unintended assignment
../gamemodes/core.pwn(5234) : error 022: must be lvalue (non-constant)
../gamemodes/core.pwn(5234) : error 029: invalid expression, assumed zero
../gamemodes/core.pwn(5234) : warning 215: expression has no effect
../gamemodes/core.pwn(5234) : error 001: expected token: ";", but found ")"
../gamemodes/core.pwn(5234) : fatal error 107: too many error messages on one line

5234 line that one code you have changed.
Reply
#8

Have u tried adding the line which I've gave you? and You got the same errors?
Reply
#9

Quote:
Originally Posted by JasonRiggs
View Post
Have u tried adding the line which I've gave you? and You got the same errors?
Indeed
Reply
#10

Ahh, But i see in the previous line you already made the same which I've done in the line i gave you, I believe removing the line which I've given you will make it work..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)