Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #41  
Old 03-24-2012, 04:36 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 81,199
SilverDragonTears is on a distinguished road
Default

It does it every time though...
__________________

Check out SilvaTales
Reply With Quote
  #42  
Old 03-24-2012, 06:51 PM
!Alive !Alive is offline
Member
 
Join Date: Feb 2012
Posts: 39
Gender: Male
Credits: 1,053
!Alive is on a distinguished road
Default

Try this:
PHP Code:
<?php 

include("functions/functions.php"); 
include(
"functions/functions_users.php"); 
include(
"functions/functions_adopts.php"); 
include(
"inc/lang.php"); 

//***************// 
//  START SCRIPT // 
//***************// 

$id $_GET["id"]; 
$promocode $_GET["promocode"]; 
$date date("M j, Y"); 
// $date = "Oct 23, 2001"; 
$_SESSION["allow"] = 1
// Here we check if we have an ID that has been submitted or no 

$clicked 0;

if(
$id == "") { 
    
// We did not enter in an id, or it is not a number 
    
$article_title $showingtitle

    
// If we are a guest, show a message that lets them know that they cannot adopt... 
    
if($isloggedin != "yes"$article_content $article_content.$showingguest


    
// Begin the output of all the adoptables to the user... 

$onlyone 0;
    
$uncommon rand(1,50);  
    
$rare rand(1,100);  
    
$ultrarare rand(1,200);  

    if (
$uncommon==&& $onlyone==0){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";
$onlyone 1;  
    }  
    else if (
$rare==&& $onlyone==0){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";
$onlyone 1;  
    }      
    else if (
$ultrarare==1  && $onlyone==0){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";
$onlyone 1;  
    }      
    else{  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";  
    }  
    
$stmt $adopts->query($query); 
     
    
$article_content .= 
    <table class='adopt'><tr>"


     
    while(
$row $stmt->fetch(PDO::FETCH_OBJ)) { 
        
$aid=$row->id//The adoptable's ID 
        
$type=$row->type
        
$description=$row->description
        
$eggimage=$row->eggimage

        
// Call a function to check if we have the proper privledge level to adopt this pet 
        
if($promocode == ""$promocode "none"
        
$canadopt canadopt($aid"showing"$promocode$row); // Feed an adoptable ID and showing, to show the adopt to guests... 

        
if($canadopt == "yes"){ 
            
//If we can adopt the adoptable, show the image and adoption link... 
            
$article_content .= 
            <td  VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id="
.$aid."' onclick='canclick()'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br> 
            
{$description}</td>"
        } 
    } 



    if (
$uncommon==&& $onlyone==0){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";
$onlyone 1;  
    }  
    else if (
$rare==&& $onlyone==0){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";
$onlyone 1;  
    }      
    else if (
$ultrarare==1  && $onlyone==0){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";
$onlyone 1;  
    }      
    else{  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";  
    }  
    
$stmt $adopts->query($query); 

     
    while(
$row $stmt->fetch(PDO::FETCH_OBJ)) { 
        
$aid=$row->id//The adoptable's ID 
        
$type=$row->type
        
$description=$row->description
        
$eggimage=$row->eggimage

        
// Call a function to check if we have the proper privledge level to adopt this pet 
        
if($promocode == ""$promocode "none"
        
$canadopt canadopt($aid"showing"$promocode$row); // Feed an adoptable ID and showing, to show the adopt to guests... 

        
if($canadopt == "yes"){ 
            
//If we can adopt the adoptable, show the image and adoption link... 
            
$article_content .= 
            <td  VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id="
.$aid."'onclick='canclick()'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br> 
            
{$description}</td>"
        } 
    } 



    if (
$uncommon==&& $onlyone==0){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1";
$onlyone 1;  
    }  
    else if (
$rare==&& $onlyone==0){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1";
$onlyone 1;  
    }      
    else if (
$ultrarare==1  && $onlyone==0){  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1";
$onlyone 1;  
    }      
    else{  
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";  
    }  
    
$stmt $adopts->query($query); 

     
    while(
$row $stmt->fetch(PDO::FETCH_OBJ)) { 
        
$aid=$row->id//The adoptable's ID 
        
$type=$row->type
        
$description=$row->description
        
$eggimage=$row->eggimage

        
// Call a function to check if we have the proper privledge level to adopt this pet 
        
if($promocode == ""$promocode "none"
        
$canadopt canadopt($aid"showing"$promocode$row); // Feed an adoptable ID and showing, to show the adopt to guests... 

        
if($canadopt == "yes"){ 
            
//If we can adopt the adoptable, show the image and adoption link... 
            
$article_content .= 
            <td  VALIGN='top'><br><br><br><br><br><br><br><br><br><br><a href='doadopt.php?id="
.$aid."'onclick='canclick()'><img src='picuploads/png/e42598f988b271a7e66b36b9a5d8143b.png' /></a><br> 
            
{$description}</td>"
        } 
    } 

 
// End the looping out of all adoptables... 
     
    
$article_content .= "</tr></table>"
// This bracket ends the IF check for whether or not an ID was entered 
else{ 
    
// We have specified an ID of an adoptable we wish to adopt 

    
$query "SELECT * FROM {$prefix}adoptables, {$prefix}adoptables_conditions  
                                                  WHERE 
{$prefix}adoptables.id='{$id}'  
                                                        
{$prefix}adoptables_conditions.id = {$prefix}adoptables.id"
    
$result runquery($query); 
    
$row mysql_fetch_array($result); 

    
$aid $row['id']; 
    
$type=$row['type']; 
    
$description=$row['description']; 
    
$eggimage=$row['eggimage']; 

    if(
$aid == $id){ 
        
//The adoptable exists and is valid 

        
$canadopt canadopt($aid"adopting"$promocode$row);  

        if(
$canadopt == "yes"){ 
            
$article_title "Adopting ".$type
            
$article_content $langa1."".$type.$langa2


            
$article_content $article_content."<br><img src='{$eggimage}' border='0'><br> 
            <form name='form1' method='get' action='doadopt.php'> 
              <p>Adoptable Name:  
                <input name='name' type='text' id='name'> 
                <input name='id' type='hidden' id='id' value='
{$id}'> 
                <input name='promocode' type='hidden' id='promocode' value='
{$promocode}'> 
              </p> 
              <p> 
                <input type='submit' name='Submit' value='Adopt Me'> 
            </p> 
            </form>"

        } 
        else{ 
            
$article_title $accden
            
$article_content $adoptnoper
        } 
// End Can Adopt ELSE 
    

    else { 
        
//The adoptable does not exist, nothing we can do... 
        
$article_title $err_idnoexist
        
$article_content $err_idnoexist_text
    } 
// End adoptable does not exist ELSE 
// This bracket ends the else statements for whether or not an ID was entered 


//***************// 
//  OUTPUT PAGE  // 
//***************// 

echo showpage($article_title$article_content$date); 

?>
Reply With Quote
  #43  
Old 03-24-2012, 07:47 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 81,199
SilverDragonTears is on a distinguished road
Default

Aha :) Neato! Will you explain to me what it is and what it does? I like to know how everything works.
__________________

Check out SilvaTales
Reply With Quote
  #44  
Old 03-24-2012, 09:25 PM
!Alive !Alive is offline
Member
 
Join Date: Feb 2012
Posts: 39
Gender: Male
Credits: 1,053
!Alive is on a distinguished road
Default

XD Glad to.
Lets see to start I suppose I'l go over how the rarity thing actually works.
First you'll see
PHP Code:
$uncommon rand(1,50);   
    
$rare rand(1,100);   
    
$ultrarare rand(1,200); 
These variables set the likelihood of a certain rarity of adoptable appearing. Uncommon 1 in 50
Rare 1 in 100
Ultrarare 1 in 200
You can change the chances simply by the last(max) number of the rand function.

Moving on to the actual selecting of the adoptables. You will see this:
PHP Code:
 if ($uncommon==&& $onlyone==0){   
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }   
    else if (
$rare==&& $onlyone==0){   
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }       
    else if (
$ultrarare==1  && $onlyone==0){   
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }       
    else{   
    
$query "SELECT * FROM ".$prefix."adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";   
    } 
First the if statement tests if something other than a common adoptable is to be shown. If it is than it pulls a random adoptable from the database with the corresponding rarity value.
Since the $onlyone variable is shown I'll go over what it does now. The reason for this variable is to check if a rarer adoptable(anything above common) is already selected to be shown. If one isn't chosen choose one if one is already chosen show a common one.

I think the last piece is the $clicked variable that only allows you to click on(adopt) an egg once. This works by setting $clicked to 0 when the page is loaded When the egg is clicked the canclick function runs checking the value of clicked. If it is 0 then the egg is adopted if it is a 1 the user can not adopt it.

I think I covered it. If you want/need more clarification fell free to ask. *is not confident I explained it really well* X3
Reply With Quote
  #45  
Old 03-24-2012, 10:07 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 81,199
SilverDragonTears is on a distinguished road
Default

That is so cool! I love it! Thank you so much!
__________________

Check out SilvaTales
Reply With Quote
  #46  
Old 03-24-2012, 10:20 PM
!Alive !Alive is offline
Member
 
Join Date: Feb 2012
Posts: 39
Gender: Male
Credits: 1,053
!Alive is on a distinguished road
Default

:P You're welcome. I'm glad that I was able to be of service. X3

*thinking about asking you how to link a forum to my site like you have it.*
Reply With Quote
  #47  
Old 03-24-2012, 11:13 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 81,199
SilverDragonTears is on a distinguished road
Default

It's in the new mys script :p So unless you upgrade I wouldn't know how.
__________________

Check out SilvaTales
Reply With Quote
  #48  
Old 03-26-2012, 07:18 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 81,199
SilverDragonTears is on a distinguished road
Default

@Alive - did you notice the sort doesn't work in FF? :(
__________________

Check out SilvaTales
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 03:11 AM.

Currently Active Users: 403 (0 members and 403 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636