How to write it?

I think I know how to make a stack limiting system but I have no idea how to write it. Can someone help me?
Continue to help post