new Arms[128]; enum pMats { steel1, steel2, iron1, iron2 } new PlayerMats[MAX_PLAYERS][pMats]; CMD:becomearms(playerid, params[]) { if(Mech[playerid] != 1 || Drug[playerid] != 1) { if(IsPlayerInRangeOfPoint(playerid, 4, 2333.7654, 61.6830, 26.7058)) { Arms[playerid] = 1; SendClientMessage(playerid, COLOR_YELLOW, "You are now an Arms Dealer."); SendClientMessage(playerid, COLOR_YELLOW, "USAGE: Use /armshelp to view commands for this job."); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "You must go to Montgomery to get this job."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You must quit your current job to become an Arms Dealer"); return 1; } } CMD:armshelp(playerid, params[]) { if(Arms[playerid] == 1) { SendClientMessage(playerid, COLOR_YELLOW, "USAGE:/getsteel /getiron /deliversteel /deliveriron"); SendClientMessage(playerid, COLOR_YELLOW, "USAGE:/checksteel /checkiron /sellsteel /selliron"); SendClientMessage(playerid, COLOR_YELLOW, "USAGE:/sellgun /quitarms"); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "You are not an Arms Dealer, you can not use that command."); return 1; } } CMD:quitarms(playerid, params[]) { if(Arms[playerid] == 1) { Arms[playerid] = 0; SendClientMessage(playerid, COLOR_YELLOW, "You have now quit your job as an Arms Dealer."); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "You were never an Arms Dealer to begin with, so you can not quit."); return 1; } } CMD:getsteel(playerid, params[]) { if(Arms[playerid] == 1) { if(IsPlayerInRangeOfPoint(playerid, 4, 245.4962, 1420.4618, 10.5604)) { if(PlayerMats[playerid][steel1] == 1) { if(GetPlayerMoney(playerid) >= 150) { PlayerMats[playerid][steel1] = 1; SendClientMessage(playerid, COLOR_YELLOW, "You have purchased some raw steel ignot"); SendClientMessage(playerid, COLOR_YELLOW, "Take to refinery to get usable steel"); GivePlayerMoney(playerid, -150); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "You can not afford $150"); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You can not carry anymore raw materials."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You must go to the oil refinery to get steel ignot."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You must be an Arms Dealer to use that commnad."); } return 1; } CMD:deliversteel(playerid, params[]) { if(Arms[playerid] == 1) { if(IsPlayerInRangeOfPoint(playerid, 4, 323.6306, 855.9609, 20.4063)) { if(PlayerMats[playerid][steel1] == 1) { PlayerMats[playerid][steel2] += 5; SendClientMessage(playerid, COLOR_YELLOW, "You have refined your steel ignot into 5 usable steel peices"); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "You do not have the required raw materials."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You must be at the refinery to convert into usable steel."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You must be an Arms Dealer to use that command."); } return 1; } CMD:checksteel(playerid, params[]) { new string[128]; format(string, sizeof(string), "You have %d peices of steel on you.", PlayerMats[playerid][steel2]); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; } CMD:sellsteel(playerid, params[]) { new targetid, amount; if(sscanf(params, "ud", targetid)) { if(amount > PlayerMats[playerid][steel2]) { if(targetid == playerid) { PlayerMats[playerid][steel2] -= amount; PlayerMats[targetid][steel2] += amount; SendClientMessage(playerid, COLOR_YELLOW, "You have sold some steel."); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "You can not sell to yourself."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You do not have that much steel to sell."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "USAGE:/sellsteel [ID] [amount]"); } return 1; } CMD:getiron(playerid, params[]) { if(Arms[playerid] == 1) { if(IsPlayerInRangeOfPoint(playerid, 4, -18.2313, -275.1777, 5.4297)) { if(PlayerMats[playerid][iron1] == 1) { if(GetPlayerMoney(playerid) >= 60) { PlayerMats[playerid][iron1] = 1; SendClientMessage(playerid, COLOR_YELLOW, "You have bought iron ignot."); GivePlayerMoney(playerid, -60); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "You can not afford $60 for the iron ignot."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You can not hold any more raw materials."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You must be in range of iron get to get iron ignot."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You must be an Arms Dealer to use that commnad."); } return 1; } CMD:deliveriron(playerid, params[]) { if(Arms[playerid] == 1) { if(IsPlayerInRangeOfPoint(playerid, 4, 844.9744, -603.0579, 18.4219)) { if(PlayerMats[playerid][iron1] == 1) { PlayerMats[playerid][iron2] += 12; SendClientMessage(playerid, COLOR_YELLOW, "You have now refined your iron ignot into 12 pieces of iron"); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "You do not have the required raw materials."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You must be at the refinery to change ignot into uasable iron."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You must be an Arms Dealer to use that command."); } return 1; } CMD:checkiron(playerid, params[]) { new string[128]; format(string, sizeof(string), "You have %d peices of iron on you.", PlayerMats[playerid][iron2]); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; } CMD:selliron(playerid, params[]) { new targetid, amount; if(sscanf(params, "ud", targetid)) { if(amount > PlayerMats[playerid][iron2]) { if(targetid == playerid) { PlayerMats[playerid][iron2] -= amount; PlayerMats[targetid][iron2] += amount; SendClientMessage(playerid, COLOR_YELLOW, "You have sold some iron."); return 1; } else { SendClientMessage(playerid, COLOR_YELLOW, "You can not sell to yourself."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "You do not have that much iron to sell."); return 1; } } else { SendClientMessage(playerid, COLOR_YELLOW, "USAGE:/selliron [ID] [amount]"); } return 1; }
CMD:sellsteel(playerid, params[])
{
new targetid, amount;
if(sscanf(params, "ud", targetid,amount)) //HERE: you never assigned the integer value to 'amount'
{
if(amount > PlayerMats[playerid][steel2])
{
if(targetid == playerid)
{
PlayerMats[playerid][steel2] -= amount;
PlayerMats[targetid][steel2] += amount;
SendClientMessage(playerid, COLOR_YELLOW, "You have sold some steel.");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "You can not sell to yourself.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "You do not have that much steel to sell.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "USAGE:/sellsteel [ID] [amount]");
}
return 1;
}
Do you want us to test it for you? XD
Looking through it really fast, I found an error here. pawn Код:
|
CMD:selliron(playerid, params[])
{
new targetid, amount;
if(sscanf(params, "ud", targetid,amount))
{
if(amount > PlayerMats[playerid][iron2])
{
if(targetid == playerid)
{
PlayerMats[playerid][iron2] -= amount;
PlayerMats[targetid][iron2] += amount;
SendClientMessage(playerid, COLOR_YELLOW, "You have sold some iron.");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "You can not sell to yourself.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "You do not have that much iron to sell.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "USAGE:/selliron [ID] [amount]");
}
return 1;
}