#1

Hey, so I'm trying to make a command with multiple parameters, I mean:
Code:
/put [option] [ammount]
And the option can be " Materials " or " Drugs ".With strcmp I got it, but can't get it with ZCMD, looked over tutorials but didn't find anything like this.So, for exemple:
Code:
 /put Materials 50
and
Code:
 /put Drugs 10
Until now I got this code, but it's not working in game...:
pawn Code:
CMD:put(playerid, params[])
{
    new le = PlayerInfo[playerid][pLeader], me = PlayerInfo[playerid][pMember], string[24], option, value;
    if(le==1||le==2||le==3||le==4||le==7||le==9||le==10||le==11||me==1||me==2||me==3||me==4||me==7||me==9||me==10||me==11) return SCM(playerid, COLOR_GREY,"You are not a gang member");
    else if(!PlayerToPoint(25.0,playerid,2027.5966,1008.9321,10.8203) || !PlayerToPoint(3.0,playerid,-2190.7061,641.7987,49.4375) || !PlayerToPoint(3.0,playerid,2782.7209,-1957.9377,13.5469) || !PlayerToPoint(3.0,playerid,679.4280,-1276.8392,13.5956) || !PlayerToPoint(3.0,playerid,2156.3076,-1455.8517,25.5391) || !PlayerToPoint(3.0,playerid,2494.8640,-1668.1879,13.3438)) return SCM(playerid, COLOR_GREY,"You are not at the right place");
    else if (sscanf(params, "s[24]i", option, value)) return SCM(playerid, COLOR_GREY,"USAGE: /put [Materials/Drugs] [ammount]");
    else
    {
        if(value > PlayerInfo[playerid][pMats]) return SCM(playerid, COLOR_GRAD2, "You don't have that much!");
        else
        {
            PlayerInfo[playerid][pMats] -= value;
            PlayerInfo[playerid][pDepositedMats] += value;
            format(string, sizeof(string), "you deposited %d materials!", value);
            SendClientMessage(playerid, COLOR_GRAD4, string);
        }
        if(value > PlayerInfo[playerid][pDrugs]) return SCM(playerid, COLOR_GRAD2, "You don't have that much!");
        else
        {
            PlayerInfo[playerid][pDrugs] -= value;
            PlayerInfo[playerid][pDepositedDrugs] += value;
            format(string, sizeof(string), "you deposited %d grams of drugs!", value);
            SendClientMessage(playerid, COLOR_GRAD4, string);
        }
    }
    return 1;
}
Anyone can help me out please?
Reply
#2

pawn Code:
CMD:put(playerid, params[])
{
    new string[10],option,value;
    if(PlayerInfo[playerid][pLeader] == 0 || PlayerInfo[playerid][pMember] == 0) return SCM(playerid, COLOR_GREY,"You are not a gang member");
    if(!PlayerToPoint(25.0,playerid,2027.5966,1008.9321,10.8203) || !PlayerToPoint(3.0,playerid,-2190.7061,641.7987,49.4375) || !PlayerToPoint(3.0,playerid,2782.7209,-1957.9377,13.5469) || !PlayerToPoint(3.0,playerid,679.4280,-1276.8392,13.5956) || !PlayerToPoint(3.0,playerid,2156.3076,-1455.8517,25.5391) || !PlayerToPoint(3.0,playerid,2494.8640,-1668.1879,13.3438)) return SCM(playerid, COLOR_GREY,"You are not at the right place");
    if(sscanf(params,"s[129]d",option,value)) return SCM(playerid, COLOR_GREY,"USAGE: /put [Materials/Drugs] [ammount]");
    if(!strcmp(option,"Materials"))
    {
        if(value > PlayerInfo[playerid][pMats]) SCM(playerid, COLOR_GRAD2, "You don't have that much!");
        else
        {
            PlayerInfo[playerid][pMats] -= value;
            PlayerInfo[playerid][pDepositedMats] += value;
            format(string, sizeof(string), "you deposited %d materials!", value);
            SendClientMessage(playerid, COLOR_GRAD4, string);
        }
        return 1;
    }
    else
    {
        if(value > PlayerInfo[playerid][pDrugs]) SCM(playerid, COLOR_GRAD2, "You don't have that much!");
        else
        {
            PlayerInfo[playerid][pDrugs] -= value;
            PlayerInfo[playerid][pDepositedDrugs] += value;
            format(string, sizeof(string), "you deposited %d grams of drugs!", value);
            SendClientMessage(playerid, COLOR_GRAD4, string);
        }
        return 1;
    }
    SCM(playerid, COLOR_GREY,"USAGE: /put [Materials/Drugs] [ammount]");
    return 1;
}
I recommend you to use IsPlayerInRangeOfPoint.
Reply
#3

Thanks man!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)