[SOLVED] Checking multiple variables for their values
#4

Quote:
Originally Posted by Phento
pawn Код:
if(s1 == 3)
    {
        if(s2 == 14)
        {
            if(s3 == 2)
            {
                if(s4 == 26)
                {
                    //func...
                }
            }
        }
    }
This is wrong because s1 can be 14 as well as 2 and 26. Same for the s2, s3 and s4.

Quote:
Originally Posted by [HiC
TheKiller ]
pawn Код:
stock split(const strsrc[], strdest[][], delimiter)
{
  new li;
  i = 0;
  new aNum;
  new len;
  while(i <= strlen(strsrc))
  {
    if(strsrc[i] == delimiter || i == strlen(strsrc))
    {
      len = strmid(strdest[aNum], strsrc, li, i, 128);
      strdest[aNum][len] = 0;
      li = i+1;
      aNum++;
    }
    i++;
  }
  return 1;
}
So pretty much, do this.

pawn Код:
new data[4][10];
split(/*Source*/, data, ' ');
for(new i = 0; i<4; i++)
{
  if(strval(data[i]) == /*Value here*/)
  {
  //One of the numbers is a certain number
  }
}
I don't understand what "split" has to do here..

I need something like..
pawn Код:
*a player enters /combine 2 5 6 1*
if(!sscanf(params, "iiii", s1, s2, s3, s4))
{
 if(All of the numbers contain 6 5 2 1)
 {
 ...
 }
}
Reply


Messages In This Thread
[SOLVED] Checking multiple variables for their values - by CaHbKo - 28.02.2010, 17:25
Re: [HELP] Checking multiple variables for their values - by smeti - 28.02.2010, 17:36
Re: [HELP] Checking multiple variables for their values - by [HiC]TheKiller - 28.02.2010, 17:37
Re: [HELP] Checking multiple variables for their values - by CaHbKo - 28.02.2010, 17:45
Re: [HELP] Checking multiple variables for their values - by smeti - 28.02.2010, 18:11
Re: [HELP] Checking multiple variables for their values - by CaHbKo - 01.03.2010, 12:04

Forum Jump:


Users browsing this thread: 1 Guest(s)