Want to ask
#5

While OneDay's solution allows multiple letters to be used at once, for a simpler way of just M/K (or m/k) at the end, you can use custom sscanf specifier as well:
pawn Код:
SSCANF:money(k_string[])
{
    new k_length = strlen(k_string);

    switch (k_string[k_length - 1])
    {
        case 'K', 'k':
        {
            k_string[k_length - 1] = EOS;
            return strval(k_string) * 1000;
        }
        case 'M', 'm':
        {
            k_string[k_length - 1] = EOS;
            return strval(k_string) * 1000000;
        }
    }

    return strval(k_string);
}
pawn Код:
if (sscanf(params, "uk<money>", id, value)) return error_usage_here..
Reply


Messages In This Thread
Want to ask - by Foxer123456 - 20.12.2017, 12:04
Re: Want to ask - by Ritzy2K - 20.12.2017, 12:09
Re: Want to ask - by OneDay - 20.12.2017, 12:30
Re: Want to ask - by Foxer123456 - 20.12.2017, 15:27
Re: Want to ask - by Konstantinos - 20.12.2017, 16:17
Re: Want to ask - by OneDay - 19.04.2018, 09:45
Re: Want to ask - by jasperschellekens - 19.04.2018, 10:20
Re: Want to ask - by OneDay - 19.04.2018, 10:22

Forum Jump:


Users browsing this thread: 1 Guest(s)