Jump to content
MakeWebGames

Recommended Posts

Posted

Hi, I have searched the forums all over and I cant seem to find a mod that makes items in the shops.php have a set quantity which is reset every few minutes. So I was wondering if maybe someone has a mod like that and wouldn't mind sharing it with me?

Posted

Re: Shops Item Quantity?

I want each item in my shops to have a quantity. And if its sold out of that quantity for each item no one can buy it until after a few min when the quantity for items are reset. It helps bring a balance to the amount of items in circulation.

Posted

Re: Shops Item Quantity?

Oh ok. Nice idea. ? steps to do it;

1. Add 2 fields to the shop items table, defaultQTY and also add QTY.

2. Edit the shops to work arrround this; buying would need to take the buy qty from the shop item.

3. add a cron to reset the QTY to default QTY.

Posted

Re: Shops Item Quantity?

 

Oh ok. Nice idea. ? steps to do it;

1. Add 2 fields to the shop items table, defaultQTY and also add QTY.

2. Edit the shops to work arrround this; buying would need to take the buy qty from the shop item.

3. add a cron to reset the QTY to default QTY.

I know this is wrong but here's my best attempt.

SQL queries

 

ALTER TABLE 'shops' ADD 'defaultQTY' (int)11 NOT NULL default(50);

 

ALTER TABLE 'shops' ADD 'QTY' (int)11 NOT NULL;

 

2) Can't do yet.

3) For Cron_hour.php

 

$db->query("UPDATE shops SET QTY = QTY =>defaultQTY ");

 

Query is totally wrong but yea, the QTY= QTY=> is supposed to mean set the current QTY to the defaultQTY. Didn't know about the last bit.

Posted

Re: Shops Item Quantity?

 

3. add a cron to reset the QTY to default QTY.

Why do that?

Maybe start off like 500 defaultQTY

why not use a rand() like:

$QuantRand = rand(100, 250);
$AddQuant = sprintf("UPDATE `shops` SET `QTY` = ('%u')" ,$QuantRand);
$db->query ($AddQuant);

 

Reason Why? Then you don't have a definite QTY that comes back. Personally add it to something which would suit your games economy..

Posted

Re: Shops Item Quantity?

 

3. add a cron to reset the QTY to default QTY.

Why do that?

Maybe start off like 500 defaultQTY

why not use a rand() like:

$QuantRand = rand(100, 250);
$AddQuant = sprintf("UPDATE `shops` SET `QTY` = ('%u')");
$db->query ($AddQuant);

 

Reason Why? Then you don't have a definite QTY that comes back. Personally add it to something which would suit your games economy..

If you think about it, in real life, shops get a certain amount of stock every certain amount of days, so for mine when it's done, it would get say 100 of each item every 3 or 4 days.

Also what does the %u do?

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