10.12.2016, 18:56
(
Последний раз редактировалось RIDE2DAY; 10.12.2016 в 20:00.
)
Nice trick there, at first I thought it wouldn't work, but it does actually!
Konstantinos did well using ASCII, that's a good way to get rid of the switch statement.
It should work now.
Good job.
Konstantinos did well using ASCII, that's a good way to get rid of the switch statement.
PHP код:
stock SetCombination(&var, slot, value)
{
new comb[11];
format(comb, 11, "%010i", var);
comb[9 - slot] = (1 <= value <= 9) ? 48 + value : 48;
var = strval(comb);
return 1;
}
stock GetCombination(var, slot)
{
new comb[11];
format(comb, 11, "%010i", var);
if(48 <= (slot = comb[9 - slot]) <= 57) return slot - 48;
return 0;
}
Good job.