I wanted to know if it was possible to create a classic NPC vending but that takes the currency, the IDs of the items and the required cost, directly from an SQL table.
For example, I have the "shop_npc" table with the fields called "currency","item1_id":"item1_cost","item2_id":"item2_cost" and so on for other items, respectively.
The NPC must then have a query with variables that take the respective values in the above table, example (I apologize for the code taken at random but it is just an example) :
I don't know how to set up a script like that but it would be very interesting because I could develop a control panel via web (FluxCP/Addon) to make this NPC configurable to any GM/Admin, obviously launching the reload command in play after the table changes.
Do you think this thing can be applied and do you know how to help me not being a good c++ coder?
p.s.: I believe that the table creation query is like this:
CREATE TABLE `shop_npc`(`id`int(11) NOT NULL,`currency`int(11) NOT NULL,`item1_id`int(11) NOT NULL,`item1_cost`int(11) NOT NULL,`item2_id`int(11) NOT NULL,`item2_cost`int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Question
CyberDevil
I wanted to know if it was possible to create a classic NPC vending but that takes the currency, the IDs of the items and the required cost, directly from an SQL table.
For example, I have the "shop_npc" table with the fields called "currency","item1_id":"item1_cost","item2_id":"item2_cost" and so on for other items, respectively.
The NPC must then have a query with variables that take the respective values in the above table, example (I apologize for the code taken at random but it is just an example) :
Original static code without sql function, here:
I don't know how to set up a script like that but it would be very interesting because I could develop a control panel via web (FluxCP/Addon) to make this NPC configurable to any GM/Admin, obviously launching the reload command in play after the table changes.
Do you think this thing can be applied and do you know how to help me not being a good c++ coder?
p.s.: I believe that the table creation query is like this:
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.