ติดต่อลงโฆษณา [email protected]

แสดงกระทู้

ส่วนนี้จะช่วยให้คุณสามารถดูกระทู้ทั้งหมดสมาชิกนี้ โปรดทราบว่าคุณสามารถเห็นเฉพาะกระทู้ในพื้นที่ที่คุณเข้าถึงในขณะนี้


ข้อความ - 2t

หน้า: [1]
1
ผมใช้ ajax php chat ครับ
ดูตัวอย่างได้ที่
http://i2indy.myokhost.com/index.php

ชื่อ MOD
nneonneo's AJAX ShoutBox


ส่วน
flashchat
http://smf.na-man.com/index.php?action=downloads;sa=view;id=22

2
1. เปิดไฟล์ Sources/Load.php

2. หลังบรรทัดแรก ("<?php") ให้เพิ่มโค้ดนี้ลงไปครับ

///////////////
// พลังงานความร้อนแฝงกลางใจ SMF //
///////////////

$rpgSettings = array();
$rpgSettings['init'] = 5;
$rpgSettings['incre'] = 3;
function calRpg($p) {
   global $rpgSettings;
   $i = 0; $j = $rpgSettings['init']; $l = 0;
   while ($i < $p) {
      $l++;
      $i += $j;
      $j += $rpgSettings['incre'];
   }
   $fn = $i;
   $cbase = ($i - ($j - $rpgSettings['incre']));
   if ($l < 1) $l = 1;
   $pc = (($p - $cbase) / ($fn - $cbase)) * 100;
   return array(
      'level' => $l,
      'cbase' => $cbase,
      'nbase' => $fn,
      'perce' => $pc
   );
}

3. เปิดไฟล์ Themes/default/Display.template.php
และแก้ไข ไฟล์ ใน ธีมปัจจุบัน ด้วย

4. หาบรรทัดที่มีข้อความนี้ครับ

         // Show avatars, images, etc.?

5. เพิ่มโค้ดนี้ ก่อนหน้าบรรทัดที่ให้หาครับ

         $cp = $message['member']['posts'];
         $cr = calRpg($cp);
         echo 'Level ' . $cr['level'] . ' : Exp ' . round($cr['perce']) . '%<div style="width:92%;border: 1px solid #999; background: #fff" align="left">
                           <div style="width:', round($cr['perce']), '%;background:#ccc;height:8px;"></div></div>';

   $membID = $message['member']['id'];
   $lastMsg = mysql_fetch_array(mysql_query($sql = "SELECT max(posterTime) FROM {$db_prefix}messages WHERE ID_MEMBER = {$membID}"));
   $hp = round(100 / (1 + ((time() - $lastMsg[0]) / 100000)), 1);
   echo '
                        HP: ' . $hp . '%<div style="width:92%;border: 1px solid #999; background: #fff" align="left">
                           <div style="width:', round($hp), '%;background:#ccc;height:8px;"></div></div>';

         echo '
';


ในไฟล์ Display.template.php ตรง

function template_main()


ต่อจาก { ให้ใส่ว่า
global $db_prefix;ครับ

2. หลังบรรทัดแรก ("<?php") ให้เพิ่มโค้ดนี้ลงไปครับ

///////////////
// พลังงานความร้อนแฝงกลางใจ SMF //
///////////////

$rpgSettings = array();
$rpgSettings['init'] = 5;
$rpgSettings['incre'] = 3;
function calRpg($p) {
   global $rpgSettings;
   $i = 0; $j = $rpgSettings['init']; $l = 0;
   while ($i < $p) {
      $l++;
      $i += $j;
      $j += $rpgSettings['incre'];
   }
   $fn = $i;
   $cbase = ($i - ($j - $rpgSettings['incre']));
   if ($l < 1) $l = 1;
   $pc = (($p - $cbase) / ($fn - $cbase)) * 100;
   return array(
      'level' => $l,
      'cbase' => $cbase,
      'nbase' => $fn,
      'perce' => $pc
   );
}

ขออนุญาติเพิ่มเติมและขุดนะครับ
ให้ใส่บรรทัดนี้ลงไปหลังบรรทัดนี้ครับ

โค๊ด:
$pc = (($p - $cbase) / ($fn - $cbase)) * 100;

ใส่ว่า

โค๊ด:
if ($pc >= 100) { $pc=0; $l++; }

จะเปลี่ยนสีของ Level กับ Hp
ดูดีๆ นะ มีบอก
$cp = $message['member']['posts'];
         $cr = calRpg($cp);
         echo '
                        Level ' . $cr['level'] . ' : Exp ' . round($cr['perce']) . '%<div style="width:92%;border: 1px solid #999; padding: 1px; background: #fff" align="left">
                           <div style="width:', round($cr['perce']), '%;overflow: hidden; height: 12px; border: 1px solid #2a1; background: #0a0 url(http://รุปแถบพลังงาน) center right;"></div></div>';

   $membID = $message['member']['id'];
   $lastMsg = mysql_fetch_array(mysql_query($sql = "SELECT max(posterTime) FROM {$db_prefix}messages WHERE ID_MEMBER = {$membID}"));
   $hp = round(100 / (1 + ((time() - $lastMsg[0]) / 100000)), 1);
   echo '
                        HP: ' . $hp . '%<div style="width:92%;border: 1px solid #999; padding: 1px; background: #fff" align="left">
                           <div style="width:', round($hp), '%;overflow: hidden; height: 12px; border: 1px solid #912; background: #901 url(http://รุปแถบพลังงาน) center right;"></div></div>';

         echo '
';

วีธีทำก็เหมือนขั้นตอนทั้งหมดตั้งแต่ตอนแรกเลยครับ ดูที่ ข้อ 5 นะครับ แทนที่ข้อ 5 เลย



เครดิตในเว็บ zone-it นะครับ ตอนนี้ผมก็ใช้อยู่นะครับ โดยมีไฟล์สองตัวเป็นไฟล์ต้นฉบับ (ตัวเปล่าๆ ไม่มีโหมดไรเลย) อยากได้ เมล์มา [email protected]
หรือลองดูได้ในเว็บนี http://i2indy.myokhost.com 

3
ฝากเว็บแหล่งคนอินดี้ด้วยนะครับ ทำแบบอิสระเสรี สบายๆ ฟังเพลง พูดคุย ทำตัวอินดี้ ใครรู้ตัวว่าเป็นคน อินดี้ Indy ก็เข้ามากันได้เลยครับ


ไปเยี่ยมชม

หน้า: [1]