Infinite Skins With for(CivSkins) OnGameModeInit
#1

So im trying to get this script to auto add these skins. So heres what i got under OnGameModeInit:
Код:
for(new i = 0; i < sizeof(CivSkins); i++)
	{
	  for(new b = 0; b < sizeof(BadSkins); b++)
	  {
	    if(BadSkins[b] != CivSkins[i])
	    {
	  			AddPlayerClass(CivSkins[i],2028.8048,1551.5974,26.5878,90.0,0,0,0,0,0,0);
			}
			else
			{
			  printf("WARNING: Bad skin detected. ID %d.",CivSkins[i]);
			}
		}
	}
Here is my two arrays.
Код:
new BadSkins[15] =
{
3, 4, 5, 6, 8, 42, 65, 74, 86, 119, 149, 208, 268, 273, 289
};
new CivSkins[4] =
{
271,
270,
269,
272
};
But when i open the game up and join, the skins load, but there are like 20 of each.... What is wrong with it?
Reply
#2

You are creating a loop inside a loop, Therefore its firing
pawn Код:
if(BadSkins[b] != CivSkins[i])
        {
                AddPlayerClass(CivSkins[i],2028.8048,1551.5974,26.5878,90.0,0,0,0,0,0,0);
            }
            else
            {
              printf("WARNING: Bad skin detected. ID %d.",CivSkins[i]);
            }
20 times as its inside the loop of BadSkins which is equal to 20, Also no skins inside of CivSkins are bad skins, So why check smthing that you can see is okay
Reply
#3

Ok, i see where you're coming from. Umm, im thinking it through right now and im not quite sure i know how to fix this. Tips?
Reply
#4

Thanks guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)