- Joined
- Apr 1, 2009
- Messages
- 1,220
- Reaction score
- 1,281
1. Правите 1 файл cfr.php в който пишете:
2. след това добавяте в wshmodules.php:
3. cлед това добавяте в wshconf.php:
4. в \lang\english.php
5. За да искарате в меню-то опцията трябва да добавите в Menu_Config.inc следния код:
PHP:
<?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. след това добавяте в wshmodules.php:
PHP:
define('cfr', moddir.'/cfr.php'); // by ivowe3
3. cлед това добавяте в wshconf.php:
PHP:
$webshop['credits']['cfr'] = 500; //Kolko Kredita za 1 reset
4. в \lang\english.php
PHP:
#CFR
define('phrase_menu_cfr', "Exchange Resets");
5. За да искарате в меню-то опцията трябва да добавите в Menu_Config.inc следния код:
PHP:
// CFR
if ($webshop['credits']['cfr']) $menu -> item(phrase_menu_cfr, 'index.php?sy=cfr');
Last edited: