Yes, It work's fine except that when I type /forge goldore 1 it takes 1 silver ore not 5
Now it say's Not Enough Gold!?
//ItemForging
$itemPrices["SilverOre"] = "10 2 0 0 0 0 0";
$itemImage["SilverOre"] = nametoid("SilverOreItem");
$itemPrices["CopperOre"] = "5 0 0 0 0 0 0";
$itemImage["CopperOre"] = nametoid("CopperOreItem");
$itemPrices["GoldOre"] = "50 0 5 0 0 0 0";
$itemImage["GoldOre"] = nametoid("GoldOreItem");
$itemPrices["PineWood"] = "5 0 0 0 0 0 0";
$itemImage["PineWood"] = nametoid("PineWoodItem");
$itemPrices["OakWood"] = "10 0 0 0 2 0 0";
$itemImage["OakWood"] = nametoid("OakWoodItem");
$itemPrices["MapleWood"] = "50 0 0 0 0 5 0";
$itemImage["MapleWood"] = nametoid("MapleWoodItem");
$itemPrices["sword"] = "100 0 10 0 0 0 0";
$itemImage["sword"] = nametoid("swordItem");
$itemPrices["bow"] = "50 0 0 0 0 5 0";
$itemImage["bow"] = nametoid("bowItem");
$itemPrices["WarAxe"] = "75 5 5 0 0 0 0";
$itemImage["WarAxe"] = nametoid("WarAxeItem");
$itemPrices["ShortSword"] = "45 5 2 0 0 0 0";
$itemImage["ShortSword"] = nametoid("ShortSwordItem");
$itemPrices["Spear"] = "50 0 0 0 5 0 0";
$itemImage["Spear"] = nametoid("SpearItem");
$itemPrices["PioneerHG"] = "90 5 5 0 3 0 0";
$itemImage["PioneerHG"] = nametoid("PioneerHGItem");
$itemPrices["Longsword"] = "105 5 8 0 0 0 0";
$itemImage["Longsword"] = nametoid("LongswordItem");
$itemPrices["MCrossBow"] = "150 5 5 1 5 0 0";
$itemImage["MCrossBow"] = nametoid("MCrossBowItem");
function serverCmdForge(%client, %item, %amount)
{
if( %amount < 1 ) // They have to Forge at least 1
return;
if( $itemPrices[%item] $= "" )
{
messageClient(%client, '', 'You cannot forge that item (%1).', %item);
return;
}
%client.quantity["gold"] = %client.gold;
%items[0] = "gold";
%items[1] = "CopperOre";
%items[2] = "SilverOre";
%items[3] = "GoldOre";
%items[4] = "PineWood";
%items[5] = "OakWood";
%items[6] = "MapleWood";
for(%i = 0; %i < 7; %i++)
{
%price[%i] = getWord($itemPrices[%item], %i);
if( %client.quantity[%items[%i]] < (%amount * %price[%i]) )
{
messageClient(%client, '', 'You do not have enough %1!', %items[%i]);
return;
}
}
%msg = "Forging costed you: ";
for(%i = 0; %i < 7; %i++)
{
%amnt = (%amount * %price[%i]);
if( %amnt != 0 )
%msg = %msg @ %amnt SPC %items[%i] @ ", ";
%client.quantity[%items[%i]] -= %amnt;
}
%client.quantity[%item] += %amount;
%image = $itemImage[%item];
%i = 4;
while( %i >= -1 )
{
if( !%client.player.tool[%i] || (%client.player.tool[%i].getId() == %image.getId()) )
{
break;
}
%i--;
}
if( %i == -1 )
{
messageClient(%client, '', 'Not enough inventory space!');
return;
}
%client.player.tool[%i] = %image;
messageClient(%client, 'MsgItemPickup', '', %i, %image);
%client.gold = %client.quantity["gold"];
messageClient(%client, '', %msg);
}