// Race to the Max Level Script // Original Author [ Capuche ] // Edited Version [ NubDesigner ] // 8-16-2014 prontera,148,111,5 script Race to MaxLevel 423,{ // A Small Configuration ------------------------- set .@reward_limit,41; // Rewards Count > If the value already exceed, npc will decline to give rewards anymore set .@bLvl,99; // Base Level requirements. set .@jLvl,70; // Job Level requirements. // ----------------------------------------------- if( BaseLevel == .@bLvl && JobLevel == .@jLvl && reward_limit == 0 && Upper && .count < .@reward_limit ){ //if( .count < 3 ) // getitem 501,1; if( .count < 40 ) getitem 501,1; getitem 502,1; getitem 503,1; getitem 504,1; reward_limit++; .count++; announce "Congratulations " + strcharinfo(0) + " for receiving the Level | Job Level "+.@bLvl+"/"+.@jLvl+" Reward, there are only "+ (.@reward_limit-.count) +" Rewards Left!",0; } else if ( reward_limit ) { mes "[ Race to Max Level ]"; mes "You've already got your reward."; mes "Please give chance to others."; mes "Thank you."; close; } else if ( BaseLevel != .@bLvl ) { mes "[ Race to Max Level ]"; mes "You need to be atleast Level "+.@bLvl+"."; mes "To claim your reward."; mes " "; mes "Reward Left : ^E42217"+ (.@reward_limit-.count) +"^000000 Left."; close; } else if ( JobLevel != .@jLvl) { mes "[ Race to Max Level ]"; mes "You need to have atleast"; mes "Job Level "+.@jLvl+"."; mes "To claim your reward."; mes " "; mes "Reward Left : ^E42217"+ (.@reward_limit-.count) +"^000000 Remaining."; close; } mes "[ Race to Max Level ]"; mes "I am so sorry, But it seems that all rewards are claimed already."; mes " "; mes "Reward Left : ^E42217"+ (.@reward_limit-.count) +"^000000 Left."; close; end; OnInit: .count = query_sql( "select `value` from `global_reg_value` where `str`= 'reward_limit'", .@value ); if ( .count >99 ) end; // limit to 127 players online here .@size = query_sql( "select `account_id` from `char` where `char_id` not in ( select `char_id` from `global_reg_value` where `str`= 'reward_limit' ) and `online`=1", .@account_id ); for ( .@i = 0; .@i < .@size; .@i++ ) { attachrid .@account_id[.@i]; if ( reward_limit ) { .count++; if ( .count > 39 ) end; } } end; }