Reaction Posted August 11, 2009 Posted August 11, 2009 Hi, im VERY new to all this haha im not a coder and dont pretend to be. I know just enough to edit and install premade stuff to an extent :/. Anyway after looking through 40pages here and all 16 in paid mods i had a few questions and a couple ideas as well sorry if this is the wrong place im rather tired and have looked around this seemd the most appropriate. I have MCCODES v2 and its just the basic stuff added a city and some items and wpns just barely started creation. I noticed that CRIMES is the only "quest" like application on the game and wanted to create one just like it but for quests and have a good/bad side type deal, as in you can do crimes to get evil rep and quests to recieve good. Ive tried copying the crimes and re-writing all the names and tables for quests and goin through my files but even though ive been trying i dont understand it at all :/ if anyone can help out or have any mods that would help fit this plz post back - thx. Quote
CraigF Posted August 11, 2009 Posted August 11, 2009 Re: Some Questions and Ideas Have you put in new sql? so find the crimes table in the sql file you recieved when you bought V2 and just edit that to fit the quests tables you would like? Quote
Reaction Posted August 11, 2009 Author Posted August 11, 2009 Re: Some Questions and Ideas Yeah ive been fiddling with that im pretty sure i can finish that one on my own, i was more interested in making the good/evil thing. Like u can only get certain weapons and powers by being good or evil any ideas? Quote
Guest Sniko` Posted August 11, 2009 Posted August 11, 2009 Re: Some Questions and Ideas Yeah ive been fiddling with that im pretty sure i can finish that one on my own, i was more interested in making the good/evil thing. Like u can only get certain weapons and powers by being good or evil any ideas? Me has an idea Go to docrime.php and find where you loose and add this $db->query $db->query("UPDATE users SET karma = karma -1 WHERE userid=$userid"); now find where you success the crime $db->query("UPDATE users SET karma = karma + 1 WHERE userid=$userid"); and in the table users in phpmyadmin add karma ALTER TABLE `users` ADD `karma` INT(11) DEFAULT 100; Then in header add if($ir['karma'] < 50) { print "[b]Karma:[/b] <fotn color=red>Bad</font>"; } if($ir['karma'] > 50) { print "[b]Karma:[/b] <fotn color=green>Good</font>"; } Quote
Danny696 Posted August 11, 2009 Posted August 11, 2009 Re: Some Questions and Ideas Sniko that doesnt answer his question of good and evil weapons heres what you could try not sure if itll work but im sure you get the idea: to choose weather its good or evil: ALTER TABLE `items` ADD `gORe` enum('Good','Evil') NOT NULL default 'Good', then in staff items find Armor Defense: <input type='text' name='armor' value='0' /><hr /> the below add Good or Evil: <name='gORe' type='dropdown' /> <option value='Good'>Good< <option value='Evil'>Evil</option><hr /> then in the same file find $armor=abs((int) $_POST['armor']); and add below $gORe=$db->escape($_POST['gORe']); then find $m=$db->query("INSERT INTO items VALUES('',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor)"); and replace with $m=$db->query("INSERT INTO items VALUES('',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor, $gORe)"); Then later in the file find the edit part and find this Armor Defense: <input type='text' name='armor' value='{$itemi['armor']}' /><hr /> and under it add this: Good or Evil: <name='gORe' type='dropdown' value='{$itemi['gORe']}' /> <option value='Good'>Good< <option value='Evil'>Evil</option><hr /> then find $armor=abs((int) $_POST['armor']); and under add $gORe=$db->escape($_POST['gORe']); then find $m=$db->query("INSERT INTO items VALUES('{$_POST['itmid']}',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor)"); and replace with $m=$db->query("INSERT INTO items VALUES('',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor, $gORe)"); Quote
Guest Sniko` Posted August 11, 2009 Posted August 11, 2009 Re: Some Questions and Ideas Sniko that doesnt answer his question of good and evil weapons il pm you what you could do But it does tell you what your karma level is lol, sure PM me ill redo it Quote
Reaction Posted August 11, 2009 Author Posted August 11, 2009 Re: Some Questions and Ideas thanks guys ill defin. give it a try and post back with the results! Quote
Reaction Posted August 11, 2009 Author Posted August 11, 2009 Re: Some Questions and Ideas i havent tried the karma or good/evil yet as im still working on quests but this is what i have for quests so far, please keep in mind ive never done this before haha. This is staff_quest.php that i made off of crimes <?php include "sglobals.php"; if($ir['user_level'] > 2) { die("403"); } //This contains course stuffs switch($_GET['action']) { case 'newquest': new_quest_form(); break; case 'newquestsub': new_quest_submit(); break; case 'editquest': edit_quest_begin(); break; case 'editquestform': edit_quest_form(); break; case 'editquestsub': edit_quest_sub(); break; case 'delquest': delquest(); break; case 'newquestgroup': new_questgroup_form(); break; case 'newquestgroupsub': new_questgroup_submit(); break; case 'editquestgroup': edit_questgroup_begin(); break; case 'editquestgroupform': edit_questgroup_form(); break; case 'editquestgroupsub': edit_questgroup_sub(); break; case 'delquestgroup': delquestgroup(); break; case 'reorder': reorder_questgroups(); break; default: print "Error: This script requires an action."; break; } function new_quest_form() { global $ir, $c, $db; print "Adding a new quest. <form action='staff_quests.php?action=newquestsub' method='post'> Name: <input type='text' name='name' /> Brave Cost: <input type='text' name='brave' /> Success % Formula: <input type='text' name='percform' value='((WILL*0.8)/2.5)+(LEVEL/4)' /> Success Money: <input type='text' name='money' /> Success Crystals: <input type='text' name='crys' /> Success Item: ".item2_dropdown($c, 'item')." Group: ".questgroup_dropdown($c,'group')." Initial Text: <textarea rows=4 cols=40 name='itext' /></textarea> Success Text: <textarea rows=4 cols=40 name='stext' /></textarea> Failure Text: <textarea rows=4 cols=40 name='ftext' /></textarea> quest XP Given: <input type='text' name='questxp' /> <input type='submit' value='Create quest' /></form>"; } function new_quest_submit() { global $ir,$c,$userid, $db; if($_POST['itemon'] != "on") { $_POST['item']=0; } $db->query("INSERT INTO quests (questNAME, questBRAVE, questPERCFORM, questSUCCESSMUNY, questSUCCESSCRYS, questSUCCESSITEM, questGROUP, questITEXT, questSTEXT, questFTEXT, questJTEXT, questXP) VALUES( '{$_POST['name']}', '{$_POST['brave']}', '{$_POST['percform']}', '{$_POST['money']}', {$_POST['crys']}, {$_POST['item']}, '{$_POST['group']}', '{$_POST['itext']}', '{$_POST['stext']}', '{$_POST['ftext']}', {$_POST['questxp']})"); print "quest created!"; stafflog_add("Created quest {$_POST['name']}"); } function edit_quest_begin() { global $ir,$c,$h,$userid,$db; print "<h3>Editing quest</h3> You can edit any aspect of this quest. <form action='staff_quests.php?action=editquestform' method='post'> quest: ".quest_dropdown($c,'quest')." <input type='submit' value='Edit quest' /></form>"; } function edit_quest_form() { global $ir,$c,$h,$userid,$db; $d=$db->query("SELECT * FROM quests WHERE questID={$_POST['quest']}"); $itemi=$db->fetch_row($d); print "<h3>Editing quest</h3> <form action='staff_quests.php?action=editquestsub' method='post'> <input type='hidden' name='questID' value='{$_POST['quest']}' /> Name: <input type='text' name='questNAME' value='{$itemi['questNAME']}' /> Brave Cost: <input type='text' name='questBRAVE' value='{$itemi['questBRAVE']}' /> Success % Formula: <input type='text' name='questPERCFORM' value='{$itemi['questPERCFORM']}' /> Success Money: <input type='text' name='questSUCCESSMUNY' value='{$itemi['questSUCCESSMUNY']}' /> Success Crystals: <input type='text' name='questSUCCESSCRYS' value='{$itemi['questSUCCESSCRYS']}' /> Success Item: ".item2_dropdown($c, 'questSUCCESSITEM', $itemi['questSUCCESSITEM'])." Group: ".questgroup_dropdown($c,'questGROUP', $itemi['questGROUP'])." Initial Text: <textarea rows=4 cols=40 name='questITEXT' />{$itemi['questITEXT']}'</textarea> Success Text: <textarea rows=4 cols=40 name='questSTEXT' />{$itemi['questSTEXT']}</textarea> Failure Text: <textarea rows=4 cols=40 name='questFTEXT' />{$itemi['questFTEXT']} </textarea> quest XP Given: <input type='text' name='questXP' value='{$itemi['questXP']}' /> <input type='submit' value='Edit quest' /></form>"; } function edit_quest_sub() { global $ir,$c,$h,$userid, $db; $db->query("UPDATE quests SET questNAME='{$_POST['questNAME']}', questBRAVE='{$_POST['questBRAVE']}', questPERCFORM='{$_POST['questPERCFORM']}', questSUCCESSMUNY='{$_POST['questSUCCESSMUNY']}', questSUCCESSCRYS='{$_POST['questSUCCESSCRYS']}', questSUCCESSITEM='{$_POST['questSUCCESSITEM']}', questGROUP='{$_POST['questGROUP']}', questITEXT='{$_POST['questITEXT']}', questSTEXT='{$_POST['questSTEXT']}', questFTEXT='{$_POST['questFTEXT']}', questXP={$_POST['questXP']} WHERE questID={$_POST['questID']}"); print "quest edited..."; stafflog_add("Edited quest {$_POST['questNAME']}"); } function delquest() { global $ir,$c,$h,$userid, $db; switch ($_GET['step']) { default: echo "<h3>Deleting quest</h3> Here you can delete a quest. <form action='staff_quests.php?action=delquest&step=2' method='post'> quest: ".quest_dropdown($c,'quest')." <input type='submit' value='Delete quest' /></form>"; break; case 2: $target = $_POST['quest']; $d=$db->query("SELECT questNAME FROM quests WHERE questID='$target'"); $itemi=$db->fetch_row($d); print "<h3>Confirm</h3> Delete quest - ".$itemi["questNAME"]."? <form action='staff_quests.php?action=delquest&step=3' method='post'> <input type='hidden' name='questID' value='$target' /> <input type='submit' name='yesorno' value='Yes' /> <input type='submit' name='yesorno' value='No' onclick=\"window.location='staff_quests.php?action=delquest';\" /></form>"; break; case 3: $target = $_POST['questID']; if($_POST['yesorno']=='No') { die("quest not deleted. [url='staff_quests.php?action=delquest']>Back to main delete quests page.[/url]"); } if ($_POST['yesorno'] != ("No" || "Yes")) die('Eh'); $d=$db->query("SELECT questNAME FROM quests WHERE questID='$target'"); $itemi=$db->fetch_row($d); $db->query("DELETE FROM quests WHERE questID='$target'"); echo "quest {$itemi['questNAME']} Deleted. [url='staff_quests.php?action=delquest']>Back to main delete quests page.[/url]"; stafflog_add("Deleted quest {$itemi['questNAME']}"); break; } } function new_questgroup_form() { global $ir, $c,$db; print "Adding a new quest group. <form action='staff_quests.php?action=newquestgroupsub' method='post'> Name: <input type='text' name='cgNAME' /> Order Number: <input type='text' name='cgORDER' /> <input type='submit' value='Create quest Group' /></form>"; } function new_questgroup_submit() { global $ir,$c,$userid,$db; if(!isset($_POST['cgNAME']) || !isset($_POST['cgORDER'])) { print "You missed one or more of the required fields. Please go back and try again. [url='staff_quests.php?action=newquestgroup']> Back[/url]"; $h->endpage(); exit; } $db->query("INSERT INTO `questgroups` (`cgNAME`, `cgORDER`) VALUES('{$_POST['cgNAME']}','{$_POST['cgORDER']}')"); print "quest Group created!"; stafflog_add("Created quest Group {$_POST['cgNAME']}"); } function edit_questgroup_begin() { global $ir,$c,$h,$userid,$db; print "<h3>Editing A quest Group</h3> <form action='staff_quests.php?action=editquestgroupform' method='post'> quest Group: ".questgroup_dropdown($c,'questGROUP')." <input type='submit' value='Edit quest Group' /></form>"; } function edit_questgroup_form() { global $ir,$c,$h,$userid,$db; $d=$db->query("SELECT * FROM questgroups WHERE cgID={$_POST['questGROUP']}"); $itemi=$db->fetch_row($d); print "<h3>Editing quest Group</h3> <form action='staff_quests.php?action=editquestgroupsub' method='post'> <input type='hidden' name='cgID' value='{$_POST['questGROUP']}' /> Name: <input type='text' name='cgNAME' value='{$itemi['cgNAME']}' /> Order Number: <input type='text' name='cgORDER' value='{$itemi['cgORDER']}' /> <input type='submit' value='Edit quest Group' /></form>"; } function edit_questgroup_sub() { global $ir,$c,$h,$userid, $db; if(!isset($_POST['cgORDER']) || !isset($_POST['cgNAME'])) { print "You missed one or more of the required fields. Please go back and try again. [url='staff_quests.php?action=editquestgroup']> Back[/url]"; $h->endpage(); exit; } else { $db->query("UPDATE questgroups SET cgNAME='{$_POST['cgNAME']}', cgORDER='{$_POST['cgORDER']}' WHERE cgID='{$_POST['cgID']}'"); print "quest Group edited..."; stafflog_add("Edited quest Group {$_POST['cgNAME']}"); } } function delquestgroup() { global $ir,$c,$h,$userid, $db; switch ($_GET['step']) { default: echo "<h3>Deleting quest Group</h3> <script type='text/javascript'> function checkme() { if(document.theform.questGROUP.value==document.theform.questGROUP2.value) { alert('You cannot select the same quest group to move the quests to.'); return false; } return true; } </script> <form action='staff_quests.php?action=delquestgroup&step=2' method='post' name='theform' onsubmit='return checkme();'> quest Group: ".questgroup_dropdown($c,'questGROUP')." Move quests in deleted group to: ".questgroup_dropdown($c, 'questGROUP2')." <input type='submit' value='Delete quest Group' /></form>"; break; case 2: $target = $_POST['questGROUP']; $target2 = $_POST['questGROUP2']; if($target==$target2) { die("You cannot select the same quest group to move the quests to."); } $d=$db->query("SELECT cgNAME FROM questgroups WHERE cgID='$target'"); $itemi=$db->fetch_row($d); print "<h3>Confirm</h3> Delete quest group - ".$itemi["cgNAME"]."? <form action='staff_quests.php?action=delquestgroup&step=3' method='post'> <input type='hidden' name='cgID' value='$target' /> <input type='hidden' name='cgID2' value='$target2' /> <input type='submit' name='yesorno' value='Yes' /> <input type='submit' name='yesorno' value='No' onclick=\"window.location='staff_quests.php?action=delquestgroup';\" /></form>"; break; case 3: $target = $_POST['cgID']; $target2 = $_POST['cgID2']; if($_POST['yesorno']=='No') { die("quest Group not deleted."); } if ($_POST['yesorno'] != ("No" || "Yes")) die('This shouldnt happen'); $d=$db->query("SELECT cgNAME FROM questgroups WHERE cgID='$target'"); $itemi=$db->fetch_row($d); $db->query("DELETE FROM questgroups WHERE cgID='{$_POST['cgID']}'"); $db->query("UPDATE quests SET questGROUP={$target2} WHERE questGROUP={$target}"); stafflog_add("Deleted quest group {$itemi['cgNAME']}"); echo "quest Group deleted."; break; } } function reorder_questgroups() { global $db,$ir,$c,$h,$userid; if($_POST['submit']) { unset($_POST['submit']); $used=array(); foreach($_POST as $v) { if(in_array($v, $used)) { print "You have used the same order number twice! Go back and try again."; $h->endpage(); exit; } $used[]=$v; } foreach($_POST as $k => $v) { $cg=str_replace("order","", $k); if(is_numeric($cg)) { $db->query("UPDATE questgroups SET cgORDER={$v} WHERE cgID={$cg}"); } } print "quest group order updated!"; stafflog_add("Reordered quest groups"); } else { $q=$db->query("SELECT * FROM questgroups ORDER BY cgORDER ASC, cgID ASC"); $rows=$db->num_rows($q); $i=0; print "<h3>Re-ordering quest Groups</h3><hr /> <table width='80%' cellspacing='1' class='table'> <tr> <th>quest Group</th> <th>Order</th> </tr> <form action='staff_quests.php?action=reorder' method='post'> <input type='hidden' name='submit' value='1' />"; while($r=$db->fetch_row($q)) { $i++; print "<tr> <td>{$r['cgNAME']}</td> <td><select name='order{$r['cgID']}' type='dropdown'>"; for($j=1;$j<=$rows;$j++) { if($j == $i) { print "<option value='{$j}' selected='selected'>{$j}</option>"; } else { print "<option value='{$j}'>{$j}</option>"; } } print "</select></td></tr>"; } print "<tr> <td colspan='2' align='center'><input type='submit' value='Reorder' /></td> </tr></form></table>"; } } function report_clear() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] > 3) { die("403"); } $_GET['ID'] = abs((int) $_GET['ID']); stafflog_add("Cleared player report ID {$_GET['ID']}"); $db->query("DELETE FROM preports WHERE prID={$_GET['ID']}"); print "Report cleared and deleted! [url='staff_users.php?action=reportsview']> Back[/url]"; } $h->endpage(); ?> Here is what i added under smenu.php right below the crimes list <hr />[b]Quests[/b] > [url='staff_quests.php?action=newquest']Create New Quest[/url] > [url='staff_cquests.php?action=editquest']Edit Quest[/url] > [url='staff_quests.php?action=delquest']Delete Quest[/url] > [url='staff_quests.php?action=newquestgroup']Create New Quest Group[/url] > [url='staff_quests.php?action=editquestgroup']Edit Quest Group[/url] > [url='staff_quests.php?action=delquestgroup']Delete Quest Group[/url] > [url='staff_quests.php?action=reorder']Reorder Quest Groups[/url] And this is my quests.php file also based from crimes but slightly modified as ive taken jail time out of quests <?php $macropage="quest.php"; include "globals.php"; if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } $q2=$db->query("SELECT * FROM quest ORDER BY questBRAVE ASC"); while ($r2=$db->fetch_row($q2)) { $quests[]=$r2; } $q=$db->query("SELECT * FROM questgroups ORDER by cgORDER ASC"); print "[b]Quest Centre[/b] <table width='75%' cellspacing=1 class='table'><tr><th>quest</th><th>Cost</th><th>Do</th></tr>"; while($r=$db->fetch_row($q)) { print "<tr><td colspan='3' class='h'>{$r['cgNAME']}</td></tr>"; foreach($quests as $v) { if($v['questGROUP'] == $r['cgID']) { print "<tr><td>{$v['questNAME']}</td><td>{$v['questBRAVE']} Brave</td><td>[url='doquest.php?c={$v[']Do[/url]</td></tr>"; } } } print "</table>"; $h->endpage(); ?> for the mysql end i simply went through and created quests table and questgroups table the same as crimes was created minus the jailtime and all the jail stuff, the quest menu in the staffmenu is there and i can click on it but then i get this error - Fatal error: Call to undefined function questgroup_dropdown() in /home/reaction/public_html/ionicdestiny/staff_quests.php on line 36 -- How do i fix this, and if theres anything else im missing plz feel free to critisize lol this is just m yfirst attempt Quote
Danny696 Posted August 11, 2009 Posted August 11, 2009 Re: Some Questions and Ideas lettme check out the coding by just scrolling down to here i can see this erre > [url='staff_cquests.php?action=editquest']Edit Quest[/url] should be > [url='staff_quests.php?action=editquest']Edit Quest[/url] and in staff_quests.php it says //This contains course stuffs not good ;) For the error add these to global_func.php function quest_dropdown($connection,$ddname="quest",$selected=-1) { global $db; $ret="<select name='$ddname' type='dropdown'>"; $q=$db->query("SELECT * FROM quest ORDER BY questNAME ASC"); if($selected == -1) { $first=0; } else { $first=1; } while($r=$db->fetch_row($q)) { $ret.="\n<option value='{$r['questID']}'"; if ($selected == $r['questID'] || $first == 0) { $ret.=" selected='selected'";$first=1; } $ret.=">{$r['questNAME']}</option>"; } $ret.="\n</select>"; return $ret; } function questgroup_dropdown($connection,$ddname="questgroup",$selected=-1) { global $db; $ret="<select name='$ddname' type='dropdown'>"; $q=$db->query("SELECT * FROM questgroups ORDER BY qgNAME ASC"); if($selected == -1) { $first=0; } else { $first=1; } while($r=$db->fetch_row($q)) { $ret.="\n<option value='{$r['qgID']}'"; if ($selected == $r['qgID'] || $first == 0) { $ret.=" selected='selected'";$first=1; } $ret.=">{$r['qgNAME']}</option>"; } $ret.="\n</select>"; return $ret; } You may need to change some of it to fit your database Quote
Reaction Posted August 12, 2009 Author Posted August 12, 2009 Re: Some Questions and Ideas Thank you for the help i did it real quick before i left for work, after comming back i had a chance to read over it and found a bunch of small errors that i was able to fix and its now up and running! -- should i post again under something titled "quest mod" or is it so easy to do that everyone probably already knows it? haha Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.