[DONE] Magic Llama mod

Started by Aquilo, April 04, 2004, 08:03:55 AM

Previous topic - Next topic

PioneeR

Anyone get this working for 1.0.3?

Quote from: Webby on January 07, 2005, 02:47:20 AM
used the code give here :

http://www.simplemachines.org/community/index.php?topic=18720.msg152843

and adjusted it a bit to get a table of llama's :

in Stats.php find :


// Activity by month.


and add before :


// Top 5 llama Rating
$llama_results = db_query("
SELECT realName, goodllamas, ID_MEMBER FROM {$db_prefix}members ORDER BY goodllamas DESC LIMIT 10", __FILE__, __LINE__);

$context['llama'] = array();

while( $row_llama = mysql_fetch_assoc($llama_results) )
{
$context['gllama'][] = array(
'llama' => $row_llama['goodllamas'],
'Link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_llama['ID_MEMBER'] . '">' . $row_llama['realName'] . '</a>'
);
}

// Bottom 5 llama Rating
$llama_results = db_query("
SELECT realName, badllamas, ID_MEMBER FROM {$db_prefix}members ORDER BY badllamas DESC LIMIT 10", __FILE__, __LINE__);

$context['bllama'] = array();

while( $row_llama = mysql_fetch_assoc($llama_results) )
{
$context['bllama'][] = array(
'Link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_llama['ID_MEMBER'] . '">' . $row_llama['realName'] . '</a>',
'llama' => $row_llama['badllamas']
);
}

// Highest Total llama
$llama_results = db_query("
SELECT goodllamas, badllamas, realName, ID_MEMBER FROM {$db_prefix}members ORDER BY (goodllamas-badllamas) DESC LIMIT 10", __FILE__, __LINE__);

$context['htllama'] = array();

while( $row_llama = mysql_fetch_assoc($llama_results) )
{
$context['htllama'][] = array(
'Link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_llama['ID_MEMBER'] . '">' . $row_llama['realName'] . '</a>',
'Good' => $row_llama['goodllamas'],
'Bad' => $row_llama['badllamas']
);
}

// Lowest llama total
$llama_results = db_query("
SELECT goodllamas, badllamas, realName, ID_MEMBER FROM {$db_prefix}members ORDER BY (goodllamas-badllamas) ASC LIMIT 10", __FILE__, __LINE__);

$context['ltllama'] = array();

while( $row_llama = mysql_fetch_assoc($llama_results) )
{
$context['ltllama'][] = array(
'Link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_llama['ID_MEMBER'] . '">' . $row_llama['realName'] . '</a>',
'Good' => $row_llama['goodllamas'],
'Bad' => $row_llama['badllamas']
);
}


in Stats.template.php find :


foreach ($context['top_time_online'] as $poster)
            echo '
                                                <tr>
                                                        <td width="60%" valign="top">', $poster['link'], '</td>
                                                        <td width="20%" align="left" valign="top">', $poster['time_online'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $poster['time_percent'] . '" height="15" alt="" border="0" />' : '&nbsp;', '</td>
                                                        <td width="20%" align="right" valign="top" nowrap="nowrap">', $poster['time_online'], '</td>
                                                </tr>';
        echo ' </table></td></tr>';


and replace with :


foreach ($context['top_time_online'] as $poster)
            echo '
                                                <tr>
                                                        <td width="60%" valign="top">', $poster['link'], '</td>
                                                        <td width="20%" align="left" valign="top">', $poster['time_online'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $poster['time_percent'] . '" height="15" alt="" border="0" />' : '&nbsp;', '</td>
                                                        <td width="20%" align="right" valign="top" nowrap="nowrap">', $poster['time_online'], '</td>
                                                </tr>';
        echo ' </table></td></tr>';

if( $modSettings['llamaMode'] == 0 )
{
echo '<tr>
<td class="catbg" colspan="2">Highest Llama rating (good - bad)</td>
<td class="catbg" colspan="2">Lowest Llama rating (good - bad)</td>
</tr>
<tr>
<td class="windowbg" colspan="1">
<img src="'. $settings['images_url']. '/stats_posters.gif" width="20" height="20" />
</td>
<td class="windowbg2">';

foreach($context['htllama'] as $htllama)
{
$total = $htllama['Good'] - $htllama['Bad'];
echo '<table border="0" cellpadding="1" cellspacing="0" width="100%"><tr>
<td class="windowbg2" width="80%" align="left">'.
$htllama['Link']
.'</td>
<td class="windowbg2" width="20%" align="right">'.$total.'</td>
</tr></table>';
}





echo'</td><td class="windowbg" colspan="1">
<img src="'. $settings['images_url']. '/stats_posters.gif" width="20" height="20" />
</td>
<td class="windowbg2">';


foreach($context['ltllama'] as $ltllama)
{
$total = $ltllama['Good'] - $ltllama['Bad'];
echo '<table border="0" cellpadding="1" cellspacing="0" width="100%"><tr>
<td class="windowbg2" width="80%" align="left">'.
$ltllama['Link']
.'</td>
<td class="windowbg2" width="20%" align="right">'.$total.'</td>
</tr></table>';
}
}


It might not be the nicest way to do it, but it works for me :)

mrselnombre

I would pay to have this mod up and working... I've tried coding in what is listed here, but it just aint working...
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.

dtm.exe

This, by far, has got to be the most...unique mod I've ever seen on SMF :P.

-Dan The Man

xenovanis

I've read this thread about four times back and forwards and I still can't find the beginning nor the end of what to modify. Maybe someone should write a tutorial in stead of a mod.  :P
"Insanity: doing the same thing over and over again and expecting different results."

mrselnombre

true that would be a great help ;)
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.

PioneeR

Was working fine.. until i put the Karma Description mod on...

Now when someone catches the llama they get this error..

call_user_func(magicLlama): First argument is expected to be a valid callback

Any ideas?

babylonking

Quote from: PioneeR on October 23, 2005, 11:34:20 AM
Was working fine.. until i put the Karma Description mod on...

Now when someone catches the llama they get this error..

call_user_func(magicLlama): First argument is expected to be a valid callback

Any ideas?

You forgot to upload the magicLlama template.

PioneeR

Just checked.. and the template is there.

If I remove the karma description mod. the magic llama one works. Cant have both it seems. DOH!

Saku

Tried to install with SMF 1.1RC :(
Fatal error: Call to undefined function: md5_hmac() in /home/domains/public_html/smf/Sources/Load.php on line 2098

Saku

Please :( I really need this mod

babylonking

Quote from: Sakuragi on October 27, 2005, 08:42:06 PM
Tried to install with SMF 1.1RC :(
Fatal error: Call to undefined function: md5_hmac() in /home/domains/public_html/smf/Sources/Load.php on line 2098

In load.php search for:

// Create a new Llama!
$Llamaid = substr(md5_hmac(time(), 'Llys'), 0, 15);



Changed to:

// Create a new Llama!
$Llamaid = rand(0, 15);

Saku

thanks but not working!
Champ 'md5' inconnu dans field list
File: c:\weblocal\sites\site1\smf\Sources\Load.php
Line: 2180

Maybe if you have time you can make a tutorial for this mod?
Im sure there will be quite a few people looking for something like this!!

babylonking

Quote from: Sakuragi on October 29, 2005, 04:12:26 PM
thanks but not working!
Champ 'md5' inconnu dans field list
File: c:\weblocal\sites\site1\smf\Sources\Load.php
Line: 2180

Maybe if you have time you can make a tutorial for this mod?
Im sure there will be quite a few people looking for something like this!!

I am using SMF 1.1 Beta 4 and it's works for me, Try to PM Aquilo and ask him to update his mod  8)

AzaToth


Saku

#254
Why in my board all the members catch only late Llama, every time they get Sorry too late!
no Evil or Good Llama


When I open a topic, the image does not float and Firefox show this error :
Error javascript : chip is not defined

what it does mean?

here is the start Llama function:
function StartLlama()
      {
         Llama1 = new Chip("Llama1",', $width, ',', $height, ');
         Llama1.move();
      }

Senkusha

#255
Is anybody feelin' frisky?

I made a Package for this mod, and (from what I was able to test) it works.  I wasn't able to test the file upload, since I've already got all the files there, nor could I test the database changes, but, based on other Packages that I've seen, this one should work for you.

I've made the necessary changes to make it compatable with SMF 1.1 RC1

EDIT:  I've also fixed the code that produces the errors from guests.
EDIT:  I've fixed code that was mistakenly seeing Llamas as 'already grabbed'.
EDIT:  I've added the database modification code to the package...oops!
EDIT:  I've fixed a serious *refresh* bug.  What would happen is after you've won, if you press refresh, you win again.  This has been fixed.[/i
EDIT:  I've also fixed another bug.  When you click on a llama you get "sorry another member...", this has been fixed.
EDIT:  I've updated the package file to include the latest bug fixes, as well as all the files.  They should now upload to your server. (Untested)

I hope this helps!

(Since I can't attach files here, try a direct link:  Magic Llama Mod)
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

Gobo

#256
the mod uploads and installs A-Ok
but then it dosent run
I get this error:

Unknown column 'mem.badllamas' in 'field list'
File: /home/.cash/akulion/path-to-peace.net/forum/Sources/Load.php
Line: 782

how can I fix it please?

By the way great awesome mod!!

ok another error I get when I turn karma description mod off is:

Table 'p2p_forum.smf_llama_info' doesn't exist
File: /home/.cash/akulion/path-to-peace.net/forum/Sources/Load.php
Line: 2167

Senkusha

Looking at the package-info.xml, looks like I forgot to add the code peice!  I'll fix that, but to fix your problem just run the create_llama_db.php.
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

Gobo

#258
Thanks

ok ill try that and let u know if it works
and could u please lemme know when the updates are completed ? thanks

oh ok i looked but i cant find the create_llama_db.php anywhere in my directories

Do I have to upload this file seperately? If yes then where should I upload it to?

Thanks

ArkServer

#259
I get blank screen when i want to view in admin page

and how d i enable this?

Advertisement: