/combine 3 14 2 26
/combine 2 3 14 26 or /combine 2 14 26 3
if((s1==2 && s2==3 && s3==14 && s4==26) || (s1==3 && s2==2 && s3==14 && s4==26) || (...) || (...))
if(s1 == 3)
{
if(s2 == 14)
{
if(s3 == 2)
{
if(s4 == 26)
{
//func...
}
}
}
}
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;
}
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
}
}
Originally Posted by Phento
pawn Код:
|
Originally Posted by [HiC
TheKiller ]
pawn Код:
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)
{
...
}
}
Originally Posted by CaHbKo
pawn Код:
|
dcmd_combine(playerid,params[])
{
new
s1,
s2,
s3,
s4,
bool:Correct = false;
if(sscanf(params, "dddd", s1, s2, s3, s4)) { return SendClientMessage(playerid, red, "Usage: /combine 4 number"); }
else
{
if(s1 == 2) { if(s2 == 5) { if(s3 == 6) { if(s4 == 1) {
Correct = true;
}}}}
}
if(Correct == true)
{
SendClientMessage(playerid, red, "Correct");
} else {
SendClientMessage(playerid, yellow, "Not agreement.");
}
return 1;
}
stock VarsContain(v1, c1, v2, c2, v3=-1, c3=-1, v4=-1, c4=-1)
{
if(v3>-1 && v4>-1)
{
if(v1==c1||v1==c2||v1==c3||v1==c4)
{
if(v2==c1||v2==c2||v2==c3||v2==c4)
{
if(v3==c1||v3==c2||v3==c3||v3==c4)
{
if(v4==c1||v4==c2||v4==c3||v4==c4)
{
return 1;
}
}
}
}
}
else if(v3>-1 && v4==-1)
{
if(v1==c1||v1==c2||v1==c3)
{
if(v2==c1||v2==c2||v2==c3)
{
if(v3==c1||v3==c2||v3==c3)
{
return 1;
}
}
}
}
else if(v3==-1 && v4==-1)
{
if(v1==c1||v1==c2)
{
if(v2==c1||v2==c2)
{
return 1;
}
}
}
return 0;
}