• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Add Reset System On CabalToolz 2.0 or 3.0

Joined
Oct 14, 2008
Messages
1,277
Reaction score
249

Add Reset System On CabalToolz 2.0 or 3.0 Website By john_d


1.Open your query

2.Select GAMEDB database

3.Add this script:

Code:
ALTER TABLE [dbo].[cabal_character_table]
ADD
 [Reset] [int] NULL DEFAULT (0)

4.Go to your webserver directory\backend

Eg:C:\xampp\htdocs\backend
"backend" is the Cabaltoolz Backend


5.Create new php file and name it resets.php

6.Open the resets.php from your backend folder

Eg:C:\xampp\htdocs\backend\resets.php

7.Add this script

Code:
<? include 'config.php'; ?><?
$db=mssql_connect($addr,$user,$pass);

mssql_select_db("ACCOUNT", $db);
$sql = "SELECT COUNT(*) FROM cabal_auth_table";
$res = mssql_query($sql);
$row = mssql_fetch_row($res);
$count1=$row[0];

mssql_select_db("Gamedb", $db);

$sql = "SELECT * FROM cabal_character_table WHERE Login='1'";
$res = mssql_query($sql);
$count=0;
while($row = mssql_fetch_array($res)){
$count++;
}

$sql = "SELECT COUNT(*) FROM cabal_character_table";
$res = mssql_query($sql);
$row_count = mssql_fetch_row($res);


$sql = "SELECT * FROM cabal_character_table ORDER BY RESET";
$res = mssql_query($sql);
$i=0;
while($row = mssql_fetch_array($res)){
$data[$i] = $row['Name'];
$data1[$i]= $row['RESET'];
//print '<b>'.$row_count[0].$data[$i]."</b><br>";

if($i==$row_count[NULL])break;
$i++;
}


?> <center>
<table width="525" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td width="21"><font size="3" face="Arial"><img src="_img/centro1.gif" width="28" height="30"></font></td>
    <td width="484" background="_img/centro2.gif"><font size="3" face="Arial"><strong>   <font color="#000000" size="2">Ranking
            Reset
            - </font></strong></font><font face="Arial"><strong><? echo $svname ?></strong></font></td>
    <td width="20"><font size="3" face="Arial"><img src="_img/centro3.gif" width="19" height="30"></font></td>
  </tr>
</table>
<div align="center"><br>
    <br>
    <br>
    <?if(isset($_SESSION['user'])){
echo "<center><b>".htmlspecialchars($_SESSION['user'])."</b></center>";

}
?>
</div>
</center>

  <div align="center">
    <table width='200' border='0' cellspacing='0' cellpadding='0' class='3'>
      <tr>
        <td width="100%" align='center' class='3'><p align="left"><font color="#CCCCCC" size="2" face="Arial, Helvetica, sans-serif"><b>Character</b></font></p>          
        </td>
        <td width="90%" height="19" colspan="3" align='center' class='3'>          <p align="center"><font color="#CCCCCC" size="2" face="Arial, Helvetica, sans-serif"><b>Reset</b></font></p>          
        </td>
      </tr>
  <?
$k=0;
for($i=$row_count[0];$i>=0;$i--){
if(!isset($data[$i])){}else{
$k++;
if($k>=10){}else{
?>     <tr>
        <td align='left' class='3'><font color="#333333" size="2" face="Arial"><?echo '<b>'.$data[$i];?></font></td>
        <td height="19" colspan="3" align='center' class='3'><font color="#333333" size="2" face="Arial"><? echo '<b>'.$data1[$i].'</b>';?></font></td>
      </tr>
  <?

}
}
}
?>
    </table>
  </div>

PS:IF YOU HAVE ALREADY THE resets.php , don't worry , open it , delete everything that is written in it and add the code above.

8.Save & Close

9.Go to your backend\modules

Eg:C:\xampp\htdocs\backend\modules

10.Open the user.resets.php

11.Delete everything that is written in it

12.Add this script

Code:
<?PHP
if (!isset($_config)) die('Ops!');

			$rs = $db2->Execute('Select Lev,Style, Alz, STR, DEX, INT, PNT, RESET, characteridx,  Name from cabal_character_table where characteridx = ? ', array($this->id));
				$char = $rs->GetArray();
				$rs = $char[0];
				$style = decode_style($rs['Style']);
