I want to make it that in additional to getting 25 coins, it gives me a gender specific item in the AccountItem table depending on the Character's sex.
I've tried to do it myself, but to no avail as I'm not fully efficient in PHP.
Original code that I've edited for my server:
Spoiler:
PHP Code:
// Rebirth Function start if($_GET['action'] == "rebirth") { $q = mssql_query("SELECT * FROM Character WHERE Name = '".$_POST['re']."'"); if(mssql_result($q, 0, 'Level') != 99) { alertbox("Character selected is not level 99.","index.php"); die(); } else { $res2 = mssql_query_logged("SELECT Tokens FROM Account WHERE AID = '".$_SESSION['AID']."'"); $acc = mssql_fetch_assoc($res2); $aid = $_SESSION['AID']; //Edit the numbers after the + in $coins and $ecoins to your fit $Tokens = $acc['Tokens'] + 25; $q = mssql_query("UPDATE Character SET Level = 1, XP = 0 WHERE Name = '".$_POST['re']."'"); $q2 = mssql_query("UPDATE Account SET Tokens = '$Tokens' WHERE AID = '$aid'");
alertbox("The character, ".$_POST['re'].", has been successfully rebirthed.","index.php"); die(); } }
My code now:
Spoiler:
PHP Code:
// Rebirth Function start if($_GET['action'] == "rebirth") { $q = mssql_query("SELECT * FROM Character WHERE Name = '".$_POST['re']."'"); if(mssql_result($q, 0, 'Level') != 99) { alertbox("Character selected is not level 99.","index.php"); die(); } else { $res2 = mssql_query_logged("SELECT Tokens FROM Account WHERE AID = '".$_SESSION['AID']."'"); $acc = mssql_fetch_assoc($res2); $aid = $_SESSION['AID']; //Edit the numbers after the + in $coins and $ecoins to your fit $Tokens = $acc['Tokens'] + 25; $q = mssql_query("UPDATE Character SET Level = 1, XP = 0 WHERE Name = '".$_POST['re']."'"); $q2 = mssql_query("UPDATE Account SET Tokens = '$Tokens' WHERE AID = '$aid'"); } $qitem = mssql_query("SELECT Sex FROM Character WHERE Name = '".$_POST['re']."'"); if ($qitem=="0") { $res = mssql_query("INSERT INTO AccountItem (AID, ItemID, RentDate, cnt) VALUES('"$_SESSION['AID']"','20001','$date','1')"); } else { $res = mssql_query("INSERT INTO AccountItem (AID, ItemID, RentDate, cnt) VALUES('"$_SESSION['AID']"','20501','$date','1')");
alertbox("The character, ".$_POST['re'].", has been successfully rebirthed.","index.php"); die(); } }
28-09-12
Dave
Re: [Help] Gifting a gender specific item when rebirthed
PHP Code:
<?php // Rebirth Function start if($_GET['action'] == "rebirth") { $q = mssql_query("SELECT Level, Sex FROM Character WHERE Name = '".$_POST['re']."'"); if(mssql_result($q, 0, 'Level') != 99) { alertbox("Character selected is not level 99.","index.php"); die(); } else { $gender = mssql_result($q, 0, 'Sex');
mssql_query("UPDATE Character SET Level = 1, XP = 0 WHERE Name = '".$_POST['re']."'"); mssql_query("UPDATE Account SET Tokens = Tokens + 25 WHERE AID = '".$_SESSION['AID']."'");