Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: small help

  1. #1
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default small help

    Yeh how can i get my points to display as levels

    So if i want from 0 to 100 to be level 1

    then from 100 to 200 to be level 2 etc

    say all the way upto 900 to 1000 level 10

    i have tried

    PHP Code:
    if ($op[points] <&& $op[points] >100) {
    echo 
    "Level 1";
    } else {
    if (
    $op[points] <100 && $op[points] >200) {
    echo 
    "Level 2";
    }
     
    etc.. 
    But it only displays the levels when the points are either the first number or the last number

    any help?

    Moved by Agesilaus (Forum Moderator) from Designing and Development: Please post in the correct forum next time.
    Last edited by Agesilaus; 04-01-2008 at 11:38 PM.
    Looking for a good desiner to design a social networking template.

    PM me.

  2. #2
    Join Date
    Aug 2005
    Location
    Newcastle
    Posts
    1,417
    Tokens
    0

    Latest Awards:

    Default

    add an equals sign. So it is equal to or greater/less than. Eg >=
    Last edited by craigg.; 03-01-2008 at 05:14 PM.



  3. #3
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    Didnt work, now doesnt display anything..
    Looking for a good desiner to design a social networking template.

    PM me.

  4. #4
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    PHP Code:
    <?php
    function sort_level$start$finish )
    {
        if( 
    $op["points"] >= $start && $op["points"] <= $finish )
        {
            return 
    true;
        } else
        {
            return 
    false;
        }
    }
    $points['level']['1'] = sort_level(1100);
    $points['level']['2'] = sort_level(101200);
    $points['level']['3'] = sort_level(201300);
    $points['level']['4'] = sort_level(301400);
    for( 
    $i 0$i count($points['level']); $i++ )
    {
        if( 
    $points['level'][$i] == true )
        {
            echo 
    "Level " $i;
        }
    }
    ?>
    Should work.

    I like to code over the top =D
    Last edited by Blob; 03-01-2008 at 06:14 PM.

  5. #5
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    Hmm..

    Doesnt work..

    Maybe if i can update the $op[level] by adding to it

    So how could i do it so

    A user clicks 'add points'

    then it updates the points in the db then changes the level

    if it is over the max points for level 1 say

    then it changes the level to 2?

    Then i could just display the level

    by using $op[level]

    ?
    Looking for a good desiner to design a social networking template.

    PM me.

  6. #6
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    Quote Originally Posted by Ini View Post
    Hmm..

    Doesnt work..

    Maybe if i can update the $op[level] by adding to it

    So how could i do it so

    A user clicks 'add points'

    then it updates the points in the db then changes the level

    if it is over the max points for level 1 say

    then it changes the level to 2?

    Then i could just display the level

    by using $op[level]

    ?
    PHP Code:
    <?php
    function sort_level$start$finish )
    {
        global 
    $op;
        if( 
    $op["points"] >= $start && $op["points"] <= $finish )
        {
            return 
    "true";
        } else
        {
            return 
    "false";
        }
    }
    $points['level']['1'] = sort_level(1100);
    $points['level']['2'] = sort_level(101200);
    $points['level']['3'] = sort_level(201300);
    $points['level']['4'] = sort_level(301400);
    for( 
    $i 0$i count($points['level']); $i++ )
    {
        if( 
    $points['level'][$i] == "true" )
        {
            echo 
    "Level " $i;
        }
    }
    ?>
    That works, ive tested it.

  7. #7
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    if ($op[points] <&& $op[points] >100) {
    echo 
    "Level 1";
    } else {
    if (
    $op[points] <100 && $op[points] >200) {
    echo 
    "Level 2";

    How can your points be less than 0 and over 100 at the same time?

    try..

    PHP Code:
    if ($op[points] >&& $op[points] <100) {
    echo 
    "Level 1";

    elseif (
    $op[points] >100 && $op[points] <200)
    echo 
    "Level 2";
    else
    echo 
    "Level 3"
    Coming and going...
    Highers are getting the better of me

  8. #8
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Blob View Post
    PHP Code:
    <?php
    function sort_level$start$finish )
    {
        global 
    $op;
        if( 
    $op["points"] >= $start && $op["points"] <= $finish )
        {
            return 
    "true";
        } else
        {
            return 
    "false";
        }
    }
    $points['level']['1'] = sort_level(1100);
    $points['level']['2'] = sort_level(101200);
    $points['level']['3'] = sort_level(201300);
    $points['level']['4'] = sort_level(301400);
    for( 
    $i 0$i count($points['level']); $i++ )
    {
        if( 
    $points['level'][$i] == "true" )
        {
            echo 
    "Level " $i;
        }
    }
    ?>
    That works, ive tested it.
    Cant get it work won't display anything..
    Looking for a good desiner to design a social networking template.

    PM me.

  9. #9
    Join Date
    Dec 2007
    Posts
    2,807
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by MrCraig View Post
    PHP Code:
    if ($op[points] <&& $op[points] >100) {
    echo 
    "Level 1";
    } else {
    if (
    $op[points] <100 && $op[points] >200) {
    echo 
    "Level 2";

    How can your points be less than 0 and over 100 at the same time?

    try..

    PHP Code:
    if ($op[points] >&& $op[points] <100) {
    echo 
    "Level 1";

    elseif (
    $op[points] >100 && $op[points] <200)
    echo 
    "Level 2";
    else
    echo 
    "Level 3"
    Listen to this dude Ryan. Your signs are all wrong.

  10. #10
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    nope cant get it to work, ryan could you explain what values are which so i no what to edit..
    Looking for a good desiner to design a social networking template.

    PM me.

Page 1 of 2 12 LastLast

Posting Permissions

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