All right Lulu, as you feared, you need to store the above datas all in your main plugin. But that gives you some advantages too, you don't need to send out so many external forwards to check who has a certain item, you can simply use the datas as a lookup table( precache them as nesesery ).
In your main plugin, set up some enums to give your data a structure:
PHP Code:
enum _:ITEM_FLAGS(<<=1){
IF_DROPABLE = 1,
IF_STEALABLE,
IF_LOOSEONNEWROUND,
IF_LOOSEONDEATH,
IF_LOOSEONTEAMCHANGE,
IF_FOR_T,
IF_FOR_CT,
FLAG_SIZE
}
enum _:ITEM_DATA{
INAME[30],
IPRIZE,
IAMOUNT,
IPRIORITY,
IMODE,
IFLAGS
}
#define MAX_ITEMNUM 100
new itemdatas[MAX_ITEMNUM][ITEM_DATA];
new itemnum;
And then you have your structure.
To register your item, use a function like this:
PHP Code:
//in the main plugin:
public native_register_item(name[],prize,max_amount,buy_priority,buy_mode,flags){
static i;
param_convert(1);
if(itemnum>=MAX_ITEMNUM){
#if defined DEBUG
console_print(0,"[BV] Can't add item ^"%s^", because there is no more space!",name);
#endif
return -1;
}
if(itemnum>0){
for(i = 0; i< itemnum;i++){
if(equali(itemdatas[i][INAME],name)){
#if defined DEBUG
console_print(0,"[BV] Item ^"%s^" already defined as #%d!",itemdatas[i][INAME],i);
#endif
return itemnum;
}
}
}
copy(itemdatas[itemnum][INAME],29,name);
itemdatas[itemnum][IPRIZE] = prize;
itemdatas[itemnum][IAMOUNT] = max_amount;
itemdatas[itemnum][IPRIORITY] = buy_priority;
itemdatas[itemnum][IMODE] = buy_mode;
itemdatas[itemnum][IFLAGS] = flags;
#if defined DEBUG
static binflags[32], bitnum;
bitnum = floatround(floatlog(float(FLAG_SIZE),2.0),floatround_floor);
num_to_binstr(flags,binflags,bitnum);
console_print(0,"[BV] Added item ^"%s^" as #%d.",name,itemnum);
console_print(0,"[BV] (Prize: %d, max amount: %d, buy priority %d, buy mode: %d, flags: %s)",prize,max_amount,buy_priority,buy_mode,binflags);
#endif
itemnum++;
return itemnum-1;
}
//use this to print out binary numbers in amxmodx, because %x is not working...
#if defined DEBUG
stock num_to_binstr(num,dest[],len){
static i;
for(i=0;i<len;i++){
dest[(len-1)-i] = (num>>i)%2==1 ? '1' : '0';
}
}
#endif
//in your external plugin:
purse2k = bv_register_item("Purse upgrade I.",600,1,IBP_ASAP,IBM_MAXOUT,IF_LOOSEONTEAMCHANGE | IF_FOR_T | IF_FOR_CT);
If you want a description to an item, that is being bought, then that is the thing that can be stored in every plugin of it's own( in my opinion ).
For example when someone buys the item purse2k, then you can print out a message( from the purse2k's plugin ): You can now store up to 2000 dollars.
Hope this helps, Lulu.