Buy furniture on the site?

Baloe20xd

Member
Feb 26, 2016
55
7
Hi

I intend to build a system on the site that you can buy on 1 page of furniture which you then get in the client with your items.

But now my question was how do I make something like that with query.
Because I already have a system for diamonds.

Who can help me with that? :)

Thanks in advance.
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
Hi

I intend to build a system on the site that you can buy on 1 page of furniture which you then get in the client with your items.

But now my question was how do I make something like that with query.
Because I already have a system for diamonds.

Who can help me with that? :)

Thanks in advance.
Just make a query to insert an item into that user ID’s inventory when they buy it. The only problem I see with this is that you’d have to be offline to use it properly.
Post automatically merged:

At least I think you would, unless it updates in real time.
 

JynX

Posting Freak
Feb 6, 2016
710
438
As JMG said you'd just need to run an insert query to insert the furniture into the database if they're offline and you'd also probably want to use RCON to give them the item if they are online.
 

Baloe20xd

Member
Feb 26, 2016
55
7
Hi,
Thanks for your comment!
But how do I build that query?
I already have everything that you need to be offline when you go buy it.
But building the query is not my best side ...

I now have this:

PHP:
"INSERT INTO items (user_id, item_id, extra_data) VALUES ((SELECT id FROM items_base WHERE item_name = 'ITEM_NAME'))"

Is this already something?
Can someone help me to continue building the Query?
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
Hi,
Thanks for your comment!
But how do I build that query?
I already have everything that you need to be offline when you go buy it.
But building the query is not my best side ...

I now have this:

PHP:
"INSERT INTO items (user_id, item_id, extra_data) VALUES ((SELECT id FROM items_base WHERE item_name = 'ITEM_NAME'))"

Is this already something?
Can someone help me to continue building the Query?
I’m on my phone but I’m pretty sure the query’s exist here
 

Baloe20xd

Member
Feb 26, 2016
55
7
I’m on my phone but I’m pretty sure the query’s exist here

Thanks for your comment!

I just tested it on RevCMS everything works but you don't get any items in the client?
"You bought a crate, check your inventory to open your crate!"
He also makes nothing in the '' items '' db.
But in crate_logs
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
Maybe this version is better than the original one I gave you.


Use it as a base, the code is all there.
 
Last edited:

Baloe20xd

Member
Feb 26, 2016
55
7
Maybe this version is better than the original one I gave you.


Use it as a base, the code is all there.

Done!
But it still doesn't work ..
Everything it is supposed to do in the topic that is indicated does it except the item on my account? There is nothing in the '' items ''

But I have the feeling that this is due? :


What should I change in the item table or in that piece of code?

I just don't understand that ..
This is how my "" items "" looks like:




Code:
PHP:
mysql_query("INSERT INTO `items` (`id`, `user_id`, `base_item`, `extra_data`) VALUES ('".$iDs."', '".$_SESSION['user']['id']."', '920020', 'JoeThank you for purchasing a loot crate, double click to open!643246337249')");
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
Read the thread again, you’re not changing the values that you’re supposed to.

I’ve set up the creates before, they do work.
Post automatically merged:

Maybe making a catalogue on the CMS isn’t for you since you’re struggling with basic queries.
 

Users who are viewing this thread

Top