Code: Select all
game.onevent(defines.events.onplayercrafteditem, function(event)
if event.itemstack.name=="stone-gear-wheel" or event.itemstack.name=="iron-gear-wheel" or event.itemstack.name=="steel-gear-wheel" then
if gears_counter == nil then gears_counter=1
else gears_counter = gears_counter + event.itemstack.count end
end
if event.itemstack.name=="wooden-axe" or event.itemstack.name=="iron-axe" or event.itemstack.name=="steel-axe" or event.itemstack.name=="steel-axe2" or event.itemstack.name=="steel-axe3" then
if mining_counter == nil then mining_counter=1
else mining_counter = mining_counter + event.itemstack.count end
end
if event.itemstack.name=="sandwall" then
if sand_counter == nil then sand_counter=1
else sand_counter = sand_counter + math.random(500) end
end
if event.itemstack.name=="basic-mining-drill-sand" then
if sand_counter == nil then sand_counter=1
else sand_counter = sand_counter + math.random(500) end
if gears_counter == nil then gears_counter=25
else gears_counter = gears_counter + 25 end
if mining_counter == nil then mining_counter=2
else mining_counter = mining_counter + 2 end
end
if event.itemstack.name=="basic-mining-drill" then
if gears_counter == nil then gears_counter=5
else gears_counter = gears_counter + 5 end
if mining_counter == nil then mining_counter=5
else mining_counter = mining_counter + 5 end
end
end)
game.onevent(defines.events.onplayermineditem, function(event)
if event.itemstack.name=="sand" then
if sand_counter == nil then sand_counter=1
else sand_counter = sand_counter + event.itemstack.count
end
end
end)
but the problem is, (i tried with sand, didnt test others yet) that sand keeps its counter at nil, even when mining it xD
what to do?
btw, i also have this above it:
Code: Select all
gears_counter=0
sand_counter=0
mining_counter=0