Jump to content

Question

Posted

Hi friends. I'm having trouble getting this gift script to randomly deliver just one rentitem.

Spoiler
  1. prontera,142,173,5 script Recompensas Diarias 911,{
  2. .@cd = 60*60*24; // 24 hrs
  3. .@time = gettimetick(2);
  4. if ( #DAILYRENTREWARD+.@cd > .@time ) {
  5. mes "Volte novamente em "+Time2Str(#DAILYRENTREWARD+.@cd)+" para pegar sua recompensa!";
  6. close;
  7. }
  8. mes "Aqui está sua recompensa, aproveite-a!";
  9. close2;
  10. rentitem 4302, 7200; // <id>, <time in seconds>
  11. rentitem 4403, 7200;
  12. #DAILYRENTREWARD = .@time;
  13. end;
  14. }

 

3 answers to this question

Recommended Posts

  • 0
Posted
prontera,142,173,5	script	Recompensas Diarias	911,{
	.@cd = 60 * 60 * 24; // 24 hrs
	.@time = gettimetick(2);
   
	if ( #DAILYRENTREWARD + .@cd > .@time ) {
		mes "Volte novamente em " + Time2Str(#DAILYRENTREWARD + .@cd) + " para pegar sua recompensa!";
		close;
	}
   
	mes "Aqui está sua recompensa, aproveite-a!";
	close2;

	// Pick one item index randomly as reference.
	.@reward_item_index = rand(getarraysize(.reward_items));

	// Use the reference to get the item id and duration of the referenced item.
	rentitem(.reward_items[.@reward_item_index], .reward_item_durations[.@reward_item_index]);

	#DAILYRENTREWARD = .@time;
	end;

	OnInit:
		// Set the list of possible items and how long they should be rentable.
		setarray(.reward_items, 4302, 720);
		setarray(.reward_item_durations, 7200, 7200);
}

 

  • Love 1
  • 0
Posted
1 hour ago, Winterfox said:
prontera,142,173,5	script	Recompensas Diarias	911,{
	.@cd = 60 * 60 * 24; // 24 hrs
	.@time = gettimetick(2);
   
	if ( #DAILYRENTREWARD + .@cd > .@time ) {
		mes "Volte novamente em " + Time2Str(#DAILYRENTREWARD + .@cd) + " para pegar sua recompensa!";
		close;
	}
   
	mes "Aqui está sua recompensa, aproveite-a!";
	close2;

	// Pick one item index randomly as reference.
	.@reward_item_index = rand(getarraysize(.reward_items));

	// Use the reference to get the item id and duration of the referenced item.
	rentitem(.reward_items[.@reward_item_index], .reward_item_durations[.@reward_item_index]);

	#DAILYRENTREWARD = .@time;
	end;

	OnInit:
		// Set the list of possible items and how long they should be rentable.
		setarray(.reward_items, 4302, 720);
		setarray(.reward_item_durations, 7200, 7200);
}

 

Perfect my friend, thank you very much! I have a question, I tried to copy my old script to deliver rentitem gifts to a random NPC and another to give several rentitems but it didn't work, is it due to the 24h waiting time? I thought creating another NPC wouldn't count

your script:

Spoiler

prontera,142,173,5    script    Recompensas Diarias    911,{
    .@cd = 60 * 60 * 24; // 24 hrs
    .@time = gettimetick(2);
   
    if ( #DAILYRENTREWARD + .@cd > .@time ) {
        mes "Volte novamente em " + Time2Str(#DAILYRENTREWARD + .@cd) + " para pegar sua recompensa!";
        close;
    }
   
    mes "Aqui está sua recompensa, aproveite-a!";
    close2;

    // Pick one item index randomly as reference.
    .@reward_item_index = rand(getarraysize(.reward_items));

    // Use the reference to get the item id and duration of the referenced item.
    rentitem(.reward_items[.@reward_item_index], .reward_item_durations[.@reward_item_index]);

    #DAILYRENTREWARD = .@time;
    end;

    OnInit:
        // Set the list of possible items and how long they should be rentable.
        setarray(.reward_items, 30023,30024,30025,30026,30027,30028,30029,30030,30031);
        setarray(.reward_item_durations, 10800,10800,10800,10800,10800,10800,10800,10800);
}

Mine:

Spoiler

prontera,139,173,5    script    Recompensas Diarias    911,{
.@cd = 60*60*24; // 24 hrs
.@time = gettimetick(2);
if ( #DAILYRENTREWARD+.@cd > .@time ) {
mes "Volte novamente em "+Time2Str(#DAILYRENTREWARD+.@cd)+" para pegar sua recompensa!";
close;
}
mes "Aqui está sua recompensa, aproveite-a!";
close2;
rentitem 30023, 10800; // <id>, <time in seconds>
rentitem 30024, 10800;
rentitem 30025, 10800;
rentitem 30026, 10800;
rentitem 30027, 10800;
rentitem 30028, 10800;
rentitem 30029, 10800;
rentitem 30030, 10800;
rentitem 30031, 10800;
#DAILYRENTREWARD = .@time;
end;
}

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...