20.01.2013, 18:43
Here I have a command, it is '/give' with optional parameters.
The command is: /give [player id or name] [drug/weapon/mats] [amount], but the amount isn't setting upon the "mats" section.
Here is the code:
[pawn]
That's the sscanf line, here is the "mats" section:
It's not allowing me to change the "amount" parameter, please help.
The command is: /give [player id or name] [drug/weapon/mats] [amount], but the amount isn't setting upon the "mats" section.
Here is the code:
[pawn]
pawn Код:
command(give, playerid, params[])
{
new id, section[12], type[12], amount, string[128];
if(sscanf(params, "us[12]S[12]I(0)", id, section, type, amount))
pawn Код:
else if(strmatch(section, "mats"))
{
if(amount == 0)return SendClientMessage(playerid, GREY, "Usage: /give [player id or name] mats [amount]");
if(Player[playerid][Materials] >= amount)
{
Player[playerid][Materials] -= amount;
Player[id][Materials] += amount;
format(string, sizeof(string), "%s has given you %d materials.", MaskName(playerid), amount);
SendClientMessage(id, SHOUT, string);
format(string, sizeof(string), "You have given %d materials to %s.", amount, MaskName(id));
SendClientMessage(playerid, SHOUT, string);
format(string, sizeof(string), "* %s hands over some materials to %s. *", MaskName(playerid), MaskName(id));
CloseMessage(playerid, ACTION, string);
}
else return SendClientMessage(playerid, GREY, "You don't have that many materials.");
}