Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

(SQL Script)Add 25 on Credits table once character has reseted.

Status
Not open for further replies.
Joined
Jan 9, 2005
Messages
669
Reaction score
83
Hi anyone knows how to modify this one that i can add corresponding amount like let say 25 credits will be added on their game-credits per reset on this auto-reset script:

Code:
UPDATE Character
SET clevel = 1, Experience = 0, LevelUpPoint = 350 * (Resets + 1), Money = Money - (100000000), MapNumber = 0, MapPosX = 130, MapPosY = 130, PkTime = 0, PkCount = 0, PkLevel = 0, Resets = Resets + 1
FROM Character JOIN MEMB_STAT ON Character.AccountID = MEMB_STAT.memb___id
COLLATE Latin1_general_CI_AI
WHERE (clevel >= 400) AND (Money >= (100000000)) AND (ConnectStat = 0) ;

or somekind of like this(pseudocode)

IF character reseted, add leveluppoints 350 * number of resets - 10,000,000 zen money, warp back in lorencia, PK count and time = 0 resets = resets plus 1 and credits = credits + 25

like the sql script will add up credits at the same time the character reseted. i would like to do it myself but im not knowledgeably capable with sql. =c cuz i wanna make use of their reset as a game credit to purchase in Muweb(by themad)

please help =c

P.S: if this is something can help with my problem here is the path of the credits in the database.

MuOnline > MEMB_CREDITS(Tables are : memb___Id and Credits


thank you so much in advance and i msorry if i can't explain it in great detail (english is not good :():?:
 
Junior Spellweaver
Joined
Apr 16, 2007
Messages
145
Reaction score
82
using that script you can simply append another script.

PHP:
UPDATE Character
SET clevel = 1, Experience = 0, LevelUpPoint = 350 * (Resets + 1), Money = Money - (100000000), MapNumber = 0, MapPosX = 130, MapPosY = 130, PkTime = 0, PkCount = 0, PkLevel = 0, Resets = Resets + 1
FROM Character JOIN MEMB_STAT ON Character.AccountID = MEMB_STAT.memb___id
COLLATE Latin1_general_CI_AI
WHERE (clevel >= 400) AND (Money >= (100000000)) AND (ConnectStat = 0) ;

UPDATE MEMB_CREDITS
 SET Credits =Credits+25
 FROM MEMB_CREDITS JOIN MEMB_STAT ON MEMB_CREDITS.memb___id = MEMB_STAT.memb___id
 COLLATE Latin1_general_CI_AI
 WHERE ConnectStat = 0 ;
 
Upvote 0
Joined
Jan 9, 2005
Messages
669
Reaction score
83
thanks for the reply sir :) gotta try this one :)

i would like to do it myself yet i have no sql knowledge :)

thanks alot xD

EDIT :p

bad news the auto reset don't work at all =c

