[ Req ] Npc Reward Player online

Yugosh

New member
Messages
7
Points
0
master can i req script / npc player online?

ex. player online 1 or 2 hours get this item.

but player online more than 6 hour get this item.

a different reward thanks

sory my bad english
default_sad.png


 
It will go directly.

Code:
getitem .item_reward[lrs_prize], .item_reward_qt[lrs_prize];
Any errors just post c:
 
Thanks. Can you explain this set .time_lapse,60*60*2; how it works. Sorry I can't test right now, will test later.

+1

 
Last edited by a moderator:
It's fairly simple, this variable is measured in seconds, so 60 would be a minute.

Code:
60 -> A minute60*60 -> A minute*60 -> A hour60*60*2 -> 2 hours
 
Here it is: http://pastebin.com/3RmAGytY

Just change .time_lapse[0], it works exactly the same as before.

setarray .time_lapse[0],FIRST ID TIME LAPSE,SECOND ID TIME LAPSE,0;If you have four prizes but only one time_lapse set there's no problem, the time lapse for all prizes will be the same. As usual I haven't tested, any errors just post c:
EDIT:

Don't forget that every time a time_lapse is met the time is set to zero.

setarray .time_lapse[0],60*60*2,60*60*3,0;A player will only win the second prize (.item_reward[1]) if he stays logged for 5 hours.
EDIT2:

New version with new config options:

// Account idle players? 1 - true; 0 - falseset .idle,1;// Account players using autotrade? 1 - true; 0 - falseset .autotrade,1;// Account players that are in chats? 1 - true; 0 - falseset .chat, 1;Set to false if you want that those players don't receive any prize.http://pastebin.com/QaGfva8H

 
Last edited by a moderator:
Here it is: http://pastebin.com/3RmAGytY

Just change .time_lapse[0], it works exactly the same as before.

setarray .time_lapse[0],FIRST ID TIME LAPSE,SECOND ID TIME LAPSE,0;If you have four prizes but only one time_lapse set there's no problem, the time lapse for all prizes will be the same. As usual I haven't tested, any errors just post c:
EDIT:

Don't forget that every time a time_lapse is met the time is set to zero.

setarray .time_lapse[0],60*60*2,60*60*3,0;A player will only win the second prize (.item_reward[1]) if he stays logged for 5 hours.
Thank you again! I'll test it later and give you feedback.. 

 
Sir thank you its working now.. I'll let you know if I find anything unusual. 

Sir One more thing. Can you please create one timelapse 

for 1 minute and 3 minutes (for testing purposes only i dont want to w8 an hour or 2 just for testing it)? Im so confused on how to set the time lapse for 1 and 3 minutes.

setarray .time_lapse[0],60*60*2,60*60*3,0;

 
Last edited by a moderator:
If I'm not mistaken:

1 minute = 1, and so on for the rest of minutes.
You are absolutely right c:
Sir thank you its working now.. I'll let you know if I find anything unusual. 

Sir One more thing. Can you please create one timelapse 

for 1 minute and 3 minutes (for testing purposes only i dont want to w8 an hour or 2 just for testing it)? Im so confused on how to set the time lapse for 1 and 3 minutes.

setarray .time_lapse[0],60*60*2,60*60*3,0;
For 1 minute for first prize and 3 for the second:
Code:
setarray .time_lapse, 1, 2, 0;
Remember that after the first time_lapse condition is met the timer resets. So even if the second lapse (.time_lapse[1]) looks like just 2 minutes it's actually 3.
Code:
.time_lapse[0]+.time_lapse[1] = REAL time lapse [1]
 
If I'm not mistaken:

1 minute = 1, and so on for the rest of minutes.
You are absolutely right c:
>Sir thank you its working now.. I'll let you know if I find anything unusual. 

Sir One more thing. Can you please create one timelapse 

for 1 minute and 3 minutes (for testing purposes only i dont want to w8 an hour or 2 just for testing it)? Im so confused on how to set the time lapse for 1 and 3 minutes.

setarray .time_lapse[0],60*60*2,60*60*3,0;
For 1 minute for first prize and 3 for the second:setarray .time_lapse, 1, 2, 0;Remember that after the first time_lapse condition is met the timer resets. So even if the second lapse (.time_lapse[1]) looks like just 2 minutes it's actually 3.
Code:
.time_lapse[0]+.time_lapse[1] = REAL time lapse [1]
got it! Thank you so much! 
default_rolleyes.gif


 
Well how can I make the reward goes to online players only, excluding @at. Since they may spam merchants and @at to get rewards.

And can I make reward totally unable to change the owner including dropping, trading and vending.

 
Last edited by a moderator:
You can modify the behavior of the script by using checkvending() or checkidle() if you want not to reward idle players. See how they work here: doc/script_commands.txt#L3797

*checkvending({"<Player Name>"})
*checkchatting({"<Player Name>"})
 
Checks if the player is vending or in a chatroom.
Name is optional, and defaults to the attached player if omitted.
 
Return values for 'checkvending' are
0 = not vending
1 = normal vending
2 = vending using @autotrade
 
'checkchatting' returns 1 if they are in a chat room, 0 if they are not.
 
Examples:
//This will check if Aaron is vending, and if so, put a message in
//front of the attached player saying Aaron is vending.
if (checkvending("Aaron"))
mes "Aaron is currently vending!";
 
//This will check if the attached player in a chat room or not.
if (checkchatting())
mes "You are currently in a chat room!";
 
---------------------------------------
 
*checkidle({"<Player Name>"})
 
Returns the time, in seconds, that the specified player has been idle.
Name is optional, and defaults to the attached player if omitted.
 
  • Upvote
Reactions: pan
try not to use attachnpctimer unnecessary

attachnpctimer I only use them in 1 scenario

which use in botkiller script to kick players which doesn't answer in a certain time period

means, only use in a npc dialog script

because if this script already uses attachnpctimer,

if there is other script use attachnpctimer again, the timer wouldn't run anymore

for this kind of script, I rather use sleep2

http://rathena.org/board/topic/90989-hourly-points-help/?p=238289

 
  • Upvote
Reactions: pan
try not to use attachnpctimer unnecessary

attachnpctimer I only use them in 1 scenario

which use in botkiller script to kick players which doesn't answer in a certain time period

means, only use in a npc dialog script

because if this script already uses attachnpctimer,

if there is other script use attachnpctimer again, the timer wouldn't run anymore

for this kind of script, I rather use sleep2

http://rathena.org/board/topic/90989-hourly-points-help/?p=238289
Thank you, I wasn't aware of that.
Well how can I make the reward goes to online players only, excluding @at. Since they may spam merchants and @at to get rewards.

And can I make reward totally unable to change the owner including dropping, trading and vending.
I added new configurations:// Account idle players? 1 - true; 0 - falseset .idle,1;// Account players using autotrade? 1 - true; 0 - falseset .autotrade,1;// Account players that are in chats? 1 - true; 0 - falseset .chat, 1;Set to false if you want that those players don't receive any prize.http://pastebin.com/aJV6beP8

 
Back
Top