[Include] Numeric combinations.
#8

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.
PHP код:
stock SetCombination(&var, slotvalue)
{
    new 
comb[11];
    
format(comb11"%010i", var);
    
comb[slot] = (<= value <= 9) ? 48 value 48;
    var = 
strval(comb);
    return 
1;
}
stock GetCombination(var, slot)
{
    new 
comb[11];
    
format(comb11"%010i", var);
    if(
48 <= (slot comb[slot]) <= 57) return slot 48;
    return 
0;

It should work now.

Good job.
Reply


Messages In This Thread
Numeric combinations. - by Swedky - 10.12.2016, 16:03
Re: Numeric combinations. - by SsHady - 10.12.2016, 16:17
Re: Numeric combinations. - by Jayse - 10.12.2016, 16:41
Re: Numeric combinations. - by Crayder - 10.12.2016, 16:48
Re: Numeric combinations. - by AbyssMorgan - 10.12.2016, 16:51
Re: Numeric combinations. - by Konstantinos - 10.12.2016, 17:00
Re: Numeric combinations. - by Swedky - 10.12.2016, 17:44
Re: Numeric combinations. - by RIDE2DAY - 10.12.2016, 18:56
Re: Numeric combinations. - by Swedky - 10.12.2016, 20:39
Re: Numeric combinations. - by Konstantinos - 10.12.2016, 21:17

Forum Jump:


Users browsing this thread: 1 Guest(s)