[Small plugin] Friends Online [addon]

Spartak

Member
Sep 24, 2011
225
33
Hello, here's my second or third release requested by james6213:

its a simple plugin that GET your friends online ingame

Code:
<?PHP
            $query = mysql_query("SELECT * FROM messenger_friendships WHERE user_one_id = '".$_SESSION['user']['id']."'");
            $i = 0;
            while($friends = mysql_fetch_array($query))
            {
                $getfriend = mysql_query("SELECT * FROM users WHERE id ='".$friends['user_two_id']."' AND online = '1' [SIZE=5][COLOR=#ff6600]LIMIT 25[/COLOR][/SIZE]");
                if(mysql_num_rows($getfriend) > 0)
                {
                    $i++;
                    if($i == 1)
                    {
                   
                        echo '<li id="feed-friends">Your friend(s) online are:<b><span> ';
                    }
                    $friend = mysql_fetch_array($getfriend);
                    echo htmlspecialchars($friend['username']).', ';
                }
            }
            if($i > 0)
            echo

sorry for my languge ==> French (i know some people like Canadian will comment about it...just stfu)


SCREENSHOT :

5ugND.png

LIKE IT? just press like

Hate? GTFO



Edit : Fixed the limit its show ur 25 Friends online.

If you want to edit it just look at THE ORANGE BIG SIZE and edit the 25 by another number for ex : if u want to show only 5 friend's on then replace 25 by 5.

hope its helped

Credits : Extreme
 

Spartak

Member
Sep 24, 2011
225
33
lol maybe is not i don't know wich theme u use, so just tell me wich theme you use and i will implant it.
 

Deion

Posting Freak
Jul 3, 2010
1,273
300
lol maybe is not i don't know wich theme u use, so just tell me wich theme you use and i will implant it.
Habbo theme... That's not the full code.. There's nothing to close the code ndd it eds with echo..
 

Spartak

Member
Sep 24, 2011
225
33
it's the full Code, what i have its the CSS part (the design)

so with what i released it's only echo your friends online ingame.
 

presto5

Member
Jul 26, 2011
66
1
I looked at the code and realized whats missing. Here is the fixed code but I don't know how to add the dotted line separator.


Find this
PHP:
<li class="small" id="feed-lastlogin">Last signed in: {lastSignedIn}</li>


Add this below it.
PHP:
<?PHP
            $query = mysql_query("SELECT * FROM messenger_friendships WHERE user_one_id = '".$_SESSION['user']['id']."'");
            $i = 0;
            while($friends = mysql_fetch_array($query))
            {
                $getfriend = mysql_query("SELECT * FROM users WHERE id ='".$friends['user_two_id']."' AND online = '1' LIMIT 1");
                if(mysql_num_rows($getfriend) > 0)
                {
                    $i++;
                    if($i == 1)
                    {
                     
                        echo '<li id="feed-friends">Your friend(s) online are:<b><span> ';
                    }
                    $friend = mysql_fetch_array($getfriend);
echo htmlspecialchars($friend['username']).', ';
                }
            }
            if($i > 0)
echo '</b>'?>



Hope this helps.
 

presto5

Member
Jul 26, 2011
66
1
For it to work you needed these two lines.

PHP:
echo htmlspecialchars($friend['username']).', ';
echo '</b>'?>

One was is the wrong place the other I added.
 

Fadehotel

Member
Aug 31, 2011
48
2
This only displays 1 user.. when you have about 20+ mates online, this shows 1 user..

please fix this, i tryed, i failed. :/
 

Spartak

Member
Sep 24, 2011
225
33
guys can u make a screenshot of ur probleme?
@ Fade: as you can see theres not LIMIT 1

so its ur CSS PART that maybe don't show all users.

im going to test it.
 

presto5

Member
Jul 26, 2011
66
1
This only displays 1 user.. when you have about 20+ mates online, this shows 1 user..

please fix this, i tryed, i failed. :/
Sorry my code was wrong. I moved it back to how it was and fixed it. So all the original code was really missing was the </b> and the ?>. Anyway copy the code I posted and it should work!
 

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
I like it but I don't see why you are using LIMIT 1 in your query. I say you should make it LIMIT 10 so it shows 10 friends instead of 1.

PS: Sorry for grammar, tired.
 

Spartak

Member
Sep 24, 2011
225
33
I like it but I don't see why you are using LIMIT 1 in your query. I say you should make it LIMIT 10 so it shows 10 friends instead of 1.

PS: Sorry for grammar, tired.
sorry i forget to explain it

its was a exemple to show them how to edit the number of limit. i will edit my post


Edited.
 

FarLock

ThisHabbo Media Journalist
Apr 21, 2012
224
52
I looked at the code and realized whats missing. Here is the fixed code but I don't know how to add the dotted line separator.


Find this
PHP:
<li class="small" id="feed-lastlogin">Last signed in: {lastSignedIn}</li>


Add this below it.
PHP:
<?PHP
            $query = mysql_query("SELECT * FROM messenger_friendships WHERE user_one_id = '".$_SESSION['user']['id']."'");
            $i = 0;
            while($friends = mysql_fetch_array($query))
            {
                $getfriend = mysql_query("SELECT * FROM users WHERE id ='".$friends['user_two_id']."' AND online = '1' LIMIT 1");
                if(mysql_num_rows($getfriend) > 0)
                {
                    $i++;
                    if($i == 1)
                    {
                   
                        echo '<li id="feed-friends">Your friend(s) online are:<b><span> ';
                    }
                    $friend = mysql_fetch_array($getfriend);
echo htmlspecialchars($friend['username']).', ';
                }
            }
            if($i > 0)
echo '</b>'?>



Hope this helps.
This works. Thank you very much! :)
 

Users who are viewing this thread

Top