viewing paste Unknown #50394 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
//===== 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;
}
Viewed 288 times, submitted by xboost.