Jump to content

Question

Posted (edited)

Allows players who afk and pubbing to gain points except players who use @autotrade or Vending I see this script any one help me

 

-    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:
                #KAFRAPOINTS += 1;
                getitem 512,1;
                break;
            case 2:
                #KAFRAPOINTS += 2;
                getitem 512,2;
                break;
            case 3:
                #KAFRAPOINTS += 3;
                getitem 512,3;
                break;
            case 4:
                #KAFRAPOINTS += 4;
                getitem 512,4;
                break;
            case 5:
                #KAFRAPOINTS += 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;            
}

 

Edited by Akkarin
I've told you countless times before to use Codebox instead of Quotes for code. Don't do it again.

6 answers to this question

Recommended Posts

  • 0
Posted
-	script	Hourly Active	-1,{
OnUpdate:
if( checkvending() == 0 && checkchatting() == 1 ){
		set @Minute,@Minute + 1;
		if( @Minute % 60 == 0 ){
				set #KAFRAPOINTS, #KAFRAPOINTS + 1;
			dispbottom "You've been Active for 60 minutes, +1 Kafra point(s) in your Balance.";
			set @Hour,@Hour + 1;
			if( @Hour % 7 == 0 ){
				set #KAFRAPOINTS, #KAFRAPOINTS + 10;
				dispbottom "You've been Actively Online for 7 Hours, +10 Kafra point(s) in your Balance.";
			}
		}
	}
	OnPCLoginEvent:
	addtimer 60000,strnpcinfo(0)+"::OnUpdate";
	end; 
}

You can use this script, i dont know how to manipulate sql XD

  • 0
Posted

This simple script works fine:

-	script	HorlyPoints	-1,{

OnInit:
	end;

OnMinute01:
	query_sql("SELECT `account_id` FROM `char` WHERE `online`='1'",.@accid);
	for(set .@i,0; .@i<getarraysize(.@accid); .@i++){
		attachrid(.@accid[.@i]);
		if(!getstatus(SC_JAILED)){
			if (!checkvending() && !checkchatting() && !checkidle()){
				dispbottom "[Hourly Point]: You've received a point.";
				getitem xxx,1;
			}
		}
		detachrid;
	}
	end;
}

Rynbef~

  • 0
Posted
12 minutes ago, Rynbef said:

This simple script works fine:


-	script	HorlyPoints	-1,{

OnInit:
	end;

OnMinute01:
	query_sql("SELECT `account_id` FROM `char` WHERE `online`='1'",.@accid);
	for(set .@i,0; .@i<getarraysize(.@accid); .@i++){
		attachrid(.@accid[.@i]);
		if(!getstatus(SC_JAILED)){
			if (!checkvending() && !checkchatting() && !checkidle()){
				dispbottom "[Hourly Point]: You've received a point.";
				getitem xxx,1;
			}
		}
		detachrid;
	}
	end;
}

Rynbef~

Hello Rynbef~

Allows players who afk and pubbing to gain points except players who use @autotrade or Vending

if (!checkvending() && !checkchatting() && !checkidle()){  <------------------------ This line

 

  • 0
Posted

Just remove ckeckidle()

-	script	HorlyPoints	-1,{

OnInit:
	end;

OnMinute01:
	query_sql("SELECT `account_id` FROM `char` WHERE `online`='1'",.@accid);
	for(set .@i,0; .@i<getarraysize(.@accid); .@i++){
		attachrid(.@accid[.@i]);
		if(!getstatus(SC_JAILED)){
			if (!checkvending() && !checkchatting()){
				dispbottom "[Hourly Point]: You've received a point.";
				getitem xxx,1;
			}
		}
		detachrid;
	}
	end;
}

Rynbef~

  • -1
Posted

Hello! Do you guys know how to reset the consecutive hours if the player logs out?

Example:

The player has already accumulated 3 hrs for staying online. Then the player logs out. Then when the player relogs in. The accumulated hours is reset to 0.

 

Thanks!

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...