Author Topic: Let your users earn from there online time  (Read 4279 times)

Offline yahgiggle

Let your users earn from there online time
« on: February 01, 2012, 09:55:50 am »
i coded this item as i wanted my members to earn points from there online time   its simple to use all wen you add that to the shop you can put what points they will get for how meany pounts will be taken  ive set it for 500 point for every 24 hours 

paste and name file as Timebonus.php    then move to your shop items folder 


<?php
/**********************************************************************************
* SMFShop item                                                                    *
***********************************************************************************
Coded By Deon Hamilton www.webs-co.com                                                 
**********************************************************************************/

if (!defined('SMF'))
   die('Hacking attempt...');

class item_Timebonus extends itemTemplate
{
   function getItemDetails()
   {
      $this->authorName = 'Deon Hamilton';
      $this->authorWeb = 'http://www.webs-co.com';
      $this->authorEmail = 'webs-co@webs-co.com';

      $this->name = 'Time bonus';
      $this->desc = 'use your Timebonus';
      $this->price = 50;
      
      $this->require_input = true;
      $this->can_use_item = true;
   }


    // See 'AddToPostCount.php' for info on how this works
    function getAddInput() {
        return "Money to give user: <input type='text' name='info1' value='500' />Bonus time to take off The user 86400 = 24h: <input type='text' name='info2' value='86400' />";
         
    }
   
    function getUseInput() {
        return "<br/>

    function onUse() {
        global $db_prefix, $ID_MEMBER, $item_info ;


                $sql =  db_query ("SELECT totalTimeLoggedIn, memberName ,money
                            FROM {$db_prefix}members 
                            WHERE ID_MEMBER = '{$ID_MEMBER}'
                            LIMIT 1",__FILE__, __LINE__);

           $rows = mysql_fetch_assoc($sql);   
             
         $totalTimeLoggedIn = 'totalTimeLoggedIn';
         $memberName = 'memberName';
         $money = 'money';

         if  ( $rows[$totalTimeLoggedIn] <  "{$item_info[2]}"  )  return "<b>Sorry  $rows[$memberName] You Only Have  $rows[$totalTimeLoggedIn] Points! You need  {$item_info[2]}    Or More To Use The Time Bonus</b><br/>

<br/>Tip: Download Opera From Here <b><a href = http://www.opera.com>Click Here </a></b> install and open webs-co Then right click and use the Reload Every 30min That keep's your time Bonus Building when your away from your computer <br/>
   
         db_query("UPDATE {$db_prefix}members
                            SET totalTimeLoggedIn = totalTimeLoggedIn - {$item_info[2]}
                            WHERE ID_MEMBER = {$ID_MEMBER}",
                            __FILE__, __LINE__);

         db_query("UPDATE {$db_prefix}members
                            SET money = money + {$item_info[1]}
                            WHERE ID_MEMBER = {$ID_MEMBER}",
                            __FILE__, __LINE__);

        return "<b>You Have Successfully Used Your Time Bonus! You Now Have {$item_info[1]} More Webs-co In Your Pocket And $rows[$totalTimeLoggedIn] Time Bonus Points Left<b><br/>

";
}

}
   
?>
« Last Edit: February 11, 2012, 04:44:30 pm by bigjoe11a »

Offline bigjoe11a

Re: Let your users earn from there online time
« Reply #1 on: February 11, 2012, 04:39:24 pm »
It's up to you users if you wanted to use this new item. This item does have an option that adds a ad for google. If you don't want the google ad in this new item. Just remove the google parts.

Just remove the code below from the item before you use this code.
Code: [Select]
The javascript code has been removed.
« Last Edit: February 11, 2012, 04:45:08 pm by bigjoe11a »
Serving Gamers from around the world
http://www.df-barracks.com/


Offline yahgiggle

Re: Let your users earn from there online time
« Reply #2 on: February 11, 2012, 05:24:13 pm »
Thankyou for removing my ad code i forgot lol and yes all the items ive coded let you place  google ads in them ive also made my own guns like the robbing but with sound fx  and a fire botton, also when you make a hit you earn 1 point that then adds to your over all rank  + i have made solders and force fields that help you fight back  i would post my other items but you need to edit mysql and i think there be a lot of hassle with people not knowing how to do this.