Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.2.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=38)
-   -   Click X adoptables to receive a special adoptable (http://www.mysidiaadoptables.com/forum/showthread.php?t=3407)

PokePets 12-23-2011 12:20 PM

Click X adoptables to receive a special adoptable
 
// 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 Code:

// 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 Code:

$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 Code:

$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 Code:

$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 ;)

Hall of Famer 12-24-2011 03:52 AM

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 Code:

Now change also your _users table!
Add a new field

Unless this happened to be a typo...

PokePets 12-24-2011 05:09 AM

Quote:

Originally Posted by Hall of Famer (Post 20829)
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 Code:

Now change also your _users table!
Add a new field

Unless this happened to be a typo...

Indeed *changing* ;)


All times are GMT -5. The time now is 09:06 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.