25.11.2014, 13:04
Hello .
this cmd sellmats , when player is sell mats to player , not get money.
Code:
+rep for any helped me, Thanks.
this cmd sellmats , when player is sell mats to player , not get money.
Code:
pawn Код:
CMD:sellmats(playerid, params[])
{
new target, amount, price;
if(sscanf(params, "uii", target, amount, price)) return SCM(playerid, -1, "Syntax: /sellmats [playerid] [amount] [price]");
if(amount <= playerVariables[playerid][pMaterials])
{
if(target != INVALID_PLAYER_ID)
{
if(playerVariables[target][pMoney] >= price)
{
SetPVarInt(target, "mAmount", amount);
SetPVarInt(target, "mPrice", price);
SetPVarInt(target, "mID", playerid);
format(szMessage, sizeof(szMessage), "** %s wish to sell you %d mats for $%i. Type /accept mats if you wish to accept.", playerVariables[playerid][pNormalName], amount, price);
SCM(target, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "** You wish to sell %d mats to %s, for $%i.", amount, playerVariables[target][pNormalName], price);
SCM(playerid, COLOR_LIGHTBLUE, szMessage);
}
else
{
SCM(playerid, -1, "This player does not have enough money for this mats!");
}
}
else
{
SCM(playerid, -1, "Player not connected.");
}
}
else
{
SCM(playerid, -1, "You don't have enough mats.");
}
return 1;
}