Danny696 Posted July 19, 2010 Share Posted July 19, 2010 Looking good, Two things tho $fia = (int) mt_rand(1,99); rand() and mt_rand() will always give an int. And rand(), i belive i have read, is better for dealing with small numbers, thereofre faster. :) Quote Link to comment Share on other sites More sharing options...
Agon Posted July 20, 2010 Share Posted July 20, 2010 Thanks for the tip Danny. Ok, I got a math question here. If were trying to get two random numbers between 1 and 99 to match, is that a 1 in 9801 chance? Quote Link to comment Share on other sites More sharing options...
Agon Posted July 20, 2010 Share Posted July 20, 2010 Er nevermind. Got it figured out. LOL. Quote Link to comment Share on other sites More sharing options...
r14170 Posted July 22, 2010 Share Posted July 22, 2010 how about making 1/10000 chance for getting an random item (sorry im new at scripting ^_^) Quote Link to comment Share on other sites More sharing options...
sniko Posted July 22, 2010 Share Posted July 22, 2010 $bla = rand(1,10000) { if($bla <= 2) { //find item } else { } Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 26, 2011 Share Posted October 26, 2011 how do you workout the chances can someone explain to me please what makes it easier and what makes it harder Quote Link to comment Share on other sites More sharing options...
gurpreet Posted October 26, 2011 Share Posted October 26, 2011 $fia=(int) rand(10,99); $fib=(int) rand(10,99); I think this is right, correct me if I'm wrong, but the chance of finding an item is 89 * 89. So users have a 1 in 7921 chance. If you want to make it easier, make the gap smaller, if you want them to have less of a chance, increase the gap between the numbers. Simple Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted October 26, 2011 Share Posted October 26, 2011 okay thankyou gurpreet :) Quote Link to comment Share on other sites More sharing options...
Oracle Posted November 8, 2011 Share Posted November 8, 2011 RE: :D Very Awesome my testers absolutely love this, I have edited it a bit so that there is only 2 very important items in the game, and I only use this on Random Fridays! Great Work ! Thank you ! :cool: Quote Link to comment Share on other sites More sharing options...
boots Posted December 22, 2011 Share Posted December 22, 2011 Sounds like a great mod gonna try it :) Oracle love your idea with the random Fridays would you share your edited code ? Iam new and still learning not good with coding:( yet! lol Quote Link to comment Share on other sites More sharing options...
Oracle Posted October 26, 2012 Share Posted October 26, 2012 I know this thread is about a year. but yes Here is the code. //-- Finding items query $fia=(int) rand(1,2); $fib=(int) rand(2,3); if($fia == $fib) { $iq=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1",$c); $r=$db->fetch_row($iq); $item=$r['itmid']; $userid=$ir['userid']; $db->query("INSERT INTO inventory VALUES ('', $item, $userid, 1)",$c); event_add($userid,"While passing through (INSERT NAME OF YOUR GAME HERE) You Found A {$r['itmname']} HAPPY FRIDAY!.",$c); } This should work Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted October 26, 2012 Share Posted October 26, 2012 I know this thread is about a year. but yes Here is the code. //-- Finding items query $fia=(int) rand(1,2); $fib=(int) rand(2,3); if($fia == $fib) { $iq=$db->query("SELECT * FROM items WHERE itmbuyable=1 ORDER BY rand() LIMIT 1",$c); $r=$db->fetch_row($iq); $item=$r['itmid']; $userid=$ir['userid']; $db->query("INSERT INTO inventory VALUES ('', $item, $userid, 1)",$c); event_add($userid,"While passing through (INSERT NAME OF YOUR GAME HERE) You Found A {$r['itmname']} HAPPY FRIDAY!.",$c); } This should work You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Do something like that if you want it to be on a certain day 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.