25.11.2014, 18:31
pawn Код:
else if(strcmp(params, "mats", true) == 0)
{
if(GetPVarInt(playerid, "mID") >= 0)
{
new amount, dealer, price;
amount = GetPVarInt(playerid, "mAmount");
price = GetPVarInt(playerid, "mPrice");
dealer = GetPVarInt(playerid, "mID");
if(IsPlayerConnected(dealer))
{
playerVariables[playerid][pMoney] -= price;
playerVariables[playerid][pMaterials] += amount;
playerVariables[dealer][pMaterials] -= amount;
format(szMessage, sizeof(szMessage), "You have bought %d mats from %s for $%i", amount, playerVariables[dealer][pNormalName], price);
SCM(playerid, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "%s has bought %d mats from you, for $%i." , playerVariables[playerid][pNormalName], amount, price);
SCM(dealer, COLOR_LIGHTBLUE, szMessage);
}
else
{
SCM(playerid, -1, "This player is not connected!");
DeletePVar(playerid, "mAmount");
DeletePVar(playerid, "mID");
DeletePVar(playerid, "mPrice");
}
}
else
{
SCM(playerid, -1, "You don't have an active mats offer.");
}
}
else SendClientMessage(playerid, COLOR_GREY, "Invalid item specified.");