EOSERV Forum > EO Server Building > A Shop Script on website
Page: << 1 >>
A Shop Script on website
Author Message
Post #198517 A Shop Script on website

Does anyone know how to make such script, where players can buy a certain item ( assuming that they have vote points for every voting site they vote on )  

on the shop. and automatically generates that item into their inventory ?

8 years, 30 weeks ago
Post #198518 Re: A Shop Script on website

You can make it with php, just have it interact with the eoserv database

---
stay tuned.
8 years, 30 weeks ago
Post #198519 Re: A Shop Script on website

You're going to want to utilize PHP for this.

Upon processing the votes, search for the unique ID in a separate db table and increment their vote count.  If you're planning on giving multiple vote points per vote, you can just use simple math in php.  Make sure your only allowing 1 vote per user account or IP ( still ways around this).

For the store, you can create a store database with the listed items that they can buy with a price (votes required) with an incremented ID which will be unique to each item.

In PHP loop through each line to display the items and their prices with a buy button that sends you to lets say process_purchase.php?id=4

on the process_purchase.php page, this is where you would check ID 4 in the item db to ensure it's correct, to check the item price, and to check the accounts current vote count.

Upon validating that the user has the amount of vote points available, and everything else above, you can then remove the amount of points from that users account then connect to your EO db using MYSQL, and add the database value into that characters character inventory.

This is just a basic run down off the top of my head, id probably change things as i go.  However PHP is definitely what you'll have to use.

I don't think anyone would code it for you though considering it's not just a few lines of code.

Cheers

8 years, 30 weeks ago
Post #198520 Re: A Shop Script on website
perfect posted: (19th Oct 2015, 03:57 am)

You're going to want to utilize PHP for this.

Upon processing the votes, search for the unique ID in a separate db table and increment their vote count.  If you're planning on giving multiple vote points per vote, you can just use simple math in php.  Make sure your only allowing 1 vote per user account or IP ( still ways around this).

For the store, you can create a store database with the listed items that they can buy with a price (votes required) with an incremented ID which will be unique to each item.

In PHP loop through each line to display the items and their prices with a buy button that sends you to lets say process_purchase.php?id=4

on the process_purchase.php page, this is where you would check ID 4 in the item db to ensure it's correct, to check the item price, and to check the accounts current vote count.

Upon validating that the user has the amount of vote points available, and everything else above, you can then remove the amount of points from that users account then connect to your EO db using MYSQL, and add the database value into that characters character inventory.

This is just a basic run down off the top of my head, id probably change things as i go.  However PHP is definitely what you'll have to use.

I don't think anyone would code it for you though considering it's not just a few lines of code.

Cheers


I could hire someone who could code. idk who tho.
8 years, 30 weeks ago
Post #198521 Re: A Shop Script on website
wesly posted: (19th Oct 2015, 04:08 am)

perfect posted: (19th Oct 2015, 03:57 am)

You're going to want to utilize PHP for this.

Upon processing the votes, search for the unique ID in a separate db table and increment their vote count.  If you're planning on giving multiple vote points per vote, you can just use simple math in php.  Make sure your only allowing 1 vote per user account or IP ( still ways around this).

For the store, you can create a store database with the listed items that they can buy with a price (votes required) with an incremented ID which will be unique to each item.

In PHP loop through each line to display the items and their prices with a buy button that sends you to lets say process_purchase.php?id=4

on the process_purchase.php page, this is where you would check ID 4 in the item db to ensure it's correct, to check the item price, and to check the accounts current vote count.

Upon validating that the user has the amount of vote points available, and everything else above, you can then remove the amount of points from that users account then connect to your EO db using MYSQL, and add the database value into that characters character inventory.

This is just a basic run down off the top of my head, id probably change things as i go.  However PHP is definitely what you'll have to use.

I don't think anyone would code it for you though considering it's not just a few lines of code.

Cheers


I could hire someone who could code. idk who tho.

You could code it with basic php knowledge, just learn some php and you'll save a lot of money and it's a good skill to have
---
stay tuned.
8 years, 30 weeks ago
Post #198522 Re: A Shop Script on website
andrewbob1 posted: (19th Oct 2015, 04:09 am)

wesly posted: (19th Oct 2015, 04:08 am)

perfect posted: (19th Oct 2015, 03:57 am)

You're going to want to utilize PHP for this.

Upon processing the votes, search for the unique ID in a separate db table and increment their vote count.  If you're planning on giving multiple vote points per vote, you can just use simple math in php.  Make sure your only allowing 1 vote per user account or IP ( still ways around this).

For the store, you can create a store database with the listed items that they can buy with a price (votes required) with an incremented ID which will be unique to each item.

