Jump to content
  • 0

Rental equips proof of donation payment


cloudblackfire

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   1
  • Joined:  08/03/20
  • Last Seen:  

Can someone help me with Rental NPC with Proof of donation payment, expires for 3 days.
an Array of items. Thanks!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  40
  • Reputation:   0
  • Joined:  02/26/21
  • Last Seen:  

Good Day, 

I manage to fix it my issue by changing > 

rentitem .@q[0], .@day * 120; // rent an items. 86400 = 1 day in seconds

to this >

 

rentitem .@q[0], .@day * 86400; // rent an items. 86400 = 1 day in seconds

Thanks for sharing this useful script to the community.  Upvote +1 for you =).

Cheers ~ amanikoko =P

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   1
  • Joined:  08/03/20
  • Last Seen:  

prontera,165,99,4	script	Rentals Shop	582,{	
callshop "rental_shop", 1;	
npcshopattach "rental_shop";	
end;

OnBuyItem:	
dispbottom "Rentals Shop: You can only buy one item at once.";	
setarray .@q[0], @bought_nameid[0], @bought_quantity[0];
for (.@i = 0; .@i < getarraysize(.items_list); .@i++) {		
if (.@q[0] == .items_list[.@i]) {			
.@q[2] = .price_list[.@i];
}	
}	

mes .@npc_name$ = "[Rentals Shop]";	mes "Rental Item: "+getitemname(.@q[0]);	
mes "Rental Cost: "+.@q[2]+"x "+getitemname(.currency)+" for one day.";	
mes " ";	
mes "How many days do you want to rent it ?";	
next;	

if (input(.@day, 1, 365)) {		
mes .@npc_name$;	
mes "Invalid input days..";
callsub ClearBought;		
close;	
}	

.@q[3] = .@day * .@q[2];	
mes .@npc_name$;	
mes "Rental Item: "+getitemname(.@q[0]);	
mes "Rental Cost: "+.@q[3]+"x "+getitemname(.currency)+" for "+.@day+" day"+((.@day > 1) ? "s" : "")+".";	
mes " ";	
mes "Still want to make the rent ?";	
next;	

if (select("Yes:No") == 2) {		
mes .@npc_name$;		
mes "All right, "+callfunc("F_Bye");		
callsub ClearBought;		
close;	
}	

if (countitem(.currency) < .@q[3]) {
mes .@npc_name$;		
mes "I'm sorry, you haven't enought "+getitemname(.currency)+" to pay the rental";		
callsub ClearBought;		
close;	
}	

if (!checkweight(.@q[0], .@q[1])) {		
mes .@npc_name$;		
mes "You need more space in your inventory.";		
callsub ClearBought;		
close;	
}	

delitem .currency, .@q[3]; // delete items	
rentitem .@q[0], .@day * 86400; // rent an items. 86400 = 1 day in seconds	
callsub ClearBought;	
end;
	
ClearBought:	
deletearray @bought_quantity, getarraysize(@bought_quantity);	
deletearray @bought_nameid, getarraysize(@bought_nameid);	
return;

OnInit:	
// Configuration	
setarray .items_list, 1201, 1201, 1201; // items list that you want to sell.	
setarray .price_list,  100,  200,  300; // itens price that item you sell in the shop.	
.currency = 7179; // items that will be used as exchange currency		

// do not touch from here!!	
npcshopdelitem "rental_shop", 501;	for (.@i = 0; .@i < getarraysize(.items_list); .@i++)		
npcshopadditem "rental_shop", .items_list[.@i], .price_list[.@i];	
end;

}

Saw the code here: https://board.herc.ws/topic/2277-rental-npc-with-payment/
But I format it, so you can just copy and paste it.

Edited by cloudblackfire
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  40
  • Reputation:   0
  • Joined:  02/26/21
  • Last Seen:  

Hi @cloudblackfire, first off thanks for this amazing script; the script is working as intended except for the prize indicates 100, 200, 300 but the value in client reads all 3 of the items as 300 only but not the 100 and 200 as indicated. Another thing is when indicating the days value, i've just tested to input 1 day and 2 days but when purchase the items the rentals end up becoming 2 minute for 1 day input and 4 minute for 2 day input. 

There's no error prompted in my trunk server so i'm guessing some of the formula went wrong somewhere in the script?

Hopefully you could provide a fix on this; your assistance on this is highly appreciated and i thank you for your time.

Cheers ~ amanikoko =P

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   1
  • Joined:  08/03/20
  • Last Seen:  

This Script is working fine and I'm using it currently.
Can you paste your code here so I can check, maybe you're missing something.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   1
  • Joined:  08/03/20
  • Last Seen:  

Yeah my bad I did that to test if the rental is working.

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...