Jump to content
MakeWebGames

[mccodes v2] Find random items while playing the game...


MDK666

Recommended Posts

  • 1 year later...

$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

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 10 months later...

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...