Jump to content
MakeWebGames

Shops Item Quantity?


josh_boss102
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

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.

 Share

×
×
  • Create New...