[Release] WebShop Exchange Resets For Credits

Results 1 to 1 of 1
  1. #1
    The Supreme King Masteru is offline
    MemberRank
    Jun 2012 Join Date
    1,155Posts

    cool [Release] WebShop Exchange Resets For Credits

    Tutorial Install this script: Test and work 100% for 97d+99i

    1. Make 1 cfr.php file in which you type and add webshop/modules:

    PHP Code:
    <?php
    iseedeadpeople
    ();
    switch (
    1) {
        default: 
        if (
    $webshop['credits']['cfr']<1) {
            print 
    phrase_blocked_module;
            break;
        }
        if ((
    $_POST['character']) && ($_POST['reset'])) {
            
    $query    mssql_query("select [Resets] from [Character] where [Name]='".secure($_POST['character'])."' and [AccountID]='".$GLOBALS['mu_user']."'");
            
    $res    mssql_fetch_row($query);
            
    $newresets$res[0]-$_POST['reset'];
            
    $newcredits$_POST['reset']*$webshop['credits']['cfr'];
            require 
    'inc/function.checkstatus.php';
            switch (
    2) {
                case 
    checkstatus($_POST['character']) :
                    
    $legtitle    "Error";
                    
    $content    phrase_offline_rq;
                    break;
                case (
    mssql_num_rows($query)!=1):
                    
    $legtitle    "Error";
                    
    $content    phrase_nosuch_char;
                    break;
                case 
    $newresets<0:
                    
    $legtitle    "Error";
                    
    $content    "You dont have enought Resets";
                    break;
                case 
    $_POST['reset']<0:
                    
    $legtitle    "Error";
                    
    $content    "Resets Cant be negative value!";
                    break;
                default :
                
    shoplog("Character: ".$_POST['character']." , exchange ".$_POST['reset']." for ".$newcredits." credits");
                
    mssql_query("exec XCredits '".$GLOBALS['mu_user']."', ".($newcredits*1));
                
    mssql_query("update [Character] set [Resets]='".$newresets."' where [Name]='".secure($_POST['character'])."';") or die("Failed to excahnge your resets");
                
    $legtitle    "Success";
                
    $content    "You have successfully exchange Resets";
            }
            print 
    '<fieldset style="width: 300px"><legend class="mu_style2" style="padding: 0px;font-weight:bold;">'.$legtitle.'</legend><div>'.$content.'</div>
    </fieldset><br><br>'
    ;
        }
        
    $query    mssql_query("select [Name],[Resets] from [Character] where [AccountID]='".$GLOBALS['mu_user']."'");
        
    $i    0;
        
    $mychars'';
        while(
    $i<mssql_num_rows($query)) {
            
    $char    mssql_fetch_array($query);
            
    $i++;
            
    $mychars.="<option class=\"clchg\" value=\"".htmlspecialchars($char['Name'])."\">".$char['Name']."</option>";
        }
    print 
    "
    <script type=\"text/javascript\">
    function amisure() {
        if ("
    .$mycreds."<".$webshop['credits']['cfr'].") {
            alert('"
    .phrase_lack_credits."');
            return false;
        }
        return webshop_confirm_action('Are you sure you want to exchange '+document.getElementById('character').value+'\'s Resets?');
    }
    </script>
    "
    ;
    print
    '
    <fieldset style="width: 300px">
    <legend class="mu_style2" style="padding: 0px;font-weight:bold;">Exchange your Resets for credits</legend>
    <form method="post" action="'
    .$_SERVER['SCRIPT_NAME'].'?sy=cfr">
    <table width=100% cellpadding=0 cellspacing=0 border=0>
    <tr><td align="center">
    <select style="color: #000000;" id="character" name="character">
    <optgroup label="Select a character">
    '
    .$mychars.'
    </select></td><td align="center">
    <span id="sybrack" name="sybrack">
     <input type="text" name="reset" size="10" placeholder="Resets" />
    </span>
    </td></tr><tr><td colspan="2" height=15></td></tr><tr>
    <td colspan="2" align="center" style="padding-top: 10px;border-top: 1px dashed #DDDDDD"><input value="Exchange Resets" type="submit"><br>Exchange '
    .number_format($webshop['credits']['cfr']).' Credits for Reset</td></tr></table>
    </form>
    </fieldset>
    '
    ;
    }
    ?>
    2. Then add to wshmodules.php:

    PHP Code:
    define('cfr',        moddir.'/cfr.php');        // by ivowe3 
    3. Then add to wshconf.php:

    PHP Code:
    $webshop['credits']['cfr'] = 500//Kolko Kredita za 1 reset 
    4. в \lang\english.php

    PHP Code:
    #CFR
    define('phrase_menu_cfr',       "Exchange Resets"); 
    5. To request in the menu the option you have to add to the Menu_Config.inc the following code:

    PHP Code:
    // CFR
    if ($webshop['credits']['cfr'])     $menu -> item(phrase_menu_cfr'index.php?sy=cfr'); 
    Credits to ivowe3

    Last edited by Masteru; 04-02-18 at 04:44 PM. Reason: New info




Advertisement