Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://rathena.org/board/topic/118854-npc-item-with-control-request/
- prontera,155,181,5 script Sample 4_F_KAFRA1,{
- .@item_id = 512;
- if (callsub(L_HasItem, .@item_id)) {
- npctalk "you already obtained "+getitemname(.@item_id);
- }
- else {
- getitem .@item_id,1;
- npctalk "you obtained "+getitemname(.@item_id);
- }
- end;
- L_HasItem:
- .@item_id = getarg(0, 0);
- .@cid = getcharid(0);
- .@aid = getcharid(3);
- .@gid = getcharid(2);
- if (.@item_id) {
- query_sql("SELECT COUNT(1) FROM `inventory` WHERE `nameid` = "+.@item_id+" AND `char_id` IN (SELECT `char_id` FROM `char` WHERE `account_id` = "+.@aid+")", .@inventory);
- query_sql("SELECT COUNT(1) FROM `cart_inventory` WHERE `nameid` = "+.@item_id+" AND `char_id` IN (SELECT `char_id` FROM `char` WHERE `account_id` = "+.@aid+")", .@cart_inventory);
- if (.@gid)
- query_sql("SELECT COUNT(1) FROM `guild_storage` WHERE `nameid` = "+.@item_id+" AND `guild_id` = "+.@gid+")", .@guild_storage);
- .@count += .@inventory;
- .@count += .@cart_inventory;
- .@count += .@guild_storage;
- .@count += countitem(.@item_id);
- .@count += cartcountitem(.@item_id);
- .@count += storagecountitem(.@item_id);
- if (.@gid)
- .@count += guildstoragecountitem(.@item_id);
- }
- return (.@count > 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement