viewing paste Unknown #50393 | 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
-   script  hourlypoints    FAKE_NPC,{
 
OnInit:
    announce "[30 Minutes Points System]: The system have been reloaded, please relog again to get more points.", bc_all;
 
    .point_name$ = "Free Cash";
    .point_amt = 1;    // Normal points gained.
    .dlimit = 43200;    // Stop points if afk greater then in seconds. 600s = 10 minutes
    .enable = 1;
    .level = 0;
    .online_time = 1800; // One hour = 3600 seconds
 
    bindatcmd "ht", "hourlypoints::OnAtcommand", 0, 100;
    end;
 
OnPCLoginEvent:
    if (BaseLevel >= .level)
    {
        #idle = 0;
        @backup_time = 0;
 
        if (!#acctick || #acctick > .online_time)
            #acctick = gettimetick(2) + .online_time;
        else
            #acctick += gettimetick(2);
 
        while(.enable)
        {
            @idle_time = checkidle();
 
            if (checkvending() >= 1 || checkchatting() == 1 || @idle_time >= .dlimit)
            {
                #acctick += @idle_time; // Add idle time
                #idle = 1;
                dispbottom "The 30 minutes points event haulted because you were vending, chatting, or idle.";
                dispbottom "Please relog again.";
            }
            else
            {
                sleep2 1000;
 
                @backup_time = .@time_left = #acctick - gettimetick(2);
 
                if (.@time_left <= 0)
                {
                    #CASHPOINTS += .point_amt;
                    #acctick = gettimetick(2) + .online_time;
                    dispbottom "Gained " + .point_amt + " " + .point_name$ + ". Total " + #CASHPOINTS + " Free Cash.";
                }
                else
                {
                    .@time_left = .online_time - .@time_left;
                    .@Time$ = "";
                    .@Minutes = .@time_left / 60;
                    .@time_left -= (.@Minutes * 60);
 
                    if (.@Minutes > 1)
                        .@Time$ += .@Minutes + " minutes, ";
                    else if (.@Minutes > 0)
                        .@Time$ += .@Minutes + " minute, ";
 
                    if (.@time_left > 1 || .@time_left == 0)
                        .@Time$ += .@time_left + " seconds";
                    else if (.@time_left == 1)
                        .@Time$ += .@time_left + " second";
 
                    if (.@Minutes == 15 && .@time_left == 0 || .@Minutes == 30 && .@time_left == 0 || .@Minutes == 45 && .@time_left == 0)
                        dispbottom "You spend a total of [" + .@Time$ + "] playing.";
                }
            }
 
            if (#idle)
                break;
        }
    }
    end;
 
OnPCLogoutEvent:
    // BackUP online time
    if (BaseLevel >= .level)
    {
        if (@backup_time)
            #acctick = @backup_time;
    }
    end;
 
OnAtcommand:
    if (BaseLevel >= .level)
    {
        if (#idle)
        {
            .@Time$ = "";
            .@Minutes = @idle_time / 60;
            .@time_left = @idle_time - (.@Minutes * 60);
 
            if (.@Minutes > 1)
                .@Time$ += .@Minutes + " minutes, ";
            else if (.@Minutes > 0)
                .@Time$ += .@Minutes + " minute, ";
 
            if (.@time_left > 1 || .@time_left == 0)
                .@Time$ += .@time_left + " seconds";
            else if (.@time_left == 1)
                .@Time$ += .@time_left + " second";
 
            dispbottom "You been idle for " + .@Time$ + ". Please relog again.";
        }
        else
        {
            .@time_left = @backup_time;
            .@Time$ = "";
            .@Minutes = .@time_left / 60;
            .@time_left -= (.@Minutes * 60);
 
            if (.@Minutes > 1)
                .@Time$ += .@Minutes + " minutes, ";
            else if (.@Minutes > 0)
                .@Time$ += .@Minutes + " minute, ";
 
            if (.@time_left > 1 || .@time_left == 0)
                .@Time$ += .@time_left + " seconds";
            else if (.@time_left == 1)
                .@Time$ += .@time_left + " second";
 
            dispbottom "You have [" + .@Time$ + "] left in able to gain a cash points.";
        }
    }
    end;
}
Viewed 1022 times, submitted by xboost.