if ($style['Class'] > 8) $style['Class'] = $style['Class']-8;
if ($rs[$_config['ucp_lvl_col']] == null) $rs[$_config['ucp_lvl_col']] = 0;
$rs2 = $db->Execute('select * from cabal_newchardata_table where classtype=? and lev = 1 and DataIdx=10',array($style['Class']));
$char = $rs2->GetArray();
$rs2 = $char[0];	
			$msg2 = char_list($this->id);	
				if (online_check($db2,$this->id) == false && isset($rs['Lev'])) {
				  	if ($_config['ucp_lvl_allow'] == true ) {
						if ($rs['Lev']  >= $_config['ucp_lvl_level']) { 
							if ($rs['Alz'] >= $_config['ucp_lvl_payment']) {
								if ( $_config['ucp_lvl_inv_check'] == false) {
									if ($rs[$_config['ucp_lvl_col']] < $_config['ucp_lvl_limit'] ) {
										    writelog("[ $name ] Level Reset","Level Reset");
if ($_config['ucp_lvl_keep_stat'] == true) {  

$form .= '<table width="100%" cellpadding="5"><tr>';
$form .= '<td><fieldset><legend>Before</legend> 
<label>Level:</label> '.$rs['LEV'].'<br/> 
<label>STR:</label> '.$rs['STR'].'<br/>
<label>DEX:</label> '.$rs['DEX'].'<br/>
<label>INT:</label> '.$rs['INT'].'<br/>
<label>PNT:</label> '.$rs['PNT'].'<br/>
<label>'.$_config['ucp_lvl_col'].':</label> '.$rs[$_config['ucp_lvl_col']].'<br/>
</fieldset></td>';
$form .= '<td><fieldset><legend>After</legend> 
<label>Level:</label> 1<br/> 
<label>STR:</label> '.$rs['STR'].'<br/>
<label>DEX:</label> '.$rs['DEX'].'<br/>
<label>INT:</label> '.$rs['INT'].'<br/>
<label>PNT:</label> '.($rs['PNT']+$_config['ucp_lvl_bonus']).'<br/>
<label>'.$_config['ucp_lvl_col'].':</label> '.($rs[$_config['ucp_lvl_col']]+1).'<br/></fieldset></td>';
$form .= '</tr></table>';
if ($this->opt1 == 'do_reset'){// && ctype_digit($rs2['LEV'])) { 
alert('You are now being reseted, Press OK to confirm');
$temp = $rs['RESET'] + 1;	
$do = $db2->Execute('update cabal_character_table set LEV=?,PNT=?,EXP=0,WorldIdx=?,Position=?,Nation=0,Alz=?,'.$_config['ucp_lvl_col'].'=? where CharacterIdx = ? and Lev >= ?',
 array($rs2['LEV'], ($rs['PNT']+$_config['ucp_lvl_bonus']),$rs2['WorldIdx'],$rs2['Position'],($rs['Alz']-$_config['ucp_lvl_payment']),($temp),$this->id,$_config['ucp_lvl_level']));
}


	} else {
$form .= '<table width="100%" cellpadding="5"><tr>';
$form .= '<td><fieldset><legend>Before</legend> 
<label>Level:</label> '.$rs['LEV'].'<br/> 
<label>STR:</label> '.$rs['STR'].'<br/>
<label>DEX:</label> '.$rs['DEX'].'<br/>
<label>INT:</label> '.$rs['INT'].'<br/>
<label>PNT:</label> '.$rs['PNT'].'<br/>
<label>'.$_config['ucp_lvl_col'].':</label> '.$rs[$_config['ucp_lvl_col']].'<br/>
</fieldset></td>';
$bonus = (($rs[$_config['ucp_lvl_col']]+1) * 10) +$_config['ucp_lvl_bonus'];
$form .= '<td><fieldset><legend>After</legend> 
<label>Level:</label> '.$rs2['LEV'].'<br/> 
<label>STR:</label> '.$rs2['STR'].'<br/>
<label>DEX:</label> '.$rs2['DEX'].'<br/>
<label>INT:</label> '.$rs2['INT'].'<br/>
<label>PNT:</label> <b>'.$bonus.'</b><br/>
<label>'.$_config['ucp_lvl_col'].':</label> '.($rs[$_config['ucp_lvl_col']]+1).'<br/></fieldset></td>';
$form .= '</tr></table>';

if ($this->opt1 == 'do_reset'){ //&& ctype_digit($rs2['LEV'])) { 
alert('You are now being reseted, Press OK to confirm');
$temp = $rs['RESET'] + 1;	
//$db2->debug=1;

$do = $db2->Execute('update cabal_character_table set LEV=?,STR=?,DEX=?,INT=?,PNT=?,EXP=0,WorldIdx=?,Position=?,HP=?,MP=?,Nation=0,Alz=?,'.$_config['ucp_lvl_col'].'=? where CharacterIdx = ? and Lev >= ?',
 array($rs2['LEV'], $rs2['STR'], $rs2['DEX'], $rs2['INT'],($bonus),$rs2['WorldIdx'],$rs2['Position'],$rs2['HP'],$rs2['MP'],($rs['Alz']-$_config['ucp_lvl_payment']),($temp),$this->id,$_config['ucp_lvl_level']));
}				
     }		

			
$form .= '<center><input type="button" value="Click Here to Reset Your Hero" onclick="javascript:this.disabled=1;char_do(\''.$this->id.'\',\'Reset\',\'do_reset\');"></center>';
									   	//if ($_config['lvl_magic_clear'] == true) $db->Execute('update Character  SET MagicList = Null where and mu_id = ?', array($this->id));
									} else $msg = _Reset_limit.' ('.$_config['ucp_lvl_limit'].')';
								} else $msg = _Reset_inv.' <a href="javascript:char_do('.$this->id.',\'cls_inv\');"> CLEAR INVENTORY! </a>';
							} else $msg = _Reset_money_r;
						} else $msg = _Reset_lvl_r;
					} else $msg = _Reset_not_allowed;
				} else $msg = _Reset_online;


				$msg .= '<br><br><center><a href="javascript:form_read(\'Hero\')"><img border=0 src="includes/back.png"><br>'._Back_Hero.'</a></center>';
				
				$msg2 .= '<hr> Inventory Empty Check: '.($_config['ucp_lvl_inv_check'] == false ? 'No check' : 'Needed' ).' 
				 <br> Money in Hand: '.$rs['Alz'].' <br> Money Needed for Reset: '. ($_config['ucp_lvl_payment']).' <hr><b> '.$msg .'</b>';
				aprint('tabs-content', $form .$msg2);
