Jump to content
  • 0

Shop menu


warhammer0093

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   1
  • Joined:  07/16/17
  • Last Seen:  

how can I add menu in this script?

ex.
Armor
Weapon
Usable
Etc.

then i just have to choose what category and will display the items.
 

====================================================================

turbo_room,99,120,5    script    Proof of Donation#1    955,{
    mes "Your["+getitemname(.Cost)+"]["+countitem(.Cost)+"]";
    mes "^E217171 Proof of Donation = 25 PHP";
close2;
callshop "dyn_shop"+.a,1;
npcshopattach "dyn_shop"+.a;
end;
OnInit:
set .a,strnpcinfo(2);
//=========================================
set .Cost,7179;
//=========================================
setarray .buy_id[0],1228;
setarray .buy_co[0],40;
//=========================================

npcshopitem "dyn_shop1",.buy_id[0],.buy_co[0];
for(set .ik,1;.ik<getarraysize(.buy_id);set .ik,.ik+1){
    npcshopadditem "dyn_shop"+.a,.buy_id[.ik],.buy_co[.ik];
}
end;

OnBuyItem:
    getinventorylist;
    if(@bought_quantity[@i] <= 0){
        goto OnEnrd;
        end;
    }
    for(set @i,0;@i<getarraysize(@bought_nameid);set @i,@i+1){
//KeyWorld
        set .@type, getiteminfo( @bought_nameid[.@i], 2 );
        if (  .@type == 4 || .@type == 5 || .@type == 7 || .@type == 8 ) 
            set .@count, .@count + 1;
        else {
            for( set .@j,0; .@j<@inventorylist_count; set .@j, .@j+1 )
                if ( @inventorylist_id[.@i] == @bought_nameid[.@i] )
                    break;
            if ( .@j == @inventorylist_count )
                set .@count, .@count+1 ;
        }
        for(set @i2,0;@i2<getarraysize(.buy_id);set @i2,@i2+1){
            if(@bought_nameid[@i]==.buy_id[@i2]){
                set @gh,@gh+.buy_co[@i2]*@bought_quantity[@i];
                set @wh,@wh+getiteminfo(@bought_nameid[@i],6)*@bought_quantity[@i];
            }
        }
    }
    if ( .@count + @inventorylist_count > 100 ) {
        announce "[D-Shop]: Can't hold more than 100 items.",bc_self;
        goto OnEnrd;
    }
    if(countitem(.Cost)<@gh){
        announce "[D-Shop]:["+getitemname(.Cost)+"] isn't enough",bc_self;
        goto OnEnrd;
        end;
    }else{
        if(@wh>(MaxWeight-Weight)){
            announce "[D-Shop]:Too heavy",bc_self;
            goto OnEnrd;
            end;
        }else{
            delitem .Cost,@gh;
            for(set @i,0;@i<getarraysize(@bought_nameid);set @i,@i+1){
                getitem @bought_nameid[@i],@bought_quantity[@i];
            }            
        }
    }
OnEnrd:
    set @gh,0;
    set @wh,0;
    set @i,0;
    set @i2,0;
    deletearray @bought_quantity,getarraysize(@bought_quantity);
    deletearray @bought_nameid,getarraysize(@bought_nameid);
end;
}

 

Edited by Cyro
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

You can use euphy multi shop

 

http://pastebin.com/raw/YftccqDs

 

Ps- kindly use code box when you pasting code next time 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  333
  • Reputation:   66
  • Joined:  09/05/12
  • Last Seen:  

You need to add items and prices in the array:
//=========================================
setarray .buy_id[0],1228,itemid1,itemid2,itemid3,itemid4;
setarray .buy_co[0],40,price1,price2,price3,price4;
//=========================================

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...