Sunday, 2024-05-05, 7:59 PM
Main Sign Up RSS
Welcome, Guest
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » MUonline » MUonline Guides » How to add Grand Reset System to your muweb site
How to add Grand Reset System to your muweb site
SeaAngelDate: Saturday, 2011-12-17, 11:31 AM | Message # 1
3D Modeling
Group: Administrators
Messages: 972
Awards: 1
Reputation: 42
Status: Offline
Hi all,

This is the code i've added to my muweb 0.9 Premium, that has php clear code(not using that cipher function).
It simply ads a Grand Reset page where players can grand reset themselves, so they do not bother administrators all the time.
I've tested it and worked with no problems for me.
Here is what u must do:

open file website_ROOT\sub_pages\Characters.php

find:
Quote
<li><a href="'.$muweb['servername'].'-Characters-Info.html">'._Characters_Info.'</a></li>


after this line add:
Quote
<li><a href="'.$muweb['servername'].'-Characters-GrandReset.html">GrandReset</a> <span style="color:red;"> New</span></li>


then find:
Quote
case "AddStats":


BEFORE THIS LINE ADD:

Code
       //GR SYSTEM                     
                     case "GrandReset":
                         $grdb=mssql_connect('localhost', 'SQL_USERNAME', 'SQL_PASSWORD') or die('error');
                         @mssql_select_db('MuOnline') or die('error');
                         $GRquery="SELECT Name FROM Character WHERE AccountID='".$_SESSION['user_login_name']."' AND resets>=100";
                         $GRdata=mssql_query($GRquery);

                         if ($_POST['Char']!="")
                         {
                             $GRquery="SELECT * FROM Character WHERE AccountID='".$_SESSION['user_login_name']."' AND name='".$_POST['Char']."'";
                             $GRdata=mssql_query($GRquery);
                             $GRrow = mssql_fetch_array($GRdata);
                             if ($GRrow['Resets']>=100)
                             {
                    if ($GRrow['Resets']>100)
                    {
                    $GRr=$GRrow['Resets']-100;
                    $GRpts=intval(25+10000+2000*$GRr); //10000 is the 10k points left that the character will have after GR
                    $GRquery="Update Character SET [Resets]='0',[LevelUpPoint]='".$GRpts."',[strength]='25',[dexterity]='25',[vitality]='25',[energy]='25' WHERE AccountID='".$_SESSION['user_login_name']."' AND name='".$_POST['Char']."'";
                    }
                    else
                    {
                    $GRquery="Update Character SET [Resets]='0',[LevelUpPoint]='10000',[strength]='25',[dexterity]='25',[vitality]='25',[energy]='25' WHERE AccountID='".$_SESSION['user_login_name']."' AND name='".$_POST['Char']."'"; //10000 is the 10k points left that the character will have after GR
                    }
                    @mssql_query($GRquery) or die('Error While Trying to Stats Reset! <br/>'.mssql_get_last_message());
                    //--
                    $crquery="Select * FROM MEMB_CREDITS WHERE memb___id='".$_SESSION['user_login_name']."'";
                    $crdata=mssql_query($crquery);
                    $crrow = mssql_fetch_array($crdata);
                    $GRcredits=$crrow['credits'];
                    //--
                    $GRcredits=$GRcredits+1000; //1000 is the credits reward
                    $GRquery="Update MEMB_CREDITS SET [credits]='$GRcredits' WHERE memb___id='".$_SESSION['user_login_name']."'";
                    @mssql_query($GRquery) or die('Error While Trying to Add WebShop Credits! <br/>'.mssql_get_last_message());
                    echo 'Character '.$_POST['Char'].' was successfully GrandReseted!<br/>';
                    echo 'Credits were added to your WebShop Account!';
                             }
                         }
                         else
                         {
                             echo '
                             <script type="text/javascript">
                             function get_radio_value()
                             {
                             for (var i=0; i < document.myform.Char.length; i++)
                    {
                    if (document.myform.Char[i].checked)
                    {
                    rad_val = document.myform.Char[i].value;
                    alert("Character Selected: "+rad_val+"  Will Be Grand Reseted! :)");
                    return true;
                    }
                    }
                             }
                             </script>
                             ';
                             echo '<form name="myform" action="AvengerSMu-Characters-GrandReset.html" method="POST">';
                             $GRchars=0;
                             do {
                    while ($row = mssql_fetch_row($GRdata)) {
                    echo ('<input type="radio" name="Char" value="'.$row[0].'"> '.$row[0].'<br> ');
                    $GRchars = $GRchars +1;
                    }
                             } while (mssql_next_result($GRdata));
                             echo '<input type="submit" value="Submit" onClick="return get_radio_value();"/></form>';
                             if ($GRchars == 0)
                             {
                    echo "No Character over 100 RR found !";
                             }
                         }                         
                     break;
                     //END OF GR SYSTEM  


Now it is configured to enable GR at 100RR with 1000 credits reward.

It also reset stats to 25 points and adds 10k point to add.

Feel free to post here if you need extra explanations or 2 get helo to reconfigure the code in order to meet your requirements!

Hope it helps !
 
Forum » MUonline » MUonline Guides » How to add Grand Reset System to your muweb site
  • Page 1 of 1
  • 1
Search: