Hi Everyone,
I'm trying to implement a condition
- if the party member is not within 14 cell of the mvp killer ( that player will not receive a point )
Thank you in advance
here is the part of my code
OnNPCKillEvent:
if( getgmlevel() >= 60 ) end; // if gm.. event wont trigger
for (.@i = 0; .@i < getarraysize(.mvp_id); .@i += 3 ) {
if( killedrid == .mvp_id[.@i] && compare( strcharinfo(3), .maps$[.@i/3] ) ) {
.@solopoints = .mvp_id[.@i+1];
.@partypoints = .mvp_id[.@i+2];
if( .haltevent ) { // temporarily disable while giving away rewards to avoid bugs
dispbottom "Event is still giving away rewards. This kill wont not recorded.", 0xff0000;
end;
}
query_sql( "INSERT INTO `mvp_ladder_rank` SET `char_id`='"+ getcharid(0) +"', `name`='"+ strcharinfo(0) +"', `day_kills` = '1', `week_kills` = '1', `month_kills` = '1', `all_kills` = '1' ON DUPLICATE KEY UPDATE `day_kills` = `day_kills` + 1, `week_kills`=`week_kills` + 1, `month_kills` = `month_kills` + 1,`all_kills` = `all_kills` + 1" );
if( !getcharid(1) ) {
if(.Option&8 && rand(100) < .chance)
{
.@annouce = true;
for (.@p = 0; .@p < getarraysize(.solo_reward); .@p+=2)
getitem .solo_reward[.@p], .solo_reward[.@p+1];
}
if(.Option&16) {
#MVPPOINTS += .@solopoints;
dispbottom "You got "+ .@solopoints +" MVP Points. Total: "+ #MVPPOINTS;
}
if ( .@annouce )
announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all;
else
announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3), bc_all;
} else {
if ( rand(100) < .chance )
.@chance = true;
if ( .@chance )
announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all;
else
announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), bc_all;
getpartymember getcharid(1), 1;
getpartymember getcharid(1), 2;
for ( .@q = 0; .@q < $@partymembercount; ++.@q ) {
if ( isloggedin( $@partymemberaid[.@q], $@partymembercid[.@q] ) ) {
.@count_online++;
if(.Option&16) {
attachrid $@partymemberaid[.@q];
getmapxy ( @map$, @x, @y, BL_PC );
if ( distance(.@x, .@y, @x, @y) > 15 || @map$ != .@map$ ) {
#MVPPOINTS += .@solopoints;
dispbottom "You got "+ .@solopoints +" MVP Points. Total: "+ #MVPPOINTS;
if ( .@annouce )
announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all;
else
announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3), bc_all;
}
else
#MVPPOINTS += .@partypoints / $@partymembercount;
dispbottom "--------------------------------------------";
dispbottom "You got "+ (.@partypoints / $@partymembercount) +" MVP Points. Total: "+ #MVPPOINTS;
dispbottom "--------------------------------------------";
.@partymemberaid[.@c] = $@partymemberaid[.@q];
++.@c;
}
}
}
if ( .Option&8 && .@chance ) {
for (.@p = 0; .@p < getarraysize(.party_reward); .@p+=2)
getitem .party_reward[.@p], .party_reward[.@p+1];
}
}
end;
}
}
end;