Cmd help
#1

pawn Код:
CMD:giveweed(playerid,params[])
{
    if(PlayerInfo[playerid][pJob] == 1)
    {
        new targetid,type;
        if(sscanf(params, "ud", targetid, type)) return SendClientMessage(playerid, -1, "[Usage]: /giveweed [Part of Name/Player ID] [Amount]");
        if(type > PlayerInfo[playerid][pStressweed])return SendClientMessage(playerid,-1,"ERROR: You do not have that much weed!");
        if(type > PlayerInfo[playerid][pChronicweed])return SendClientMessage(playerid,-1,"ERROR: You do not have that much weed!");
        if(type > PlayerInfo[playerid][pKushweed])return SendClientMessage(playerid,-1,"ERROR: You do not have that much weed!");
        if(targetid == playerid)return SendClientMessage(playerid,-1,"ERROR: You cannot give drugs to your self!");
        PlayerInfo[playerid][pStressweed] -= type;
        PlayerInfo[targetid][pStressweed] +=type;
        PlayerInfo[playerid][pChronicweed] -= type;
        PlayerInfo[targetid][pChronicweed] +=type;
        PlayerInfo[playerid][pKushweed] -= type;
        PlayerInfo[targetid][pKushweed] +=type;
    }
    return 1;
}
how would I make so what you have to type "/giveweed (weedtype) (id) (amount)?
Reply
#2

You will need to add another letter to the sscanf, like this:

pawn Код:
if(sscanf(params, "dud", type, targetid, amount)) return SendClientMessage(playerid, -1, "[Usage]: /giveweed [Type] [Part of Name/Player ID] [Amount]");
It's up to you what you do with the extra parameter.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)