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)
{
...
}
}