GM Shop

Yoh Asakura

New member
Messages
261
Points
0
Emulator
Hello,

I would like to ask if someone could make this script to me.

How it works?

This npc will be available only for GM's above group_id 60. Gm's can purchase items, like the NPC Quest Shop, but here they can purchase for free, however, in order to get the item they first need to tell a reason why they are picking that item. And this will be recorded in SQL, with the 'char name', 'time', 'chosen item', 'reason'.

I believe that with this kind of NPC the administrators can control more what GM's are using for Events and see those who are just trying to get items for themselves.

 
It's not working so well...

When I try to put the reason it appears a debug on SSH.

"Unknown column list"

 
change

query_sql( "INSERT INTO `gm_shop_log` ( `account_id`,`char_id`,`name`,`item`,`reason`,`time` ) VALUES ( "+getcharid(3)+","+getcharid(0)+",'"+strcharinfo(0)+"','"+@bought_quantity[0]+"x "+getitemname( @bought_nameid[0] )+"',"+.@reason$+",NOW() ) " );
into

Code:
query_sql( "INSERT INTO `gm_shop_log` ( `account_id`,`char_id`,`name`,`item`,`reason`,`time` ) VALUES ( "+getcharid(3)+","+getcharid(0)+",'"+strcharinfo(0)+"','"+@bought_quantity[0]+"x "+getitemname( @bought_nameid[0] )+"','"+.@reason$+"',NOW() ) " );
 
change

query_sql( "INSERT INTO `gm_shop_log` ( `account_id`,`char_id`,`name`,`item`,`reason`,`time` ) VALUES ( "+getcharid(3)+","+getcharid(0)+",'"+strcharinfo(0)+"','"+@bought_quantity[0]+"x "+getitemname( @bought_nameid[0] )+"',"+.@reason$+",NOW() ) " );
into

query_sql( "INSERT INTO `gm_shop_log` ( `account_id`,`char_id`,`name`,`item`,`reason`,`time` ) VALUES ( "+getcharid(3)+","+getcharid(0)+",'"+strcharinfo(0)+"','"+@bought_quantity[0]+"x "+getitemname( @bought_nameid[0] )+"','"+.@reason$+"',NOW() ) " );
Okay, I've changed and now I can put the reason, but if I try to use the npc for the 2nd time, when I put the reason appears an error.

error-gmshop.jpg

 
You've changed the SQL Table...now I get this error on my database when I try to create the table:

 #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AUTO_INCREMENT, `account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0', `char_' at line 2

 
Last edited by a moderator:
I think its better if you will just let the GM Type the item that he/she wants.

Ex:

Item ID /  Quantity  / Reason

 
I think its better if you will just let the GM Type the item that he/she wants.

Ex:

Item ID /  Quantity  / Reason
 
No, I prefer to make a shop so they can choose, is more easy.

 
Change this line

- shop gm_shop_npc -1,607:1,608:2, to this

- shop gm_shop_npc -1,607:1,608:2 After the last item ID you can't use ','

 
Last edited by a moderator:
@@Emistry

I've just tested here and if I buy more than 1 item I will only receive the 1st item that I put to purchase and on SQL will only appear the 1st item too...

 
Last edited by a moderator:
@@Emistry

I really don't know how to do it, xD

Could you show me an example so I can follow?

 
Last edited by a moderator:
Back
Top