joker313 Posted October 23, 2009 Share Posted October 23, 2009 Sorry if this is in the wrong post Anyone know where i can find a mod where random amounts of crystals are added to crystal market I thought i seen that some where before just cant rember where Thanks Joker Quote Link to comment Share on other sites More sharing options...
seanybob Posted October 23, 2009 Share Posted October 23, 2009 Got a five minute cron file? If so, just add some code to it. Look in your crystal market file, the code where somebody adds crystals to the market. It's something like 'Insert into cmarket', or something like that. Take that code. Change the userid of owner to 1 or whatever, and for amount of crystals instead of using an input from the user just use the php rand function. If you wish to learn it, try to stumble through the guidelines I just posted. Or... you can wait till someone else does it for you. Quote Link to comment Share on other sites More sharing options...
joker313 Posted October 23, 2009 Author Share Posted October 23, 2009 any tips on where to read up on learning Is there any php guide to understanding the scripts or coding for these type of games Quote Link to comment Share on other sites More sharing options...
gurpreet Posted October 23, 2009 Share Posted October 23, 2009 Simple code would be needed, something like: $crystalrand = mt_rand(1,10); $tp = $crystalrand * $_POST['price']; $CreateListing = sprintf("INSERT INTO crystalmarket VALUES ('', %u, %u, %u)", $crystalrand, 1, $tp); That might not work, but it's worth a try.. Quote Link to comment Share on other sites More sharing options...
Gucci Mane Posted October 23, 2009 Share Posted October 23, 2009 You could possibly learn php at w3schools.org or php.net Quote Link to comment Share on other sites More sharing options...
Joshua Posted October 24, 2009 Share Posted October 24, 2009 what about Just insert it into the 5 minute cron, takes all of 5 minutes =P db query the cmarket to update with points have to find the exact call to the cmarket listing as i dno it off top of my head lemme go look. EDIT: K, that didnt work, let me mess with it a few mins :p Quote Link to comment Share on other sites More sharing options...
Joshua Posted October 24, 2009 Share Posted October 24, 2009 OK, JUST FOR YOU ;) I got it working. I tested this on my Minute Cron. Insert right under $c=$db->connection_id; $rand=rand(1,5); $price=$rand*5000; The $rand is selecting a number between 1-5 and the Multiplier is Price. So if you want them to be cheaper, or more expensive alter these. 5*5000 = 25000 per POINT so that's 125k for 5 points. To alter that Change up the Rand integers or just lower the *5000 Multiplier. Now, In your $db->queries Insert this somewhere $db->query("INSERT INTO crystalmarket VALUES('', $rand, 1, $price)"); And you're done, DAMN i finally learn to code and there's not +1's ;P Quote Link to comment Share on other sites More sharing options...
gurpreet Posted October 24, 2009 Share Posted October 24, 2009 OK, JUST FOR YOU ;) I got it working. I tested this on my Minute Cron. Insert right under $c=$db->connection_id; $rand=rand(1,5); $price=$rand*5000; The $rand is selecting a number between 1-5 and the Multiplier is Price. So if you want them to be cheaper, or more expensive alter these. 5*5000 = 25000 per POINT so that's 125k for 5 points. To alter that Change up the Rand integers or just lower the *5000 Multiplier. Now, In your $db->queries Insert this somewhere $db->query("INSERT INTO crystalmarket VALUES('', 5, 1, 5000)"); And you're done, DAMN i finally learn to code and there's not +1's ;P Your cmarket query is wrong. Shouldn't it be this? $db->query("INSERT INTO crystalmarket VALUES('', $rand, 1, 5000)"); Not sure about the 5000, maybe it should be $price. Also try to use mt_rand. Quote Link to comment Share on other sites More sharing options...
Joshua Posted October 24, 2009 Share Posted October 24, 2009 gurpreet I tried it on my game 4 him, it worked 100% :P Why mt_rand ? what's wrong with rand :O Quote Link to comment Share on other sites More sharing options...
Joshua Posted October 24, 2009 Share Posted October 24, 2009 oops i madea booboo on postign hah. it should be $db->query("INSERT INTO crystalmarket VALUES('', $rand, 1, $price)"); Quote Link to comment Share on other sites More sharing options...
Danny696 Posted October 24, 2009 Share Posted October 24, 2009 Why mt_rand ? what's wrong with rand :OMt_rand is faster than rand Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted October 24, 2009 Share Posted October 24, 2009 Danny: http://portfolio.technoized.com/notes/21 Honestly from my own tests I didn't saw much difference between the two neither from a quality point of view neither from a speed point of view. So choose one or the other and it will work. Quote Link to comment Share on other sites More sharing options...
Joshua Posted October 24, 2009 Share Posted October 24, 2009 Ok, Updated my original Post THAT will work for sure :-) Got ahead of myself and workin on 3 diff mods at once i tend to have a few typos..WHICH only makes things take EVEN longer ;) Enjoy Quote Link to comment Share on other sites More sharing options...
Danny696 Posted October 24, 2009 Share Posted October 24, 2009 Thanks for that a_bertrand, im 10 years behind haha :P Quote Link to comment Share on other sites More sharing options...
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.