?>

13.Save & Close

14.Go to your backend\config.php

Eg:C:\xampp\htdocs\backend\config.php

15.Search for

Code:
// LEvel Reset config
$_config['ucp_lvl_allow'] = false; // true of false
$_config['ucp_lvl_level'] = 200;
$_config['ucp_lvl_payment'] = 100000000;
$_config['ucp_lvl_inv_check'] = true; // if true will check if inventory and equipments are empty
$_config['ucp_lvl_keep_stat'] = false; // if true keep stats is enabled
$_config['ucp_lvl_bonus'] = 75; // Bonus per reset
$_config['ucp_lvl_magic_clear'] = false; // if true will remove magic list
$_config['ucp_lvl_limit'] = 999; // Limit number for resets
$_config['ucp_lvl_col'] = 'RESETS'; // name of the column
16.Replace with
Code:
// LEvel Reset config
$_config['ucp_lvl_allow'] = true; // true or false
$_config['ucp_lvl_level'] = 200;
$_config['ucp_lvl_payment'] = 10000000;
$_config['ucp_lvl_inv_check'] = false; // this have to be false if true it's not working
$_config['ucp_lvl_keep_stat'] = true; // if true keep stats is enabled
$_config['ucp_lvl_bonus'] = 5; // Bonus per reset
$_config['ucp_lvl_magic_clear'] = false; // if true will remove magic list
$_config['ucp_lvl_limit'] = 500; // Limit number for resets
$_config['ucp_lvl_col'] = 'Reset'; // name of the column

17.Edit however you want

18.Save & Close.
Done you have reset system in UserPanel!:thumbup:

Credits:
john_d for scripts.
S37uP!Update for tutorial.
 
Back
Top