Optional string (sscanf)
#1

So I wanted to create a /mute command wherein the admin who uses the command may or may not input a reason as to why he'd mute the player. Here's where I got so far

PHP код:
CMD:mute(playeridparams[])
{
    new 
idreason[64], time;
    if (
sscanf(params"dS[24]d"idreasontime))
    {
        
SendClientMessage(playerid, -1"USAGE: /mute [id] [reason (optional)] [minutes]");
        return 
1;
    }
    
Mute(idreasontime);
    return 
1;

Thing is that when I use it, say for example, like this

Код:
/mute 1 20
/mute - the command

1 - the ID

20 - the minutes

it sends me the

Код:
SendClientMessage(playerid, -1, "USAGE: /mute [id] [reason (optional)] [minutes]");
I wanted the reason to be optional. How u do that?


Oh and it sends me a
Код:
sscanf warning: No default value found.
Reply


Messages In This Thread
Optional string (sscanf) - by NealPeteros - 16.09.2018, 14:53
Re: Optional string (sscanf) - by AlamoTR - 16.09.2018, 16:14
Re: Optional string (sscanf) - by Undef1ned - 16.09.2018, 16:56

Forum Jump:


Users browsing this thread: 1 Guest(s)