@Begin
prontera,155,180,5 script Reward NPC 4_F_FAIRYKID4,{
// $ip_reward_daytime = 0;
mes "["+ strnpcinfo(NPC_NAME) +"]";
if ( $ip_reward_daytime != atoi( gettimestr("%Y%m%d", 20 ) ) ) {
$ip_reward_daytime = atoi( gettimestr("%Y%m%d", 20 ) );
deletearray $ip_reward$;
}
.@size = getarraysize( $ip_reward$ );
while ( getcharip() != $ip_reward$[.@i] && .@i < .@size ) { ++.@i; }
if ( .@i < .@size ) {
mes "You have claimed the reward with this IP address.";
close;
}
if ( @ip_reward && @ip_reward + .countdown <= gettimetick(2) ) {
mes "Here is the surprise reward";
getitem Poring_Coin, 1;
$ip_reward$[ getarraysize( $ip_reward$ ) ] = getcharip();
close;
}
if ( @ip_reward ) {
mes "Countdown timer...";
.@timeleft = @ip_reward + .countdown - gettimetick(2);
mes .@timeleft /3600 +" hour "+ .@timeleft %3600/60 +" min "+ .@timeleft %60 +" sec left";
close;
}
mes "Hello "+ strcharinfo(PC_NAME) +", I am here to give you a daily Surprise Reward. Do you want to have it?";
next;
select "Yes, sure !!";
mes "["+ strnpcinfo(NPC_NAME) +"]";
mes "You can claim the reward in 5 hours time.";
close2;
addtimer .countdown *1000, strnpcinfo(NPC_NAME) +"::OnClaimReward";
@ip_reward = gettimetick(2);
end;
OnClaimReward:
dispbottom "You can claim Daily Login Reward now.";
end;
OnInit:
.countdown = 5*60*60; // 5 hours
// .countdown = 5;
}