Jump to content
  • 0

How To Fix This PODS Trader?


Hatake Kakashi

Question


  • Group:  Members
  • Topic Count:  254
  • Topics Per Day:  0.06
  • Content Count:  825
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

hello, i think sir emistry can solve this problem and the other's

how to put rent item on it?

prontera,142,174,4 script Donation Custom Shop#1 789,{
mes "Your Donation Coupon-->["+countitem(.Cost)+"]";
close2;
callshop "dyn_shop"+.a,1;
npcshopattach "dyn_shop"+.a;
end;
OnInit:
set .a,strnpcinfo(2);
//=========================================
set .Cost,7179;
//=========================================
setarray .buy_id[0],30000,30017;
setarray .buy_co[0],500,700;
//=========================================

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 "You Are Not A Donator To Buy This Items.",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 hatake
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

getitem @bought_nameid[@i],@bought_quantity[@i]

change to:

something with rentitem (unfortunately I haven't used it, so I don't know the doc for it)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  201
  • Reputation:   47
  • Joined:  11/17/11
  • Last Seen:  

Here is the command straight from the script_commands file:

*rentitem <item id>,<time>;
*rentitem "<item name>",<time>;

Creates a rental item in the attached character's inventory. The item will expire
in <time> seconds and be automatically deleted. When receiving a rental item,
the character will receive a message in their chat window. The character will
also receive warning messages in their chat window before the item disappears.

This command can not be used to rent stackable items. Rental items cannot be
dropped, traded, sold to NPCs, or placed in guild storage. (i.e. trade mask 75)
Note: 'delitem' in an NPC script can still remove rental items.

So just set it up with your item name or id, then the time in seconds and it should work out for you!

Edited by Truly
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  254
  • Topics Per Day:  0.06
  • Content Count:  825
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

@Truly

yes, i know that way of editting rentitem, but look at the script. its a PODS Trader w/ Item Viewer.

so this is the code when im putting items and amount.

setarray .buy_id[0],30000,30017;
setarray .buy_co[0],500,700;

so unfortunately, if i edit this code i think npc is not working when i edit this.

getitem @bought_nameid[@i],@bought_quantity[@i];

Edited by hatake
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

Do this then...

for (set .@a, 1; .@a < @bought_quantity[@i]; set .@a, .@a + 1) {
 rentitem .@bought_namedid[@i], <INSERT NUMBER OF SECONDS HERE>;
}

This will loop through 1 to Number of Items Purchased, and Give Them Rental Items

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  201
  • Reputation:   47
  • Joined:  11/17/11
  • Last Seen:  

Hey Z3R0, shouldn't it be setting .@a, 0 in the for loop?

Since arrays use 0 as first value, 1 for 2nd and so on.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

We are not "really" looping through an array... we are looping between 1 and the number of items...

however, it should either be 0 and a <

for (set .@a, 0; .@a < @bought_quantity[@i]; set .@a, .@a + 1) {
 rentitem .@bought_namedid[@i], <INSERT NUMBER OF SECONDS HERE>;
}

or 1 and a <=

for (set .@a, 1; .@a <= @bought_quantity[@i]; set .@a, .@a + 1) {
 rentitem .@bought_namedid[@i], <INSERT NUMBER OF SECONDS HERE>;
}

sorry about that

  • Upvote 1
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...