In PHP loop through each line to display the items and their prices with a buy button that sends you to lets say process_purchase.php?id=4

on the process_purchase.php page, this is where you would check ID 4 in the item db to ensure it's correct, to check the item price, and to check the accounts current vote count.

Upon validating that the user has the amount of vote points available, and everything else above, you can then remove the amount of points from that users account then connect to your EO db using MYSQL, and add the database value into that characters character inventory.

This is just a basic run down off the top of my head, id probably change things as i go.  However PHP is definitely what you'll have to use.

I don't think anyone would code it for you though considering it's not just a few lines of code.

Cheers


I could hire someone who could code. idk who tho.

You could code it with basic php knowledge, just learn some php and you'll save a lot of money and it's a good skill to have

okay got it. 
8 years, 30 weeks ago
Post #198523 Re: A Shop Script on website

Yeah what Andrew said.

Also considering I'm assuming it'll be you're first time coding in PHP, consider taking your time, and coding in small steps.  Code a small part of it, test it.  The last thing you want is someone finding an exploit, then having them utilize that exploit to cheat or get the edge off of other players or some how gain access to your EO database even if does encrypt your passwords.  But don't let that discourage you at all!!

W3Schools - PHP 5 tutorial

W3Schools - PHP 5 mysql functions etc

Also consider looking into HTML/CSS as you'll need a front-end theme for your users as PHP is server sided and does most of it's things behind the scene.

8 years, 30 weeks ago
Post #198524 Re: A Shop Script on website

^

---
stay tuned.
8 years, 30 weeks ago
Post #198525 Re: A Shop Script on website
perfect posted: (19th Oct 2015, 04:24 am)

Yeah what Andrew said.

Also considering I'm assuming it'll be you're first time coding in PHP, consider taking your time, and coding in small steps.  Code a small part of it, test it.  The last thing you want is someone finding an exploit, then having them utilize that exploit to cheat or get the edge off of other players or some how gain access to your EO database even if does encrypt your passwords.  But don't let that discourage you at all!!

W3Schools - PHP 5 tutorial

W3Schools - PHP 5 mysql functions etc

Also consider looking into HTML/CSS as you'll need a front-end theme for your users as PHP is server sided and does most of it's things behind the scene.


there's no problem with HTML and the Stylesheets xD  Thanks for the links btw
8 years, 30 weeks ago
Post #198526 Re: A Shop Script on website

Whatever you do, don't go editing the character's inventory directly. Even if you tell them to log out first, with the delayed database saving the item might not end up in their inventory, and you'll have no way to tell if it did or not.

The safe way to do it would be to have a table of unclaimed rewards that the website can insert records in to, and the game server can read to let the players claim the items from some NPC.

You also don't have to worry about adjusting item counts if the player already has the item you're trying to give them, items not being seen because the inventory is full, etc.

8 years, 30 weeks ago
Post #199483 Re: A Shop Script on website

I'm actually in the process of making this (As well as making a new webcp theme) for public release.

I figured, after reading Sausage's post, it could be more than possible via the EOPlus quest system.  Add a function that would check the database and if an item(s) is found continue to recieve item(s) otherwise call the quest reset function.  I'm unsure if that would be the most ethical way to do this; so, enlighten me, o lord Sausage <3.


EDIT: heres a screenshot of the webcp theme that's already done lol, i also have half of the shop done; but requires you to have .gifs of all the inventory icons of items.



EDIT 2: forgot EOServ != EOSource when I made this lol.. forgive me, the theme was made while I was running my old server; only did more extensive PHP to it recently.

EDIT 3: I ALSO FORGOT THE "shop" IS AN OFF-SERVER MARKET USING BANKED GOLD AND WOULD REQUIRE AN EDIT TO YOUR Bank.cpp FILE

8 years, 14 weeks ago
Post #199484 Re: A Shop Script on website

I wouldn't use Bank.cpp as a method of updating. A super-simple way to handle real money shops is to have a new table complete with transaction ID, username, character purchased for, item(s) purchased, and a flag for "redeemed". You could plug this into a quest #0 function which would evaluate the purchases table when a character logs in. If not that method, something similar at character login to check the seperate table. 

8 years, 14 weeks ago
Post #199498 Re: A Shop Script on website

I didn't think about modifying character login; that seems a bit easier than what I have now.  Also; it isn't a real money shop, all I did was add a check for unclaimed gold when you open a bank npc.  I suppose this would be grounds to add the option for "real money" shop too..

8 years, 13 weeks ago
Page: << 1 >>

EOSERV Forum > EO Server Building > A Shop Script on website