Lord Ganja
New member
i'm trying to create a custom script command that checks if the currently equipped item is 'tradable' or 'untradable(either it is 'bounded' or has the 'notrade' flag)'
I comeup with my own script but it doesn't work. I don't know how can I declare the itemdb_cantrade :/
I have hunch that it wouldn't work in the first place but I still tried LOL
BUILDIN(getequipistradable){ int i = -1,num; TBL_PC *sd; num = script_getnum(st,2); sd = script->rid2sd(st); if( sd == NULL ) return true; if( num > 0 && num <= ARRAYLENGTH(script->equip) ) i = pc->checkequip(sd,script->equip[num-1]); if( i >= 0 && itemdb_cantrade(sd->inventory_data) ) // I also tried this one if( i >= 0 && sd->inventory_data->itemdb_cantrade ) script_pushint(st,1); else script_pushint(st,0); return true;}
The other one is a custom script command that checks if an item is 'tradable' or 'untradable(either it is 'bounded' or has the 'notrade' flag)'
I don't know if it can possibly check if an item is 'bounded' when it is not equipped. Please let me know.
but im trying to create a script works like 'getitemistradable <item_id>;' If it can't check bounded items that are not currently equipped, but can detect the 'notrade' flag, it would work fine for me..
I comeup with this script but same problem from getequipistradable.
BUILDIN(getitemistradable){ int item_id; struct item_data *i_data; item_id=script_getnum(st,2); i_data = itemdb->exists(item_id); if ( itemdb_cantrade(i_data) ) script_pushint(st,1); else script_pushint(st,0); return true;}
Anybody can help me to make this script work? Thanks in advance!
I comeup with my own script but it doesn't work. I don't know how can I declare the itemdb_cantrade :/
I have hunch that it wouldn't work in the first place but I still tried LOL
BUILDIN(getequipistradable){ int i = -1,num; TBL_PC *sd; num = script_getnum(st,2); sd = script->rid2sd(st); if( sd == NULL ) return true; if( num > 0 && num <= ARRAYLENGTH(script->equip) ) i = pc->checkequip(sd,script->equip[num-1]); if( i >= 0 && itemdb_cantrade(sd->inventory_data) ) // I also tried this one if( i >= 0 && sd->inventory_data->itemdb_cantrade ) script_pushint(st,1); else script_pushint(st,0); return true;}
The other one is a custom script command that checks if an item is 'tradable' or 'untradable(either it is 'bounded' or has the 'notrade' flag)'
I don't know if it can possibly check if an item is 'bounded' when it is not equipped. Please let me know.
but im trying to create a script works like 'getitemistradable <item_id>;' If it can't check bounded items that are not currently equipped, but can detect the 'notrade' flag, it would work fine for me..
I comeup with this script but same problem from getequipistradable.
BUILDIN(getitemistradable){ int item_id; struct item_data *i_data; item_id=script_getnum(st,2); i_data = itemdb->exists(item_id); if ( itemdb_cantrade(i_data) ) script_pushint(st,1); else script_pushint(st,0); return true;}
Anybody can help me to make this script work? Thanks in advance!