Closed Thread
Results 1 to 8 of 8

Thread: PHP Help

  1. #1
    b& Zombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond repute
    Join Date
    Mar 2007
    Location
    Florida
    Posts
    1,985

    PHP Help

    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
    PHP Code:
     
    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

  2. #2
    Super Moderator#1 stuffradio has a reputation beyond reputestuffradio has a reputation beyond reputestuffradio has a reputation beyond reputestuffradio has a reputation beyond reputestuffradio has a reputation beyond reputestuffradio has a reputation beyond reputestuffradio has a reputation beyond reputestuffradio has a reputation beyond reputestuffradio has a reputation beyond reputestuffradio has a reputation beyond reputestuffradio has a reputation beyond repute stuffradio's Avatar
    Join Date
    Oct 2005
    Location
    BC, Canada
    Posts
    7,300
    PHP Code:
    if (is_numeric($amount) > $stat[ap]) {
    echo 
    "You can't use more than you have";
    exit;
    } elseif (
    is_numeric($amount) && $amount 0) {
    // code here


  3. #3
    stop staring krakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to behold krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,616
    is_numeric returns a boolean value, so not quite ...

    PHP Code:
    <?php
    if( $amount >= $stat['ap'] )
    {
        print( 
    "You cannot use more than you have" );
        exit;
    }
    elseif( 
    $amount )
    {
        print( 
    "You cannot use negative numbers" );
        exit;
    }
    elseif( ( 
    $stat['ap'] - $amount ) < )
    {
        print( 
    "You must leave at least 1" );
        exit;
    }
    else
    {
        
    // Code here ...
    }
    ?>
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  4. #4
    b& Zombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond repute
    Join Date
    Mar 2007
    Location
    Florida
    Posts
    1,985
    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

  5. #5
    stop staring krakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to behold krakjoe's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    3,616
    I still don't get it, I was just guessing and fixing what stuff posted ...
    (\__/) Joe Watkins
    (='.'=) Software Architect
    (")_(") http://pthreads.org
    Copy and paste bunny into your sig, help him gain world domination.

  6. #6
    Junior Member TheXianProject is an unknown quantity at this point
    Join Date
    Feb 2006
    Location
    Hawaii
    Posts
    6
    Quote Originally Posted by krakjoe View Post
    I still don't get it
    I second that, I don't understand what you are asking for either Rsmiley.

  7. #7
    b& Zombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond repute
    Join Date
    Mar 2007
    Location
    Florida
    Posts
    1,985
    Once my server goes back online i will allow u to see the error

  8. #8
    b& Zombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond reputeZombie has a reputation beyond repute
    Join Date
    Mar 2007
    Location
    Florida
    Posts
    1,985
    shadowofdemise.uni.cc

    Join and goto Overview -> AP and try to use all 3 points u have and then try 2

Closed Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts