Jump to content
MakeWebGames

Any one know of a mod that auto adds crystals to the crystal market like evey 5 mins


Recommended Posts

Posted

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

Posted

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.

Posted

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..

Posted

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

Posted

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

Posted
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.

Posted

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

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...