Jump to content

Question

Posted

It's like Hourly Points script but a twist.

If the timer starts, you will have a total of 5 hours per day. the timer will reset at 12 midnight.

1st hour = 10 cash point + red potion

2nd hour = 15  cp + orange potion

3rd hour = 20 cp + yellow potion

4th hour = 25 cp + white potion

5th hour = 30 cp + blue potion

 

if the timer reached total of 5 hours, the timer will stop and wait until 12 midnight for reset.

even i log out, the timer will save.

if the timer is active and i'm playing, and if the time is reached 12 midnight, the timer will reset and will notify the player 'the hourly points reset.'.

and if the character is offline, the timer will reset also.

15 answers to this question

Recommended Posts

  • 1
Posted (edited)

Very well, I had some spare time, so.

-    script    hourly_point_main    -1,{
    
    OnInit:
        .max_hour = 5;
        .duration = 3600;
        .npc_name$ = strnpcinfo(3);
        bindatcmd "hourly",    .npc_name$ + "::OnCheck";
        end;
        
    OnClock0000:
        query_sql( "DELETE FROM acc_reg_num` WHERE `key` = '#daily_hour_count' AND `account_id` IN ( SELECT `account_id` FROM `char` WHERE `login` = 0 GROUP BY `account_id` ) " );
        addrid(0);
        #daily_hour_count = -1;
        
    OnUpdate:
        deltimer .npc_name$+"::OnUpdate";
        #daily_hour_count++;
        switch ( #daily_hour_count ) {
            case 1:
                #CASHPOINT += 1;
                getitem 512,1;
                break;
            case 2:
                #CASHPOINT += 2;
                getitem 512,2;
                break;
            case 3:
                #CASHPOINT += 3;
                getitem 512,3;
                break;
            case 4:
                #CASHPOINT += 4;
                getitem 512,4;
                break;
            case 5:
                #CASHPOINT += 5;
                getitem 512,6;
                break;
            default: break;
        }
        
    OnPCLoginEvent:
        if ( #daily_hour_count < .max_hour ) {
            @timer = gettimetick(2) + .duration;
            addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
        }
        if ( #daily_hour_count )    dispbottom "[ Hourly Rewards ] " + #daily_hour_count + "/" + .max_hour + " hour" + ((#daily_hour_count > 1)?"s":"") + " played!",0x9ae2d7;
        end;
        
    OnCheck:
        .@min = (@timer - gettimetick(2))/60;
        .@sec = (@timer - gettimetick(2))%60;
        dispbottom "[ Hourly Rewards ] Your next reward will be achieved in " +
                    ((.@min)?            "[ " + .@min + " ] minute"         + ((.@min > 1)?"s":""):"") +
                    ((.@min && .@sec)?    " and ":"") +
                    ((.@sec)?            "[ " + .@sec + " ] second"    + ((.@sec > 1)?"s":""):"") +
                    "!",0x9ae2d7;
        end;            
}

I've made it on my own coding and aesthetic taste, adapt it as you wish.
Use @hourly to check time left

Edited by Haziel
  • Upvote 1
  • 0
Posted
28 minutes ago, Haziel said:

Very well, I had some spare time, so.
 


-    script    hourly_point_main    -1,{
    
    OnInit:
        .max_hour = 5;
        .duration = 90;
        .npc_name$ = strnpcinfo(3);
        bindatcmd "hourly",    .npc_name$ + "::OnCheck";
        end;
        
    OnClock0000:
        query_sql( "DELETE FROM acc_reg_num` WHERE `key` = '#daily_hour_count' AND `account_id` IN ( SELECT `account_id` FROM `char` WHERE `login` = 0 GROUP BY `account_id` ) " );
        addrid(0);
        #daily_hour_count = -1;
        
    OnUpdate:
        deltimer .npc_name$+"::OnUpdate";
        #daily_hour_count++;
        switch ( #daily_hour_count ) {
            case 1:
                #CASHPOINT += 1;
                getitem 512,1;
                break;
            case 2:
                #CASHPOINT += 2;
                getitem 512,2;
                break;
            case 3:
                #CASHPOINT += 3;
                getitem 512,3;
                break;
            case 4:
                #CASHPOINT += 4;
                getitem 512,4;
                break;
            case 5:
                #CASHPOINT += 5;
                getitem 512,6;
                break;
            default: break;
        }
        
    OnPCLoginEvent:
        if ( #daily_hour_count < .max_hour ) {
            @timer = gettimetick(2) + .duration;
            addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
        }
        if ( #daily_hour_count )    dispbottom "[ Hourly Rewards ] " + #daily_hour_count + "/" + .max_hour + " hour" + ((#daily_hour_count > 1)?"s":"") + " played!",0x9ae2d7;
        end;
        
    OnCheck:
        .@min = (@timer - gettimetick(2))/60;
        .@sec = (@timer - gettimetick(2))%60;
        dispbottom "[ Hourly Rewards ] Your next reward will be achieved in " +
                    ((.@min)?            "[ " + .@min + " ] minute"         + ((.@min > 1)?"s":""):"") +
                    ((.@min && .@sec)?    " and ":"") +
                    ((.@sec)?            "[ " + .@sec + " ] second"    + ((.@sec > 1)?"s":""):"") +
                    "!",0x9ae2d7;
        end;            
}



I've made it on my own coding and aesthetic taste, adapt it as you wish.

Thank you @Haziel, it's working.

 

@Emistry, you forgot this.

"even i log out, the timer will save."

  • 0
Posted (edited)
22 hours ago, UnknownUser0317 said:

"even i log out, the timer will save."

updated.

 

18 hours ago, Bringer said:

 i know this off topic can you make dynamic hourly shop too?

You know its off topic, but you still post it .... should the mod reply with "You know you broke the rules, how many warning point you the mod to award you?"

Anyway you can search the forum for any dynamic shop, it's easily found in the forum...

Edited by Emistry
  • 0
Posted
10 minutes ago, UnknownUser0317 said:

Thank you @Emistry, but how can I know if the timer is saving? maybe add a command to check remaining time? Thanks!

updated.

  • 0
Posted

@Emistry can i request for this?
 

Every Hour you get reward points
After 8 consecutive hours, rewarding will start all over again


First Hour: 10 Rewards Points
Second Hour: 20 Reward Points
Third Hour: 30 Reward Points
Fourth Hour: 40 Reward Points
Fifth Hour: 50 Reward Points
Sixth Hour: 60 Reward Points
7th Hour: 70 Reward Points
8th Hour: 80 Reward Points

  • 0
Posted
9 minutes ago, Bringer said:

First Hour: 10 Rewards Points
Second Hour: 20 Reward Points
Third Hour: 30 Reward Points
Fourth Hour: 40 Reward Points
Fifth Hour: 50 Reward Points
Sixth Hour: 60 Reward Points
7th Hour: 70 Reward Points
8th Hour: 80 Reward Points

the script already give reward for 1~5th hours ... just add the 6~8 hours by yourself....

  • Upvote 1
  • 0
Posted
11 minutes ago, Emistry said:

the script already give reward for 1~5th hours ... just add the 6~8 hours by yourself....

After 8 consecutive hours, rewarding will start all over again

can please remove the  12 midnight for reset.

  • 0
Posted
8 hours ago, Emistry said:

updated.

@Emistry, i got mysql error when deleting variable #daily_minute_count

[SQL]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '` WHERE `key` = '#daily_minute_count' AND `account_id` IN (SELECT `account_id` F' at line 1
[Debug]: at c:\ragnarok\src\map\script.c:16404 - DELETE FROM `acc_reg_num` WHERE `key` = '#daily_minute_count' AND `account_id` IN (SELECT `account_id` FROM `char` WHERE `login` = 0 GROUP BY `account_id`)
[Debug]: Source (NPC): hourly_point_main (invisible/not on a map)

 

  • 0
Posted
On 11/29/2016 at 4:41 PM, Haziel said:

Very well, I had some spare time, so.

-    script    hourly_point_main    -1,{
    
    OnInit:
        .max_hour = 5;
        .duration = 3600;
        .npc_name$ = strnpcinfo(3);
        bindatcmd "hourly",    .npc_name$ + "::OnCheck";
        end;
        
    OnClock0000:
        query_sql( "DELETE FROM acc_reg_num` WHERE `key` = '#daily_hour_count' AND `account_id` IN ( SELECT `account_id` FROM `char` WHERE `login` = 0 GROUP BY `account_id` ) " );
        addrid(0);
        #daily_hour_count = -1;
        
    OnUpdate:
        deltimer .npc_name$+"::OnUpdate";
        #daily_hour_count++;
        switch ( #daily_hour_count ) {
            case 1:
                #CASHPOINT += 1;
                getitem 512,1;
                break;
            case 2:
                #CASHPOINT += 2;
                getitem 512,2;
                break;
            case 3:
                #CASHPOINT += 3;
                getitem 512,3;
                break;
            case 4:
                #CASHPOINT += 4;
                getitem 512,4;
                break;
            case 5:
                #CASHPOINT += 5;
                getitem 512,6;
                break;
            default: break;
        }
        
    OnPCLoginEvent:
        if ( #daily_hour_count < .max_hour ) {
            @timer = gettimetick(2) + .duration;
            addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
        }
        if ( #daily_hour_count )    dispbottom "[ Hourly Rewards ] " + #daily_hour_count + "/" + .max_hour + " hour" + ((#daily_hour_count > 1)?"s":"") + " played!",0x9ae2d7;
        end;
        
    OnCheck:
        .@min = (@timer - gettimetick(2))/60;
        .@sec = (@timer - gettimetick(2))%60;
        dispbottom "[ Hourly Rewards ] Your next reward will be achieved in " +
                    ((.@min)?            "[ " + .@min + " ] minute"         + ((.@min > 1)?"s":""):"") +
                    ((.@min && .@sec)?    " and ":"") +
                    ((.@sec)?            "[ " + .@sec + " ] second"    + ((.@sec > 1)?"s":""):"") +
                    "!",0x9ae2d7;
        end;            
}

I've made it on my own coding and aesthetic taste, adapt it as you wish.
Use @hourly to check time left

hello what if you want to continue the points even the player change character the minutes will continue or the time . it will not start from 59 minutes again

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...