First command in ZCMD.
#1

And then guys, I have a problem here that is the following, I never did command like this, the first time, when I type this command;

PHP код:
COMANDO:inventario(playeridparams[])
{
    new 
subcmd[128], subcmd2[128], iFloat:XFloat:YFloat:Z;
    if(
sscanf(params"s[128]I(-1)"subcmdi))
    {
        
SendClientMessage(playeridCOLOR_SEAGREEN"Digite: (/i)nventario (pegar, guardar e dropar).");
        return 
1;
    }
    if(!
strcmp(subcmd"dropar"true))
    {
        if(
sscanf(params"s[128]I(-1)"subcmd2i))
        {
             
SendClientMessage(playeridCOLOR_SEAGREEN"USE: (/i)nventario dropar [arma/marijuana/crack/cocaina]");
        }
        if(!
strcmp(subcmd2"arma"true))
        {
        } 
... it does not work properly, what did I do wrong at the time of creating the command?
Reply
#2

PHP код:
CMD:set(playeridparams[])
{
    
    new
        
parameter[30 '\0'],
        
scmd[50];
    if(
sscanf(params"s[30]S()[50]"parameterscmd)) return SCM(playeridLBLUE"/set [money - score - kills - death - skin - vhp - hp - armor - v(irtual)w(orld) - int(erior)]"); 
This is an example.
Reply
#3

Oh, I used your base, but it does not work because?

PHP код:
CMD:set(playerid,*params[]) 

 
       new 
         
parameter[30+'\0'], 
        
parameter2[30+'\0'], 
       
scmd[50]; 
    if(
sscanf(params,"s[30]S()[50]",parameter,scmd))returnSCM(playerid,LBLUE,"/set*[weapor]");
    if(
sscanf(params,"weapor",parameter,scmd))
    {
         if(
sscanf(params,"s[30]S()[50]",parameter2,scmd))returnSCM(playerid,LBLUE,"/setweapor ak47");
         if(
sscanf(params,"ak47",parameter2,scmd))
         {
         }
    }
    if(
sscanf(params,"ammo",parameter,scmd))
    {
    {
         if(
sscanf(params,"s[30]S()[50]",parameter2,scmd))returnSCM(playerid,LBLUE,"/setammo ak47");*
         if(
sscanf(params,"ak47",parameter2,scmd))
         {
         }
    } 
Reply
#4

Have you even got SCM defined in your script?


It's pretty reckless of dayrion to give out examples with custom defines/functions in them.


"SCM" is simply a SendClientMessage shortening, does nothing but encourage laziness. Modify those lilnes to be correct.

As for your return lines, you have returnSCM, not return SCM...
Reply
#5

I do not have it, how would it be?
Reply
#6

At the top

Код:
#define SCM                SendClientMessage
Reply
#7

My bad, I though everyone know what SCM mean.
Well; You need to understand how sscanf works. There is an another example because my English suck.
-1 in hexadecimal mean 0xFFFFFF
PHP код:
CMD:command(playeridparams[])
{
    
// » /command [parameter] [subcmd] [other]
     
new 
        
parameter[30 '\0'], 
        
subcmd[50],
        
other[25]; 
    if(
sscanf(params"s[30]S()[50]S()[25]"parametersubcmdother))
        return 
SendClientMessage(playerid, -1"/command [ammo/...]");
    if(!
strcmp(parameter"ammo"))
    {
        if(
sscanf(subcmd"s[50]"subcmd))
            return 
SendClientMessage(playerid, -1"/command ammo [weapon]");
        if(!
strcmp(subcmd"ak47"))
        {
            new 
ammo;
            if(
sscanf(other"i"ammo))
                return 
SendClientMessage(playerid, -1"/command ammo ak47 [ammo]");
            return 
1;
        }
    } 
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)