Click X adoptables to receive a special adoptable

Forum
Last Post
Threads / Messages

PokePets

Premium Member
Premium Member
Joined
Jun 29, 2010
Messages
227
Points
0
Mysidian Dollar
13,596
// I know, I have terrible loooong coding, but it works anyway ;D

Demo:
http://pokepets.comlu.com/index.php (levelup).

1) We gone edit the database, go to adopts_settings, insert 3 new rows:
Code:
Name: clickevent 
Value: Yes
Name: eventneeded 
Value: What you want, example: 100
Name: eventprize
Value: The type of adoptable users get when they clicked X adopables, example: Pikachu
Now change also your _users table!
Add a new field;
Code:
eventclicks (varchar 5) default: 0
2) Now we gone edit our levelup.php
Search for this:

PHP:
// Show a thank you message along with the adoptable's information to the user...
    $image = getcurrentimage($id); // Get the current image of the adoptable...

    $article_title = $lang_gave."{$owned_adoptable['name']} one ".$lang_unit;
    $article_content = "<img src='{$image}'><br>{$lang_gave}{$owned_adoptable['name']}    one {$lang_unit}.<br>".$lang_levelup_encourage;
    

    } // Adoptable is not frozen, end isfrozen else check
And add this under;

PHP:
$query = "SELECT * FROM ".$prefix."settings WHERE name='clickevent'";
         $result = mysql_query($query);
         $num = mysql_numrows($result); 
       

    $clickevent=@mysql_result($result,$i,"value");
    
             $query2 = "SELECT * FROM ".$prefix."users WHERE username='{$loggedinname}'";
             $result2 = mysql_query($query2);
             $num2 = mysql_numrows($result2); 
             
               $eventclicks=@mysql_result($result2,$i,"eventclicks");
               
             $query3 = "SELECT * FROM ".$prefix."settings WHERE name='eventneeded'";
             $result3 = mysql_query($query3);
             $num3 = mysql_numrows($result3); 
             
               $eventneeded=@mysql_result($result3,$i,"value");
               
             $query4 = "SELECT * FROM ".$prefix."settings WHERE name='eventprize'";
             $result4 = mysql_query($query4);
             $num4 = mysql_numrows($result4); 
             
               $eventprize=@mysql_result($result4,$i,"value");
               $newevent = $eventclicks + 1;
               $eventstillneeded = $eventneeded - $newevent;
      
    if($clickevent == "yes" and $newevent < $eventneeded){ 
   
    runquery("UPDATE {$GLOBALS['prefix']}users SET `eventclicks` = '{$newevent}' WHERE `username` = '{$loggedinname}'");
    $event = "There is a click event! You have clicked {$newevent} adoptables, you need to click {$eventstillneeded} adoptables more to 
              receive a {$eventprize}.";
    }

     elseif($newevent == $eventneeded){ 
     runquery("UPDATE {$GLOBALS['prefix']}users SET `eventclicks` = '{$newevent}' WHERE `username` = '{$loggedinname}'");
     runquery("INSERT INTO {$prefix}owned_adoptables VALUES ('', '{$eventprize}', 'Congratz','$loggedinname','0','0', '$code', '','$alts','fortrade','no', 'None','0')");
     $event = "There is a click event! You have clicked {$newevent} adoptables, that's enaugh to receive a {$eventprize}. It's automatic
              added to your account.'";
    
    }
    
elseif($newevent > $eventneeded){ 
   runquery("UPDATE {$GLOBALS['prefix']}users SET `eventclicks` = '{$newevent}' WHERE `username` = '{$loggedinname}'");
    $event = "You already received a click promo, you can't get another one.";
    
    }
    else{
     
    $event = "";
    }
3) Now change your levelup content, find
PHP:
$article_content = $article_content . "<div align='center'><br /><br><br>You have earned {$reward} ".grabanysetting('cost')." for leveling up this adoptable. <br />You now have {$newamount} ".grabanysetting('cost')."</div>";
And change it to;

PHP:
$article_content = $article_content . "<div align='center'><br />{$event}<br><br>You have earned {$reward} ".grabanysetting('cost')." for leveling up this adoptable. <br />You now have {$newamount} ".grabanysetting('cost')."</div>";
Now it should work :D



FIX THAT GUESTS CAN'T GET IT WILL COME ;)
 
Last edited by a moderator:
Well I am afraid it will not work unless you modify a line at register.php since the structure of table prefix_users has changed:

PHP:
Now change also your _users table!
Add a new field;

Unless this happened to be a typo...
 
Well I am afraid it will not work unless you modify a line at register.php since the structure of table prefix_users has changed:

PHP:
Now change also your _users table!
Add a new field;

Unless this happened to be a typo...
Indeed *changing* ;)
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,274
Messages
33,115
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top