Jump to content
MakeWebGames

shaved92bravada

Members
  • Posts

    234
  • Joined

  • Last visited

Everything posted by shaved92bravada

  1. Re: template engine   :roll:
  2. Re: Staff Functions!   I am actually working on a better smenu.php layout as we speak lol its a vertical css dropdown menu... makes it a whole lot better than the original one. I will prolly post it when I get done with it..
  3. Re: Another problem need help with that worked like a charm.... thank you so very very very much.... +1 for you...
  4. Re: Another problem need help with still no luck as of yet.... I am gonna keep workin on it and see if I can figure out what the problem is.... I know I can get it to work by running a seperate query for each item but then that wouldn't be efficient would it lol... Thanks for all the help so far and all the help to hopefully swing my way....
  5. Re: Another problem need help with ok well apparently my query isn't working correctly because I don't have the required items in my inventory and it is letting me go onto the next step...... so any help on what I am doing wrong would be greatly appreciated..... I have been working on this mod for about a month now and decided to go ahead and get this step out of the way before I tried to progress any further...... below is the following query which doesn't give any errors, it just doesn't work correctly I guess....   $checkitems = sprintf ( "SELECT COUNT(`inv_id`) FROM inventory WHERE `inv_itemid` IN (%s) AND `inv_userid` = '%u'", $items, abs(@intval($userid)) ); $items = $db->query($checkitems);
  6. Re: [mccode v2] Better Crystal Temple! actually killah is not just saying that the script is insecure he is saying that he could go to his game and find an exploit to get lots of money / crystals...... then after he gets lots of money / crystals then go to the temple and exchange those crystals for stats and be number 1 very quickly lol...... just thought I would point that out... and no my head isn't up his ass either just wanted to straighten that out...
  7. Re: Another problem need help with yeah it makes perfect sense and tyvm for explaining it. The task at hand is to make it where if the player doesn't have items ( id x, id x, id x, id x ) in their inventory then they cannot move forward until they have the required items in their inventory...... so wouldn't if(!$db->num_rows($items)) { echo ' you have to have blah blah to blah blah '; } is that correct or how to I tell it that if they don't have those they cannot move on??
  8. I need to know what I am doing wrong here....   $items=('61,62,63,64'); $checkitems = sprintf ( "SELECT COUNT(`inv_id`) FROM inventory WHERE ((`inv_itemid` IN ('%s') AND (`inv_userid` = '%u'))", $items, abs(@intval($userid)) ); $items = $db->query($checkitems);   QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Query was SELECT COUNT(`inv_id`) FROM inventory WHERE ((`inv_itemid` IN ('61,62,63,64') AND (`inv_userid` = '1'))
  9. Re: [mccode v2] Fishing Mod good things come to those that wait......
  10. Re: [mccode v2] Very simple travel time mod. here is an updated version..... should be a little more secure ( not for certain just been learning a few things ) not sure how unsecure the other one was lol. But anyway it fully works, I just tested everything about 10 times....   <?php /** * Travel Time / Travel Type Mod * Made by Shaved92Bravada * This is a free mod for the members of CE * This is not to be sold... I recognize my crappy work lol * @copyright 2008 */ include "globals.php"; include "travellingglobals.php"; switch($_GET['action']) { case "pickcity": pickcity(); break; case "travel": travel(); break; default: index(); break; } function index() { global $db, $ir, $c, $h, $set, $userid; echo '<h2>Welcome to the '.$set['game_name'].' Travel Center. How would you like to travel today?</h2> <table width="90%" class="table"><tr><th colspan="3">Choose your preferred method of travel from the options below. Please be aware that different modes of travel have different costs and the travel times will vary.</th></tr> <th>Plane</th><th>Train</th><th>Automobile</th> <tr> <td><image src="/images/jet.jpg" width="180" height="150"></td> <td><image src="/images/train.jpg" width="180" height="150"></td> <td><image src="/images/car.jpg" width="180" height="150"></td> </tr> <tr><form action="travel.php?action=pickcity" method="post"> <td><input type="radio" name="traveltype" value="Plane" /> Travel By Plane </td> <td><input type="radio" name="traveltype" value="Train" /> Travel By Train </td> <td><input type="radio" name="traveltype" value="Automobile" /> Travel By Automobile </td> </tr> <tr><td colspan="3"><input type="submit" value="Pick City" /> </table>'; } function pickcity() { $traveltype = htmlentities(mysql_real_escape_string($_POST['traveltype'])); global $db, $ir, $c, $h, $userid; if(!$traveltype) { echo '<h2>ERROR</h2> You must choose a travel type. <a href=travel.php>> Back</a>'; $h->endpage(); exit; } else if(!$_GET['to']) { $city = sprintf ( "SELECT * FROM cities WHERE cityid = '%u' ", abs(@intval($ir['location'])) ); $c = $db->query($city); $r = $db->fetch_row($c); $cost=3000; $type=($_POST['traveltype']); if ($traveltype == Plane) { $rantime=($r['citytravtime']); $cost=$cost*8; $go=fly; //since the travel type is by plane then the cost would be higher but the travel time would be less significant. } else if ($traveltype == Train) { $rantime=($r['citytravtime']*2); $cost=$cost*5; $go=ride; //since the travel type is by train then the cost would be less but the travel time would be a little longer. } else if ($traveltype == Automobile) { $rantime=($r['citytravtime']*4); $cost=$cost; $go=drive; //since the travel type is by car then the cost would be normal cost but the travel time would be even greater than the other types. } $check = sprintf ( "SELECT * FROM cities WHERE cityid != '%u' AND cityminlevel <= '%u' ", abs(@intval($ir['location'])), abs(@intval($ir['level'])) ); $citycheck = $db->query($check); echo ' <h3>You have chosen to travel by '.$traveltype.'. It is going to cost you $'.$cost.'. Where would you like to '.$go.' today?</h3> <table width="90%" cellspacing="1" class="table"><tr><th>City</th><th>Description</th><th>Min Level</th><th>Max Level</th><th>Travel Time</th><th>Travel</th></tr>'; while($r=$db->fetch_row($citycheck)) { echo ' <tr> <td>'.$r['cityname'].'</td> <td>'.$r['citydesc'].'</td> <td>'.$r['cityminlevel'].'</td> <td>'.$r['citymaxlevel'].'</td> <td>'.$rantime.' Min</td> <td>[url="travel.php?action=travel&to='.$r['cityid'].'&type='.$type.'"]Go[/url]</td></tr>'; } echo '</table>'; } } function travel() { global $db, $ir, $c, $h, $userid; $_GET['to'] = abs((int) $_GET['to']); $_GET['type'] = htmlentities(mysql_real_escape_string($_GET['type'])); $cost = abs((int) $cost); if($ir['money'] < $cost) { echo '<h2>ERROR</h2> Ummmmmmmmmmmmm, You dont have enough money.'; $h->endpage(); exit; } else if( ((int) $_GET['to']) != $_GET['to']) { echo '<h2>ERROR</h2> Just where in the hell are you trying to go??'; $h->endpage(); exit; } else { $check2 = sprintf ( "SELECT * FROM cities WHERE cityid = '%u' AND cityminlevel <= '%u' AND citymaxlevel >= '%u' ", abs(@intval($ir['location'])), abs(@intval($ir['level'])), abs(@intval($ir['level'])) ); $citycheck2 = $db->query($check2); if(!$db->num_rows($citycheck2)) { echo '<h2>ERROR</h2> Either the city you selected does not exist or you cannot go there. Do pass go do not collect $200.....'; } else { $r=$db->fetch_row($q); $cost=3000; $type=($_GET['type']); if ($_GET['type'] == Plane) { $rantime=($r['citytravtime']); $tcost=$cost*8; //since the travel type is by plane then the cost would be higher but the travel time would be less significant. } else if ($_GET['type'] == Train) { $rantime=($r['citytravtime']*2); $tcost=$cost*5; //since the travel type is by train then the cost would be less but the travel time would be a little longer. } else if ($_GET['type'] == Automobile) { $rantime=($r['citytravtime']*4); $tcost=$cost; //since the travel type is by car then the cost would be normal cost but the travel time would be even greater than the other types. } $travel = sprintf ( "UPDATE users SET `money` = `money` - '%d' , `location` = '%d' , `traveltime` = '%d' WHERE `userid` = '%u' ", abs(@intval($tcost)), abs(@intval($_GET['to'])), abs(@intval($rantime)), abs(@intval($userid)) ); $send = $db->query($travel); echo '<h2>Congratulations</h2> Congratulations, you paid '.$tcost.' and are now travelling to '.$r['cityname'].'! It will take '.$rantime.' minutes to arrive.'; } } } $h->endpage(); ?>
  11. Re: Have any mod ideas post here!   I would so pay for that mod lolol
  12. Re: [mccode v2] Advanced Robbery or you could try it out and see what the errors are and try and fix them.... or post them asking for help. He did say that you can create the places to rob but can't rob them....
  13. Re: [mccode v1] Punch Mod I never said you had to post anything positive all I am getting at is that 9/10ths of the post now a days are negative. I knew he just edited the hack pc..... but when I see stupid shit like that I just keep it to myself lol. Not trying to start an argument or anything just tired of all the negativity..... and as for my header lol.... you don't actually think I am using it on my game do you?? I am just tired of seeing the same ole basic mccode look on every game so if they all want to look the same why not let them look atleast a little better lol.
  14. Re: [mccode v1] Punch Mod   Apparently not since all I have seen so far is negative posts from you about mods that people make.... I haven't searched yet but just how many of the mods on CE are contributed by you?? People like you are the reason I am not gonna post the usershops I am almost done making on here. Because if there is something wrong or you just don't like it you have to bitch about it..... if you don't like it so what you don't have to use it...... you don't even have to say anything just move on to the next mod but you have to post something stupid like another useless mod.... so what if it is atleast the person posting it is trying......
  15. Re: How to use sprintf?   apparently that was correct because it worked lol.... if there is a better way to do it just tell me but that worked which is great.....
  16. Re: How to use sprintf? another quick question how would I do this mysql_query("insert into usershops values('','$userid','1','{$_POST['location']}','{$_POST['name']}','{$_POST['description']}','0')",$c) or die(mysql_error()); in sprintf ?? I know its probably simple but I am still learning everything.... Thanks in advance would this be correct??   $buyshop = sprintf ( "INSERT INTO `usershops` values ('' , ('%u') , '1' , ('%d'), ('%s') , ('%s'), '0' )", abs(@intval($userid)), abs(@intval($_POST['sl'])), mysql_real_escape_string($_POST['shopname']), mysql_real_escape_string($_POST['description']) ); $db->query($buyshop);
  17. Re: How to use sprintf? got a quick question.... do I still need to do this abs(@intval($_POST['amount'])) if I have already done this $_POST['amount']=abs((int) $_POST['amount']); would it hurt anything to do it twice?? That is for the withdrawl function on my usershops mod I am making so i want to make sure its secure....
  18. Re: How to use sprintf? So would it be wise if I went through every single page of my game ( V2 ) and pretty well recontructed the whole game using sprintf ...etc etc.... I am thinking yes after finally figuring out how it works.
  19. Re: How to use sprintf? lol actually that i'm not for certain I just know from looking at examples that the way you place them in the query is how you would place them afterwards... I will show you an example of one I just did. This is the one that Luke helped me out on....   $changeinfo = sprintf ( "UPDATE `usershops` SET `location` = ('%d'), `shopname` = ('%s'), `shopdescription` = ('%s') WHERE `userid` = ('%u')", $_POST['sl'], $_POST['shopname'], $_POST['description'], $userid ); $db->query($changeinfo);   Notice how I am updating location first using ('%d') "%d = Signed decimal number" Then I am updating shopname with ('%s') and then shopdescription also with ('%s'). "%s = String". they are all in order and then ('%d') will output $_POST['sl'] and the first ('%s') would output $_POST['shopname'] and the second ('%s') would output $_POST['description']. I don't know if that helps you any but thats about the best way I know how to explain it.
  20. Re: How to use sprintf? http://www.w3schools.com/PHP/func_string_sprintf.asp thats where I started first of all.... trust me it does help. I do mine like this now lol Thanks Luke   $userupdate = sprintf ( "UPDATE `users` SET `example` = `example` + ('%d') WHERE `userid` = ('%u')", 1 , $userid ); mysql_query($userupdate);   I'm not sure if it helps by doing it the way I did and then placing the 1 afterwards but I keep doing it that way so that I can get used to everything..... but definately check out that link 03laceys that is where I started at last night and I have evolved to programming a whole mod using sprintf.
  21. Re: can someone tell me what I am doing wrong here   Yeah I plan on going back through and making everything legible for others to read. etc. I have been wanting usershops for awhile so I am using examples from the regular shops, itembuy, etc and making my own. Once I get it done I am thinking of having ya'll look over it privately and see what else I can do to secure it better, etc. I have figured out that the only way I am gonna learn is to try it.   I knew it was gonna be something simple like that.... but now that I know what to do it shall make it easier the next time.
  22. Re: can someone tell me what I am doing wrong here worked like a charm Luke.... thank you very much. I will take this and learn from it. Atleast I know I have people here that will help me. Thanks to you too alabama... I told you I would tackle sprintf soon enough lol.
  23. Re: can someone tell me what I am doing wrong here still getting the same error... it has something to do with the location I am just not sure what but if I dont need the () around the `%u` then that will save two extra keystrokes lol. anyway the location field in the table is int (11) just like normal I just can't figure out why it is saying unknown field and then the location # when it should just update the location to that number..... any more help will be appreciated. I am attempting to make my own usershops mod if your wondering lol.
  24. $changeinfo = sprintf("UPDATE `usershops` SET `location` = `%d` , `shopname` = '%s', `shopdescription` = '%s' WHERE `userid` = ('%u')",$_POST['sl'], $_POST['shopname'],$_POST['description'], $userid); $db->query($changeinfo);   I am getting this error QUERY ERROR: Unknown column '1' in 'field list' Query was UPDATE `usershops` SET `location` = `1` , `shopname` = 'Testing ', `shopdescription` = 'Testing functions still' WHERE `userid` = ('1') I am still trying to get used to using sprintf so if I am doing something that I shouldn't be point me in the right direction please.
  25. Re: [mccode v2] Player of the week... yeah that would probably work alot better that way of doing it. Didn't think of it that way lol. still learning some things.
×
×
  • Create New...