viewing paste Unknown #11520 | 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
prontera,164,169,3  script  Premium Trader  757,{
    mes "Want to be Premium User for 1 week?";
    mes "Then give me 7 x "+getitemname(7179);
    next;
    switch(select("yes:no"))
    {
        case 1:
            if(countitem(7179) >= 7)
            {
                delitem 7179,7;
                callfunc "F_VIPstart",604800;
                mes "Done. enjoy your Premium Services for 1 Week.";
                close;
            }
            else
            {
                mes "you don't have 7 x "+getitemname(7179);
                close;
            }
        case 2:
            mes "ok then";
            close;
    }
}
 
function    script  F_VIPstart  {
    set .@ticks,getarg(0); // getarg(0) = ticks (seconds)
    if (.@ticks <= 0) {
        debugmes "F_VIPstart - tried a negative time";
        end;
    }
    // set a variable, #VIP_expire, as the Unixtime when this expires
    set #VIP_expire, gettimetick(2) + .@ticks;
    // add a timer with that tick (in case they stay logged in that long)
    if (.@ticks < 2147483) { // prevent overflow error
        addtimer .@ticks *1000, "vip_rental::OnVIPend";
    } else {
        addtimer 2147483000, "vip_rental::OnVIPcheck";
    }
    set ModExp,400;
    set ModDrop,400;
    dispbottom "you are now a premium member!";
    return;
}
 
-   script  vip_rental  -1,{
OnPCLoginEvent:
    if (#VIP_expire > gettimetick(2)) {
        // timer in future
        dispbottom "your premium ends in "+callfunc("Time2Str",#VIP_expire);
    }
OnVIPcheck:
    if (#VIP_expire > gettimetick(2)) {
        if ((#VIP_expire - gettimetick(2)) < 2147483) { // prevent overflow error
            addtimer (#VIP_expire - gettimetick(2)) *1000, strnpcinfo(3)+"::OnVIPend";
        } else {
            addtimer 2147483000, strnpcinfo(3)+"::OnVIPcheck";
        }
    } else if (#VIP_expire) {
        // timer already expired
        doevent strnpcinfo(3)+"::OnVIPend";
    }
    end;
 
OnVIPend:
    set #VIP_expire,0; // clear timer
    set ModExp,100;
    set ModDrop,100;
    dispbottom "premium ended";
    end;
}
 
Viewed 1265 times, submitted by evilpuncker.