so reset was working only through website(mu web0.8) and i would like to know how to implement the code that will trigger addition of credits once the character has made reset via website ? or any other way that MEMB_CREDITS can make a reference to the RESETS amount update so it can add by itself (assuming 25 credits will be awarded to the character after reset > update MEMM_CREDITS on their ACCOUNT =c

sorry if im asking too much but i can't implement my pseudocode well on sql's stuff =c

using DMT Server files Season 2

EDIT:

found this code on MuWeb which is related to Reset Script:

Code:
function reset($charactername)
{
          if ((isset($_SESSION['pass'])) && (isset($_SESSION['user']))); 
                     {
                           require("config.php");
                           $loginid = "$_SESSION[user]";

                           $character_check = $db->Execute("SELECT Name FROM Character WHERE Name=? and AccountID=?",array($charactername,$loginid)); 
                           $character_check_ = $character_check->numrows();
                           $online_check = $db->Execute("SELECT ConnectStat FROM MEMB_STAT WHERE memb___id=?",array($loginid));
                           $row2 = $online_check->fetchrow();

                           $result = $db->Execute("Select Clevel,Resets,Money,LevelUpPoint,class From Character where Name=?",array($charactername));
                           $row = $result->fetchrow();

                           $resetup=$row[1] + (1);
                           $resetmoeny=$row[2]-($muweb['resetmoney']);
                           $resetpt=$row[3] + ($muweb['resetpoints']);
                           $resetpt1=$muweb['resetpoints'] * ($row[1] + 1);

                            if (empty($charactername) || empty($loginid)){$error=1;
	                                 show_error("$warning_start Some Fields Were Left Blank! $warning_end");
                                                                         }
                            if ($character_check_ <= 0){$error=1;
                                         show_error("$warning_start Character $charactername Does Not Exist! $warning_end");
                                                           }

                            if ($row2[0] != 0){ $error=1;
                                         show_error("$warning_start Character $charactername Is Online, Must Be Logged Off! $warning_end"); 
                                                  }

                            if ($resetmoeny < 0){ $error=1;
                                         show_error("$warning_start $charactername Need $muweb[resetmoney] Zen To Reset! $warning_end"); 
                                                    }

                            if ($row[0] < $muweb['resetlevel']){ $error=1;
                                         show_error("$warning_start $charactername Need Level $muweb[resetlevel] To Reset! $warning_end"); 
                                                                   }

                            if ($row[1] > $muweb['resetslimit']){ $error=1;
                                         show_error("$warning_start Resets limit is set to $muweb[resetslimit]! $warning_end"); 
                                                                    }


                            if($error!=1){

                                    if(($muweb['resetmode']=='keep') AND ($muweb['levelupmode']=='normal')){
                                         $sql_reset_script="Update character set [clevel]='1',[experience]='0',[money]='$resetmoeny',[LevelUpPoint]='$resetpt',[resets]='$resetup' where name=?";}
                                    elseif(($muweb['resetmode']=='reset') AND ($muweb['levelupmode']=='extra')){
                                         $sql_reset_script="Update character set [strength]='25',[dexterity]='25',[vitality]='25',[energy]='25',[clevel]='1',[experience]='0',[money]='$resetmoeny',[LevelUpPoint]='$resetpt1',[resets]='$resetup' where name=?";}
                                    elseif(($muweb['resetmode']=='keep') AND ($muweb['levelupmode']=='extra')){
                                         $sql_reset_script="Update character set [clevel]='1',[experience]='0',[money]='$resetmoeny',[LevelUpPoint]='$resetpt1',[resets]='$resetup' where name=?";}
                                    elseif(($muweb['resetmode']=='reset') AND ($muweb['levelupmode']=='normal')){
                                         $sql_reset_script="Update character set [strength]='25',[dexterity]='25',[vitality]='25',[energy]='25',[clevel]='1',[experience]='0',[money]='$resetmoeny',[LevelUpPoint]='$resetpt',[resets]='$resetup' where name=?";}
                                    if($muweb['clean_inventory']=='yes' && $muweb['clean_skills']=='yes'){
                                         $sql_reset_script2="UPDATE character Set [inventory]=CONVERT(varbinary(1080), null),[magiclist]= CONVERT(varbinary(180), null) Where name=?";}
                                    elseif($muweb['clean_inventory']=='no' && $muweb['clean_skills']=='no'){
                                         $sql_reset_script2="Select name from character where name=?";}
                                    elseif($muweb['clean_inventory']=='yes' && $muweb['clean_skills']=='no'){
                                         $sql_reset_script2="UPDATE character Set [inventory]=CONVERT(varbinary(1080), null) Where name=?";}
                                    elseif($muweb['clean_inventory']=='no' && $muweb['clean_skills']=='yes'){
                                         $sql_reset_script2="UPDATE character Set [magiclist]= CONVERT(varbinary(180), null) Where name=?";}


                                    $sql_reset_exec = $db->Execute($sql_reset_script,array($charactername));
                                    $sql_reset_exec2 = $db->Execute($sql_reset_script2,array($charactername));

                                    show_error("$ok_start $charactername SuccessFully Reseted! $ok_end");

                                                    $logfile = 'logs/resets_logs.php';
                                                    $ip = $_SERVER['REMOTE_ADDR'];
                                                    $date = date('Y-m-d H:i');
                                                    $data = "Character $_POST[reset_character] Has Been <font color=#FF0000>Reseted</font>, Before Reset:$row[1](resets), After Reset:$resetup(resets), All Those On $date By ip:$ip \n";
                                                    $fp = fopen($logfile, 'a');
                                                    fputs($fp, $data);
                                                    fclose($fp);
                               }      



                      }      







                         
}

IS it possible to update 2 columns with each different tables?(Like from Character(table) = Reset(column) and MEMB_CREDIT(table) = credits(column) and MEMB_CREDIT will make reference to Character(table) on Reset(column) to update accounts credit on MEMB_CREDIT(table) = credit(column)

thanks!
 
Last edited:
Upvote 0
Status
Not open for further replies.
Back
Top