lipitb 0 Posted September 2, 2013 Hi! I want to modify the function "getitemname" for first check the name in the database as my script: example: function script getitemname { set @querysql, query_sql("select name_japanese from `ragdb`.`item_db` WHERE `id` ="+getarg(0)+" ORDER BY id ASC LIMIT 0,1", $@itemname$); if(@querysql == 0) {set $@itemname$, getitemname(getarg(0));} return; } //$@itemname$ = Item name /*========================================== * Get the item name by item_id or null *------------------------------------------*/ BUILDIN(getitemname) { int item_id=0; struct item_data *i_data; char *item_name; struct script_data *data; data=script_getdata(st,2); script->get_val(st,data); if( data_isstring(data) ){ const char *name=script->conv_str(st,data); struct item_data *item_data = itemdb->search_name(name); if( item_data ) item_id=item_data->nameid; }else item_id=script->conv_num(st,data); i_data = itemdb->exists(item_id); if (i_data == NULL) { script_pushconststr(st,"null"); return true; } item_name=(char *)aMalloc(ITEM_NAME_LENGTH*sizeof(char)); memcpy(item_name, i_data->jname, ITEM_NAME_LENGTH); script_pushstr(st,item_name); return true; } Quote Share this post Link to post Share on other sites
0 Emistry 145 Posted September 3, 2013 why not just simply change your server to use SQL item_db and not the TXT item_db ??? Quote Share this post Link to post Share on other sites
Hi!
Share this post
Link to post
Share on other sites