Limit The Value Of A Variable

Limiting a variable can be very useful. Maybe you don't want someone to hack and get 9999999 money. You could want to limit how many bullets are on the screen.

//**\
//* What to replace
//* 
//* Replace 'mycash' with the variable you want to limit.
//* Replace '>' with the operator you would like to use
//* NOTE: This must be a comparison operator, or else it
//* will not work properly!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//* Replace 300 with the limit you would like.
//* 
//**/
 
// This may not work for all types of variables. Be sure to
// look up your variable's proper assignment technique!
 
int mycash;
if (mycash > 300) //If you have more than 300 cash
{
    mycash = 300;
}

Backlinks

page_revision: 1, last_edited: 1265768929|%e %b %Y, %H:%M %Z (%O ago)