here a new version which check the ip of the guid members
- script allwoecashrewards -1,{
OnAgitEnd:
setarray .@castle_map$, "prtg_cas01", "prtg_cas02", "prtg_cas03", "prtg_cas04", "prtg_cas05","aldeg_cas05", "payg_cas04", "gefg_cas02", "aldeg_cas02";// your castle map
.@size = getarraysize( .@castle_map$ );
while( .@j < .@size ) {
.@guild_id = getcastledata( .@castle_map$[.@j],1 );
if ( .@guild_id ) {
.@count = query_sql( "select distinct `account_id` from `char` where `online` = 1 and `account_id` = ( select `login`.`account_id` from `login` "+
"left join `char` on `char`.`account_id` = `login`.`account_id` where `guild_id` = "+ .@guild_id +" group by `last_ip` ) order by `account_id` asc", .@account_id );
for ( .@i = 0; .@i < .@count; .@i++ ) {
attachrid .@account_id[.@i];
#CASHPOINTS += 30;
}
query_sql "INSERT INTO `global_reg_value` (`char_id`, `str`, `value`, `type`, `account_id`) (select distinct '0', '#CASHPOINTS', '30', '2', `account_id` "+
"from `char` where `online` = 0 and `account_id` = ( select `login`.`account_id` from `login` "+
"left join `char` on `char`.`account_id` = `login`.`account_id` where `guild_id` = "+ .@guild_id +" group by `last_ip` ) order by `account_id` asc) "+
"on duplicate key update `value` = `value` +30";
}
.@j++;
}
end;
}