View Full Version : PHP Help
Zombie
November 26th, 2007, 03:14
Alright this is from my game i am having a major problem with it
AP Box
Rules:
No more than u have
No neg numbers
if ($amount >= $stat[ap])
print "You cannot use more than you have";
exit;
It will use all the AP but u cant use all u always have to have 1 remaining the script wont allow u to use it all?
Any ideas
stuffradio
November 26th, 2007, 03:29
if (is_numeric($amount) > $stat[ap]) {
echo "You can't use more than you have";
exit;
} elseif (is_numeric($amount) && $amount > 0) {
// code here
}
krakjoe
November 26th, 2007, 03:55
is_numeric returns a boolean value, so not quite ...
<?php
if( $amount >= $stat['ap'] )
{
print( "You cannot use more than you have" );
exit;
}
elseif( $amount < 0 )
{
print( "You cannot use negative numbers" );
exit;
}
elseif( ( $stat['ap'] - $amount ) < 1 )
{
print( "You must leave at least 1" );
exit;
}
else
{
// Code here ...
}
?>
Zombie
November 26th, 2007, 16:34
ty krakjoe but you might have mis understood due to my lack of elaberation and proper explanation
the problem is
AP: 3 [USE]
when they type in 3 to use it in the ap box it wont allow it it only allows the most to be all but 1 it wont allow all to be used that is my problem
krakjoe
November 26th, 2007, 16:52
I still don't get it, I was just guessing and fixing what stuff posted ...
TheXianProject
November 26th, 2007, 17:04
I still don't get it
I second that, I don't understand what you are asking for either Rsmiley. :S
Zombie
November 26th, 2007, 17:24
Once my server goes back online i will allow u to see the error
Zombie
November 26th, 2007, 23:59
shadowofdemise.uni.cc
Join and goto Overview -> AP and try to use all 3 points u have and then try 2
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.