Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Command

$
0
0
Hello guys, I want Adding Parameters Within Parameters!

my code;
Code:

COMMAND:give(playerid, params[])
{
        new option[10];

        if(sscanf(params, "s[10]", option)) return SendClientMessage(playerid, 0xff0000ff, "USAGE: /give [money | weapon]");

        if(!strcmp(option, "money", true))
        {
                new TargetID,
                          Cash;

            if(sscanf(params, "ui", TargetID, Cash)) return SendClientMessage(playerid, 0xff0000ff, "USAGE: /give money [PlayerID] [Cash]");
            {
                if(TargetID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xff0000ff, "Invalid Player ID!");

                        if(GetPlayerMoney(playerid) < Cash) return SendClientMessage(playerid, 0xff0000ff, "You do not have that much money!");

                        new paystring[128],
                                paidstring[128],
                                player[MAX_PLAYER_NAME],
                                target[MAX_PLAYER_NAME];

                        GetPlayerName(playerid, player, sizeof(player));
                        GetPlayerName(TargetID, target, sizeof(target));
                        format(paystring, sizeof(paystring), "You have given $%i to %s.", Cash, target);
                        format(paidstring, sizeof(paidstring), "%s has paid you %i.", player, Cash);
                        SendClientMessage(playerid, 0xff0000ff, paystring);
                        SendClientMessage(TargetID, 0xff0000ff, paidstring);
                        GivePlayerMoney(playerid, -Cash);
                        GivePlayerMoney(TargetID, Cash);
                        return 1;
                }
        }

        if(!strcmp(option, "weapon", true))
        {
            new TargetID;

            if(sscanf(params, "u", TargetID)) return SendClientMessage(playerid, 0xff0000ff, "USAGE: /give weapon [PlayerID]");
            {
                if(TargetID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xff0000ff, "Invalid Player ID!");
                // Your own weapon code here.
                    return 1;
                }
        }
        return 1;
}

it provides no return

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>