//===== Hourly Points Script =========================================
//===== By: ==========================================================
//= Smokexyz
//===== Current Version: =============================================
//= 1.0
//===== Compatible With: =============================================
//= Any eAthena Version
//===== Description: =================================================
//= Get Points every specified seconds of gameplay. Conditional checks
//= for AFK / Vending are provided. Permanent total character playtime
//= is also calculated as a by-product.
//
- script sxyz_hourly_points -1,{
// Init the Awesomeness of this NPC.
OnInit:
.AFKCheckDelay, 300; // (in seconds) 5 minutes AFK Delay
.RewardTimeDelay, 3600; // (in seconds) 1 hour delay between point giving.
.RewardPoints, 10; // Points rewarded every .RewardTimeDelay
.CheckAFK, 0; // Enable/Disable AFK Checks
.CheckVendChat, 1; // Enable/Disable Vending/Chatting Checks.
end;
// Attach the timer when the player logs in.
OnPCLoginEvent:
attachnpctimer ""+strcharinfo(0)+"";
addtimer 1000,"sxyz_hourly_points::OnProcess";
end;
OnProcess:
// Exclude Vendors from playtime/Afk Checks.
if((checkvending() >= 1 || checkchatting()) && .CheckVendChat) {
set .@afk, 1;
} else if (.AFKCheckSeconds <= playtime && .CheckAFK) {
getmapxy( .@map$, .@x, .@y, 0 );
if (.@map$ == @map$ && .@x == @x && .@y == @y )
set .@afk, 1;
}
if (!.@afk) {
.@tick = gettimetick(2);
// Reward the player if check passes.
if ((.@tick - @last_active) >= .RewardTimeDelay) {
set #REWARDPOINTS, #REWARDPOINTS+ .RewardPoints;
dispbottom "[Hourly Points] You've gained "+.RewardPoints+" points! (Playtime: "+playtime+"s)";
}
getmapxy( @map$, @x, @y, 0 );
set playtime,playtime++;
set @last_active, gettimetick(2);
}
addtimer 1000,"sxyz_hourly_points::OnProcess";
end;
}