Problem in cmd.
#1

I'm having a problem with this command, it's like the following, I can not put the amount, just typing /i drop money already drops the item, being that was to be, /i drop money.

PHP код:
ALTCOMMAND:i->inventario;
COMMAND:inventario(playeridparams[])
{
    new
        
parameter[30 '\0'],
        
subcmd[50], other;
    if(
sscanf(params"s[30]S()[50]S()[25]"parametersubcmdother))
    {
        
Inventario(playerid);
        
        return 
SendClientMessage(playeridCOLOR_SEAGREEN"USE: (/i)nventario (utilizar ou dropar).");
    }
    if(!
strcmp(parameter"dropar"))
    {
           
gunname[128],
           
Float:XFloat:YFloat:Z;
           
        if(
IsPlayerInAnyVehicle(playerid))
            return 
SendClientMessage(playeridCOLOR_LIGHTRED"ERRO: Vocк nгo pode usar este comando em um veнculo.");
        if(
sscanf(subcmd"s[50]"subcmd))
            return 
SendClientMessage(playeridCOLOR_WHITE2"USE: (/i)nventario dropar [nome]");
       
      if(!
strcmp(subcmd"dinheiro"))
        {
            if(!
sscanf(params"i"other))
                return 
SendClientMessage(playeridCOLOR_WHITE2"USE: (/i)nventario dropar dinheiro [quantia]");
                
            if(
GetPlayerMoney(playerid) == other)
            {
             }
            else 
SendClientMessage(playeridCOLOR_LIGHTRED"ERRO: Vocк nгo possui essa quantia em mгos.");
        } 
Shows the first function as if I had typed/i, But no, I'm typing /i dropar dinheiro, It was to show

Quote:

USE: (/i)nventario dropar dinheiro [quantia]

show:
Quote:

USE: (/i)nventario (utilizar ou dropar).

Reply
#2

Your way of using sscanf is weired itself.
Reply
#3

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Your way of using sscanf is weired itself.
Agreed, using sscanf and strcmp, lol, so ugly
No code identation and empty code blocks.
such beautiful
Reply
#4

I'd suggest you to follow a proper tutorial on how to use ZCMD + SSCANF, because the way you script isn't effective at all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)